Re: restart end user workstations from remote
- From: mjerikboo777 <mjerikboo777@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Jan 2006 08:56:06 -0800
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
>
>
>
.
- Follow-Ups:
- Re: restart end user workstations from remote
- From: Paul Williams [MVP]
- Re: restart end user workstations from remote
- References:
- Re: restart end user workstations from remote
- From: Jimmy D
- Re: restart end user workstations from remote
- From: Paul Williams [MVP]
- Re: restart end user workstations from remote
- Prev by Date: Re: Concurrent LDAP Binds
- Next by Date: Can't add new 2K3 DC to existing domain - error message!
- Previous by thread: Re: restart end user workstations from remote
- Next by thread: Re: restart end user workstations from remote
- Index(es):
Relevant Pages
|
Loading