JATO
7th April 2006 18:43 UTC
Copy a file and run file on Another local machine
IT Helpdesk.. trying to automate a Batch file fix... want to use NSIS to copy the Batch file to a workstation and then have it execute as THAT user not as the helpdesk person who copied it over.
I know how to copy it over using a UNC path
I know how to use EXEC -- but won't EXEC execute as the person who copied the file.. not the machine it was copied to?
I could have the person on the phone click on the batch file...but thought it would be cooler if it just RAN on it's own.
Please advise.. I've seen references to Exec and ShellExec but nothing that addresses my issue directly.
thanks
kichik
7th April 2006 19:51 UTC
As far as I know, you can't run a program as another user without the user's password or another application already running under the user's control.
However, you can write to the user's registry by manually loading the hive. That way, you can have your application execute when the user logs in. Put it in the RunOnce registry key.
JATO
7th April 2006 20:01 UTC
thanks.. yeah, thought about doing that..but since we're a helpdesk.. we want to save time and NOT have people reboot if we can help it.
I'll just have the employee double click on the Batch file manually after it's copied over.
if anyone else has a better work around besides RunOnce or starting a service... please let me know
Brummelchen
7th April 2006 20:04 UTC
"runas.exe" is your friend