Jump to content

Run psexec on remote pc via IP address


Willow
 Share

Recommended Posts

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")
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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.

Link to comment
Share on other sites

  • Developers

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")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 :)

Link to comment
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!

Link to comment
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.

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...