Sign in to follow this  
Followers 0
Willow

Run psexec on remote pc via IP address

7 posts in this topic

I need to update several internal computers on the network from one central pc. The basic concept is the user is prompted for an IP address then the program is run remotely with psexec.exe. I am having trouble getting the IP address variable passed to psexec.exe so that it will run on the remote pc.

Any help is much appreciated.

FileInstall("C:\autoitcode\updates.exe", "c:\data\updates.exe")
FileInstall("C:\autoitcode\psexec.exe", "c:\data\psexec.exe")

$a = InputBox("Get IP", "Enter IP Address.")

RunWait("c:\data\psexec -c -f -d \\"&$a, "updates.exe /S")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I do not understand what you want to do here. PSEXEC is normally used on a IT Tech's PC to run a program on a Remote User PC.

so why is the script ran on the Users PC and prompting for what IP address?

jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I do not understand what you want to do here. PSEXEC is normally used on a IT Tech's PC to run a program on a Remote User PC.

so why is the script ran on the Users PC and prompting for what IP address?

jos

To clarify, the autoit script is designed to run on the IT tech's pc, however he/she will need to input the IP of the remote pc.

Share this post


Link to post
Share on other sites

To clarify, the autoit script is designed to run on the IT tech's pc, however he/she will need to input the IP of the remote pc.

ok, so what should the commandline look like when you type it manually on the command prompt, because your Run() statement looks wrong as it contains a comma after a$.

Maybe:

RunWait("c:\data\psexec -c -f -d \\" & $a & " updates.exe /S")

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I think you are making a mistake somewhere - "updates.exe" is supposed to be on the remote machine not on your machine.

The purpose of psexec is to execute apps on remote machine.

For the correct command line syntax, see the documentation for psexec ... it might be tricky sometimes.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

ok, so what should the commandline look like when you type it manually on the command prompt, because your Run() statement looks wrong as it contains a comma after a$.

Maybe:

RunWait("c:\data\psexec -c -f -d \\" & $a & " updates.exe /S")

Thanks, that worked!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I think you are making a mistake somewhere - "updates.exe" is supposed to be on the remote machine not on your machine.

The purpose of psexec is to execute apps on remote machine.

For the correct command line syntax, see the documentation for psexec ... it might be tricky sometimes.

The -c option for psexec will copy the file ("updates.exe") to the remote pc. The -f option works in tandem with -c and will overwrite any older copies of files on the remote pc, which in this case is "updates.exe.

Edited by Willow

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0