Re: restart end user workstations from remote



when listing hosts in .txt file can they be netbios names or FQDN?

"Paul Williams [MVP]" wrote:

> The following is a script that will reboot all systems listed in a text
> file. It can easily be changed to only reboot systems in a given OU.
>
> Ensure that the textfile RebootPCs.txt and SHUTDOWN.EXE (or PSSHUTDOWN.EXE)
> are in the same folder as the script, and schedule to run using CSCRIPT.EXE.
>
> If you use PSSHUTDOWN instead of SHUTDOWN, modify this line:
>
> objWshShell.run "shutdown \\" & strHost & " -r -f -t 180"
>
> To be:
>
> objWshShell.run "psshutdown \\" & strHost & " -r -f -t 180"
>
>
>
> ' **************************************************************
> ' RebootPCs.vbs
> '
> ' read computer names from text file and reboot each computer
> ' sequentially using SHUTDOWN.
> '
> ' paul williams, msresource.net, june 2004
> '
> ' **************************************************************
> Option explicit
>
> const FOR_READING = 1
> const FILE_NAME="RebootPCs.txt"
>
> dim objOperatingSystem,objWshShell,objFso,objFileIn,objWmi
> dim colOperatingSystems,arr()
> dim strHost,str
> dim i,oExec
>
> i=0
>
> set objWshShell=wscript.createObject("WScript.Shell")
> set objFso=createObject("Scripting.FileSystemObject")
> set objFileIn=objFso.openTextFile(FILE_NAME,FOR_READING)
>
> if(err.number<>0)then err.clear : echo"File does not exist." :
> wscript.quit(-1)
> readHosts
> rebootHosts
>
>
>
> ' ***********************************************
> ' readHosts()
> '
> '
> ' ***********************************************
> Private Sub readHosts()
> do while objFileIn.atEndOfLine<>true
> reDim preserve arr(i)
>
> str=objFileIn.readLine
> arr(i)=str
>
> i=i+1
> loop
> End Sub
>
>
>
> ' ***********************************************
> ' rebootHosts()
> '
> '
> ' ***********************************************
> Private Sub rebootHosts()
> for each strHost in arr
> objWshShell.run "shutdown \\" & strHost & " -r -f -t 180"
> next
> End Sub
>
>
>
> ' ***********************************************
> ' echo(string messageToEcho)
> '
> ' Sub routine simply echos the passed string.
> ' Sub used for outputting all information to the screen/ console
> '
> ' ***********************************************
> Private Sub echo(strMessage)
> wscript.echo strMessage
> End Sub
>
>
>
> --
> Paul Williams
> Microsoft MVP - Windows Server - Directory Services
> http://www.msresource.net | http://forums.msresource.net
>
>
>
.



Relevant Pages

  • Re: WMI and Joining Domain (sysprep related)
    ... > Just keep in mind that you have to rename the computer and reboot before you ... > use a script to automaticaly generate a sysprep.inf file that includes ... Dim sps_barcode,Flag,ExtraMsg ... '' Get workstation BIOS info for oeminfo '' ...
    (microsoft.public.scripting.vbscript)
  • Re: Save Document oddity
    ... If I reboot, ... Sub InsrtPath() ... Dim pPathname As String ... Dim pFoldername As String ...
    (microsoft.public.word.vba.general)
  • Re: Save Document oddity
    ... Graham Mayor - Word MVP ... Sub Saved() ... If I reboot, Word 2003 alone responds ... Dim pPathname As String ...
    (microsoft.public.word.vba.general)
  • Re: restart end user workstations from remote
    ... It can easily be changed to only reboot systems in a given OU. ... are in the same folder as the script, and schedule to run using CSCRIPT.EXE. ... dim objOperatingSystem,objWshShell,objFso,objFileIn,objWmi ... Private Sub readHosts() ...
    (microsoft.public.windows.server.active_directory)
  • Re: Detecting is hyperthreading is enabled with WMI?
    ... It is too bad that WMI does not give this info. ... have to be done to the script. ... Public Sub DisplayProcessorInfo ... dim ProcessorSet, Processor ...
    (microsoft.public.windowsxp.wmi)

Loading