WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: dragon49 on September 05, 2014, 10:08:51 AM

Title: Can I get remote PCs rebooted faster?
Post by: dragon49 on September 05, 2014, 10:08:51 AM
I have a simple Winbatch script that I use to reboot remote problematic PCs:

winhide("")
IntControl(67,0,1,0,0)

I invoke with across the network (after copying the executable to the remote local drive) with psexec, such as:

psexec \\pcname "C:\utils\reboot.exe"

The problem with the system is that often, the problem PC is so sluggish, that the psexec service takes a long time (sometimes, I just give up and pull the plug) to be invoked on the remote PC.  I always pull the plug as a last resort, as this can damage the  OS of Windows PCs. 

Is there a quicker way to get this done.  Assuming that I am a domain admin on my PC, does Winbatch have any kind of Psexec like utility that I can use to get the reboot script to launch instantly on the problem PC.  By the time I need to do this, usually the problem PCs console is frozen, but I don't have any problems copying files to the drive share.


Title: Re: Can I get remote PCs rebooted faster?
Post by: DAG_P6 on September 05, 2014, 10:14:48 AM
There is an IntControl function call that can initiate a reboot, however, if psexec can't do anything, I suspect that WinBatch won't fare any better.
Title: Re: Can I get remote PCs rebooted faster?
Post by: td on September 05, 2014, 10:28:16 AM
One possibility is

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Networks~-~Servers/Microsoft~Client/wNT+Remotely~Reboot~and~wntShutDown.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Networks~-~Servers/Microsoft~Client/wNT+Remotely~Reboot~and~wntShutDown.txt)

but no guarantee of a better outcome as mentioned.
Title: Re: Can I get remote PCs rebooted faster?
Post by: dragon49 on September 05, 2014, 10:31:46 AM
Thanks,

I'll try the script the next time I have problems with my normal routine.
Title: Re: Can I get remote PCs rebooted faster?
Post by: morenos1 on September 09, 2014, 02:38:33 PM
I use this:

code = 6  ;Reboot

logon = "domain\admin"
pswd = "Pass"
RmtComputer = "computer"

objLocator = ObjectCreate("WbemScripting.SWbemLocator")
objWMIService = objLocator.ConnectServer(RmtComputer,"root/cimv2",logonname,pswd)
   
colFiles = objWMIService.ExecQuery ("Select Name From Win32_OperatingSystem")
ForEach objFile In colFiles
   objFile.Win32ShutDown(code)
Next