mimo78 Posted March 9, 2007 Posted March 9, 2007 I am having trouble with psexec from sysinternals(now microsoft) and I was wondering if anyone had the same experience. I have a script that instructs a remote machine copy a cmd script and then execute it (the -c switch) I had tested it first with an exe and there is no problem with the exe files. But when using cmd files the remote host doesn't terminate psexecsvc.exe and therefor my script never get something back telling it that the command was executed and we can quit. it just keeps running the psecx process until i terminate it manualy on the remote host (after that my script on the controlong machine stops the scrip correctly) when i do the same thing as my script in a commando promt instead there is no error?!? anyone working with psexec expirienced this and know the cause or just the solution? The run command I use in script: $command = "psexec " &$host &" -u " &$username &" -p " &$password &" -i -c " &$serverpath &"\" &$program $run = run($command, "",@SW_MAXIMIZE, 2 + 4) host is the remote host, username is username, password is password, serverpath is the path to the server, program is the cmd (or exe) to copy and start. The run command in my command promt: psexec \\test-pc -u Admin -p fejlkode47 -i -c \\server\programmer\!deploy\testprog.cmd from command prompt success, from script failure: why?!? anuone anyida?!? plz help Best Regards Mimo
mimo78 Posted March 9, 2007 Author Posted March 9, 2007 1 and a haf day I spend debuging my code. while it was my cmd script all along, when i first found the problem and didn't find the cause I tryed every thing. All along it was my cmd files that got the service on the remote machine halted. it turns out that when I added a @echo off and NO echo lines in script it WORKS pling I did turn off echo, but didn't remove the echo lines telling I am now installing this for you, bla bla bla Let this be a leason for all: find out WHATS wrong, then find out WHY wrong then walking that path the soulution WILL come to you somehow..... Best Regards Mimo
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now