Raj83 Posted February 7, 2013 Share Posted February 7, 2013 Hi All, I am getting an issue with one of our script in AutoIT, RunASWait command seems not working in some of the Win 7 machine. $Return=RunAsWait($UserArray[2],$UserArray[1],$Pass,0,@ComSpec & " /c " & Chr(34) & $BatchFile & Chr(34),"C:\Temp", @SW_SHOW) I have tried on different machine with same user privileges, but it works on some machines and did not work on some. it dosen't throw any error but remote machine is not rebooting. Please advice if any thing is funny in this code. Regards, Rajesh Suyal. Link to comment Share on other sites More sharing options...
MariusN Posted February 7, 2013 Share Posted February 7, 2013 (edited) all i can think of is, try and disable UAC and DEP... Could be some interference OR...that its a 64-bit OS...happened to me with some utilities i have compiled as 32 bit. After converting it to 64-bit, it worked ( with the EXACTLY same commands/functions ) Edited February 7, 2013 by MariusN Link to comment Share on other sites More sharing options...
Raj83 Posted February 7, 2013 Author Share Posted February 7, 2013 Thanks alot for your response. I checked the UAC and DEP setting is same on both the mahines, also, both machines having 32-Bit Windows 7 OS. can you advise how can I compile it to 64-bit. Link to comment Share on other sites More sharing options...
Raj83 Posted February 7, 2013 Author Share Posted February 7, 2013 $Return=RunAsWait($UserArray[2],$UserArray[1],$Pass,0,@ComSpec & " /c " & Chr(34) & $BatchFile & Chr(34),"C:Temp", @SW_SHOW).Also, I would like to add here is if I click on the batch file (highlighted in red above) manually it runs ok, but it doesn't with above command on some windows 7 machine. Link to comment Share on other sites More sharing options...
Raj83 Posted February 14, 2013 Author Share Posted February 14, 2013 Hi, Can anyone provide me some hint of doing same thing by anyother way, here I am creating a batch file of reboot command for many machines and running them in one go. batch file created successfully and it doesn't work on some of the windows 7 machines. manually clicking on batch file runs fine. Link to comment Share on other sites More sharing options...
BrewManNH Posted February 14, 2013 Share Posted February 14, 2013 Is the batch file just rebooting the computer or does it do other things before the reboot? Because there's an internal AutoIt command for rebooting look up Shutdown in the help file. 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...
Raj83 Posted February 14, 2013 Author Share Posted February 14, 2013 batch file contains only below;shutdown -r -m VDTPXP-23-13 -c "Rebooted using PandL Rebooter by rsuyal"EXIT 45 Link to comment Share on other sites More sharing options...
Raj83 Posted February 14, 2013 Author Share Posted February 14, 2013 the internal command is for Shutdown/reboot local machine. I want to reboot remote machine. Link to comment Share on other sites More sharing options...
Tonnie Posted February 14, 2013 Share Posted February 14, 2013 In the batchfile you posted, the -m VDTPXP-23-13 is a reference to the computername. Does it match the computer you are trying to reboot? Link to comment Share on other sites More sharing options...
Raj83 Posted February 14, 2013 Author Share Posted February 14, 2013 yes, infact its working fine on all WinXP machines, but doesn't work on some Windows 7 machine. doesn't give any error but nothing happens if you look at the other end.I am running the batch file via AutoIT code below.$Return=RunAsWait($UserArray[2],$UserArray[1],$Pass,0,@ComSpec & " /c " & Chr(34) & $BatchFile & Chr(34),"C:Temp", @SW_SHOW).On investigation I can confrim that above command is failing as if I click on batch file, it reboots the remote machine successfully.$UserArray[2] : Admin User on both local as well as Remote machine.$UserArray[1] : Domain.$Pass : Admin password.I am running with Admin Username and Password. Any Clue.. Link to comment Share on other sites More sharing options...
PhoenixXL Posted February 14, 2013 Share Posted February 14, 2013 try with #RequireAdmin flag ? My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Raj83 Posted February 14, 2013 Author Share Posted February 14, 2013 try with #RequireAdmin flag ?Yes, I have already tried, but no luck. also check UAC on both the machine (where it's running fine and where it's failing) and its also same. Link to comment Share on other sites More sharing options...
Colyn1337 Posted February 14, 2013 Share Posted February 14, 2013 When you run the script, do you get an error? Link to comment Share on other sites More sharing options...
LarryDalooza Posted February 14, 2013 Share Posted February 14, 2013 I always use '-f' with shutdown.exe to force it. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
Raj83 Posted May 15, 2013 Author Share Posted May 15, 2013 This issue still haunt's me, does anyone have found any reason for the script now working. Link to comment Share on other sites More sharing options...
spudw2k Posted May 15, 2013 Share Posted May 15, 2013 Check the event logs on the machines that fail to see what the issue is. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 15, 2013 Moderators Share Posted May 15, 2013 Have you tried just doing it in pure AutoIt, rather than running an AutoIt script to call a batch file? Something like this? ShellExecute("shutdown.exe", '-r -m \\VDTPXP-23-13 -c "Rebooted using PandL Rebooter by rsuyal"') If you need to do the RunAs, you could always try it without the batch file as well: RunAsWait($UserArray[2], $UserArray[1], $Pass, 0, 'Shutdown -r -m \\VDTPXP-23-13 -c "Rebooted by me"', @TempDir, @SW_SHOW) "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