This is the common case where you want to trigger your scripts from remote machine. By using the term Remote machine i meant, suppose you develop your scripts on your development environment and keep your final scripts on some other machine which you use for test script execution purpose or let me put in other words if you want to run any script or any command from one machine to another remote machine using command line tool, here is the way which is available in Windows.
2. UnZip it and place it in any folder of your choice .
3. Open Command Prompt/ CMD and navigate to folder where you place the PSTools
4. Now type below command to connect to remote machine using IP address.
C:\project\PSTools> psexec \\10.20.30.13 -u phodu -p password -s cmd /c "D:\scriptRun.bat"
**Make sure scriptRun.bat is present in D: drive of remote computer.
-u = Specifies optional user name for login to remote computer.
-p = Specifies optional password for user name.
-s = Run the remote process in the System account.
In case you can't see the interactive Command prompt in remote machine then use -i parameter. Using this you can see cmd opens/launching in remote computer.
C:\project\PSTools> psexec \\10.20.30.13 -i 1 -u phodu -p password -s cmd /c "D:\scriptRun.bat"
Also, if you are unable to connect to Remote computer or you are getting access denied , then make sure to add / correct these steps :
1. Make sure that you are providing valid credentials to connect.
2. Check whether your remote computer is pinging by typing command in CMD like
c:\> ping <ipAddress of remote computer>
3. Check firewall is OFF in remote computer.
4. Add below registry entry into your remote computer.
Navigate to below path :
The above steps can be consolidated in a .bat file as below.1. Open notepad2. Copy below line of code in itcd /D C:/project/PSToolspsexec \\10.20.30.13 -i 1 -u phodu -p password -s cmd /c "D:\scriptRun.bat"exit3. Save it as "run.bat".Download the .bat file @ linkLet me know if you have any comments or need any help.
No comments:
Post a Comment