Tigerweld Posted May 20, 2013 Share Posted May 20, 2013 Can anyone tell me why this won't run? I know I have to be close to makeing it work. $ipAddress = InputBox("IP or Host", "Enter IP or Hostname","","") $sRemoteLocalPath = "c:\temp\" $LocalFile = "uninstall_java.bat" Run('PsExec \\' & $ipAddress & ' "' & $sRemoteLocalPath & $LocalFile & '"', '', @SW_HIDE) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 20, 2013 Moderators Share Posted May 20, 2013 Tigerweld, can you please provide a little more insight as to what you mean by "won't run"? The code seems to be working just fine for me; you simply did not provide a way to capture the return from psexec. Is that what you are after, or are you receiving an error? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Tigerweld Posted May 20, 2013 Author Share Posted May 20, 2013 After I enter the ip address for the input box nothing happens. No error or anything. Running the script from a windows 2008 server on a windows 7 workstation with domain admin rights. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 20, 2013 Moderators Share Posted May 20, 2013 (edited) PSExec is a command line tool. If you want some visual representation of what it is doing, you have to code that in. Try this to illustrate what I mean: $ipAddress = InputBox("IP or Host", "Enter IP or Hostname","","") $sRemoteLocalPath = "c:\temp\" $LocalFile = "uninstall_java.bat" Run('C:\PsExec.exe \\' & $ipAddress & ' ' & $sRemoteLocalPath & $LocalFile & ' > C:\Temp\My.log', "", @SW_HIDE) Notice that it outputs to a log file - you'll find this in the temp directory on the machine you're connecting to. You can choose another location for the log file, but this should illustrate what I'm getting at. Edited May 20, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Tigerweld Posted May 21, 2013 Author Share Posted May 21, 2013 It still isn't working. I can run just the psexec from a comand prompt and it works, but running psexec inside Autoit does not work. Maybe it cannot be done. Thanks for helping. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 21, 2013 Moderators Share Posted May 21, 2013 It can be done. The script that I provided works for me. I would suggest you begin by removing the variables from your script. Something like this: Run('C:\PsExec.exe \\10.10.10.1 C:\Temp\Uninstall_java.bat > C:\Temp\My.log', "", @SW_SHOW) If that works, it has something to do with the way you're dropping your variables in there. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
BrewManNH Posted May 21, 2013 Share Posted May 21, 2013 What do you get if you don't use @SW_HIDE and use @ComSpec /k? Run(@ComSpec & ' /k C:\PsExec.exe \\' & $ipAddress & ' ' & $sRemoteLocalPath & $LocalFile & ' > C:\Temp\My.log') Never use @SW_HIDE until you know the command is working the way you want it to. Otherwise, you're just guessing as to what is happening. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Tigerweld Posted May 21, 2013 Author Share Posted May 21, 2013 JLogan, that works when I do that. So how can I add my variables? Is there a way to place the path in just one varible and use that? Link to comment Share on other sites More sharing options...
Tigerweld Posted May 21, 2013 Author Share Posted May 21, 2013 BrewMan it gives me a 'psexec.exe' is not recognized as an internal or external command. Link to comment Share on other sites More sharing options...
BrewManNH Posted May 21, 2013 Share Posted May 21, 2013 Use the full path to where the program is located, that was an example. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 21, 2013 Moderators Share Posted May 21, 2013 (edited) Add the variables in one at a time to figure out which one is causing you the problem. Go from this: 1.Run('C:\PsExec.exe \\10.10.10.1 C:\Temp\Uninstall_java.bat > C:\Temp\My.log', "", @SW_SHOW) To this: 1.Run('C:\PsExec.exe \\' & $ipAddress & ' C:\Temp\Uninstall_java.bat > C:\Temp\My.log', "", @SW_SHOW) If this works, add the next variable: 1.Run('C:\PsExec.exe \\' & $ipAddress & ' ' & $sRemoeteLocalPath & 'Uninstall_java.bat > C:\Temp\My.log', "", @SW_SHOW) It's called troubleshooting Edited May 21, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jdelaney Posted May 21, 2013 Share Posted May 21, 2013 I also like to do logging of the run command, just before the execution, so I can check it's syntax. ConsoleWrite('C:\PsExec.exe \\' & $ipAddress & ' ' & $sRemoeteLocalPath & 'Uninstall_java.bat > C:\Temp\My.log' & @CRLF) Usually, something small, like forgetting a "", or omitting a space, somewhere. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 21, 2013 Moderators Share Posted May 21, 2013 Same here, jdelaney. I typically do it in a MsgBox, but same concept. Can't count the number of times I have banged my head against my desk over what turned out to be one too many or one too few spaces in a line. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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