Shutdown with screen locked

  • Thread starter Thread starter Angelo Campitelli
  • Start date Start date
A

Angelo Campitelli

Im using the following script to reboot my machine... however if i have
locked the screen with

rundll32.exe user32.dll,LockWorkStation

the script doesnt shutdown the machine. It just kills the running
processes.... Any ideahow i can get it to shutdown the machine with the
screen locked.


Set OpSysSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//alexn-
pc ").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
OpSys.Reboot()
Next
 
Angelo said:
Im using the following script to reboot my machine... however if i have
locked the screen with

rundll32.exe user32.dll,LockWorkStation

the script doesnt shutdown the machine. It just kills the running
processes.... Any ideahow i can get it to shutdown the machine with the
screen locked.


Set OpSysSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//alexn-
pc ").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
OpSys.Reboot()
Next
Hi

See if using the Win32Shutdown method with forced reboot parameter
works better:

'--------------------8<----------------------
' define the constants for more understandable code
Const EWX_REBOOT = 2
Const EWX_FORCE = 4

For Each OpSys In OpSysSet
OpSys.Win32Shutdown EWX_REBOOT + EWX_FORCE
Next
'--------------------8<----------------------


If that doesn't help, take the debug privilege (in addition to
the forced reboot).

Change (RemoteShutdown) to (RemoteShutdown,Debug)
 
Back
Top