uolabrat Posted January 8, 2009 Share Posted January 8, 2009 I have a script that calls cmd.exe through run(). When I execute the script directly (in front of the computer, click on the script, click run,...etc.) it runs in cmd with my account, c:\"account stuff...". However, when I try to activate the script remotely it runs under "c:\windows\system32". Is there a way that I can change this? Assume that I am logged in as a user with full admin rights to all machines concerned, but that, if possible I would like to avoid having to ask for username and password for every execution of the script. regards, the Lab Rat Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2009 Developers Share Posted January 8, 2009 FileChangeDir() ? 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 More sharing options...
uolabrat Posted January 8, 2009 Author Share Posted January 8, 2009 FileChangeDir() ?JosTried that using cd in cmd with no luck. It seems the trouble starts when I try to call the script remotely (through psexec) it runs the script, but the result is access denied because it is running it as c:\Windows\system32 and not c:\"user stuff" Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2009 Developers Share Posted January 8, 2009 (edited) Tried that using cd in cmd with no luck. It seems the trouble starts when I try to call the script remotely (through psexec) it runs the script, but the result is access denied because it is running it as c:\Windows\system32 and not c:\"user stuff"A CD in a CMD window would not work unless you start a program in that same CMD session.The FileChangeDir() will change the workdir of the running script.Maybe you could explain exactly what you are trying and is failing?Jos Edited January 8, 2009 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 More sharing options...
uolabrat Posted January 8, 2009 Author Share Posted January 8, 2009 A CD in a CMD window would not work unless you start a program in that same CMD session.The FileChangeDir() will change the workdir of the running script.Maybe you could explain exactly what you are trying and is failing?JosI just tried it, and it correctly changes the directory, but I still get access denied. I think that it is going to a different set of user permissions when I use psexec... I've seen some notes on this in the forum, but there are no concrete solutions that I can find.As to what I'm doing...I have a script running on a lab pc that is monitoring an application. The script tells me (on my office pc) when a specific window opens (indicating a specific point in the processing cycle) via psexec, by making a note in a log file and then opening a dialog menu on my office pc and then closes the triggering window and resets itself to monitoring. The problem l'm running into is that when I remotely start the script via psexec from my office pc it doesn't work, and returns an access denied message in cmd; but if start the script from the lab pc it runs just fine. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2009 Developers Share Posted January 8, 2009 (edited) I have written quite a few scripts which I ran via PXEXEC on remote pc's and used that to fix issue on those PC's in the background. What are is your script doing that makes it fail and at what point does it fail? Jos Edited January 8, 2009 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 More sharing options...
azure Posted January 8, 2009 Share Posted January 8, 2009 perhaps the account the psexec service runs as doesn't have access to that user directory? Why not specify credentials? psexec \\computername -u DOMAIN\user -p PASSWORD autoitscript.exe There are also switches for credential and how psexec is running.. plus if you're doing any sort of window manipulation, you'll want to add the -i switch to run it interactively with the desktop. Link to comment Share on other sites More sharing options...
uolabrat Posted January 8, 2009 Author Share Posted January 8, 2009 I have written quite a few scripts which I ran via PXEXEC on remote pc's and used that to fix issue on those PC's in the background.What are is your script doing that makes it fail and at what point does it fail?JosHere is the timeline:1. execute command via psexec (from office to lab pc)2. script starts and monitors3. "trigger" window opens 4. script detects trigger window5. script sends psexec command to office pc to log event (via a local script). Monitor script closes "trigger window" and rests to monitoring.---receive psexec "access denied" error here, rest of remote stuff doesn't execute. ---6. office pc receives psexec command and logs event (via local script) Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2009 Developers Share Posted January 8, 2009 (step5)Are you actuallty running another PSEXEC command on the Lab machine to send info back? Why not just send Console info which is than shown in the commandwindow of the original PSexec command? 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 More sharing options...
uolabrat Posted January 8, 2009 Author Share Posted January 8, 2009 (step5)Are you actuallty running another PSEXEC command on the Lab machine to send info back?Why not just send Console info which is than shown in the commandwindow of the original PSexec command?Josbecause I need to have the logging script trigger some automation on the office machine. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2009 Developers Share Posted January 8, 2009 could be I am not fully understanding, but the way I have done it till now is to have a script on my PC running PSEXEC for me which would run a script on the remote PC. The local script would then monitor the returned information in STDOUT of the shelled PSEXEC and depending on what is returned trigger steps on my local PC. Anyway, you are specifying the UserId&Password on the PSEXEC command which is shelled on the LAB PC? 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 More sharing options...
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