Remotely Reboot and wntShutDown
Keywords: Remotely Reboot wntShutDown
Question:
Is there any way to write a script to remotely reboot a workstation or server from lets say my workstation?Answer:
wntShutdown, in the NT extender.
A Related Question:
I am working on a script that is triggered when my company's UPS's reach 20min of battery time left.When it reaches that state it fires this script off that shuts down the various servers in the correct order.
TWO problems.
1.) If the machine is already off, or it cant reach the machine it errors out instead of continuing on.
2.) Instead of doing a full shutdown; it only puts the machine at the state of "Your computer is now safe to turn off"
Does anyone know?
Answer:
AddExtender("WWWNT34i.DLL") AddExtender("wwint34i.dll") #DefineFunction scroll(scroll_txt, newline) If scroll_txt == "" Then scroll_txt = newline Else scroll_txt = StrCat(scroll_txt, @TAB, newline) While ItemCount(scroll_txt, @TAB) > 9 scroll_txt = ItemRemove(1, scroll_txt, @TAB) EndWhile BoxText(StrReplace(scroll_txt, @TAB, @CRLF)) Return scroll_txt #EndFunction BoxOpen("Emergancy Shutdown Sequence, press CTRL + BREAK to stop", "") TimeDelay(10) ; give user 10 seconds to try and stop shutdown... scroll_txt = scroll("", "Beginning shutdown") ;--------------------------------------------------- scroll_txt = scroll(scroll_txt, "Shuting down cc_ex01") ErrorMode(@OFF) shutdownstatus=wntShutdown( "cc_ex01", "", 0, @TRUE, @FALSE) ErrorMode(@CANCEL) If shutdownstatus == 0 scroll_txt = scroll(scroll_txt, "cc_ex01 could not be shutdown") Else scroll_txt = scroll(scroll_txt, "cc_ex01 SHUTDOWN") EndIf TimeDelay(10) ;--------------------------------------------------- scroll_txt = scroll(scroll_txt, "Shuting down cc_ex02") ErrorMode(@OFF) shutdownstatus=wntShutdown( "cc_ex02", "", 0, @TRUE, @FALSE) ErrorMode(@CANCEL) If shutdownstatus == 0 scroll_txt = scroll(scroll_txt, "cc_ex02 could not be shutdown") Else scroll_txt = scroll(scroll_txt, "cc_ex02 SHUTDOWN") EndIf TimeDelay(10)
Article ID: W14885