Solved

RebootAll_ST is not working

Posted on 2006-07-14
2
137 Views
Last Modified: 2010-04-23
I am not a programmer.  I have the task of doing remote reboots of all the workstations in my domain and needed a tool that would work simply for me.  I downloaded your tool and I believe I edited the script properly but the tool runs and doesn't rebbot any of the workstations in the OU.  I need to be ready for this tomorrow as we have scheduled a Domain rename.  This is of course Windows 2K3 AD.  There is nothing in the log file either.  There were no instructions as to exactly how to edit the vb script files.

Can you help???  
0
Comment
Question by:heqarota
2 Comments
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 17107911
Hummm... RebootAll_ST isn't a vb script.  It's Visual Basic .Net 2003 source code.

That means that you (or someone in your organization) will have to use Microsoft Visual Studio to compile the source code into a usable program that will run on your computer.  Luckily, Microsoft provides the Visual Basic 2005 Express Edition as a free download at http://msdn.microsoft.com/vstudio/express/vb

After compiling, you just edit the *.config file (with notepad or any other text editor) to change the parameters to suit your needs.  The parameters are fairly straight forward:

DOMAIN - The name of your AD domain
OU - a "filter" (if required) that limits the scope to a particular OU
FILTER - a "name filter" (if required) to select only PCs that match a pattern
EXCEPTION_LIST - the path to an text file that contains a list of PCs (one per line) to exclude
LOG_FILE - the path to a file that will contain the log of what's happening
LOG_LEVEL - How much detail goes in the log
LIST_METHOD - for you, it'd be "AD_Doman"

If you need a VBScript version, here is something that will do almost the same thing as the RebootAll_ST program.  It will require some editing to meet your needs (server, share, and domain names)

Dim objs, obj
Dim wsh, Cmd, i, buf, ComputerName
dim fso, ts, exclude(100), skip, list
dim MyName

' get a list of PCs that you want to exclude
set fso = createobject("Scripting.FileSystemObject")
list = 0
if fso.fileexists("\\SomeServer\SomeShare\Reboot_Exceptions.txt") then
      set ts = fso.OpenTextFile("\\SomeServer\SomeShare\Reboot_Exceptions.txt", 1)
      do while not ts.atendofstream
            exclude(list) = ts.readline
            list = list +1
      loop
end if

' find out our computer name (we don't want to reboot ourselves!)
' let's make sure this is one of our PCs!
Set objs = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")
for each obj in objs
      myname = obj.name
      exit for
next

' execute the "Net View" command
Set wsh = CreateObject("WScript.Shell")
set Cmd = wsh.Exec("Net View /Domain:YourDomain")
wscript.sleep 1000

' read the output and parse the computer names
do while Not Cmd.StdOut.AtEndOfStream
      buf = cmd.stdout.readline
      if left(buf, 2) = "\\" then
            i = instr(buf, " ")
            ComputerName = mid(buf, 3, i-3)
            ' check to see if we should exclude this PC
            skip = false
            for i = 0 to list -1
                  if ucase(computername) = ucase(exclude(i)) then
                        skip = true
                        exit for
                  end if
            next
            ' make sure to skip me!
            if computername = myname then
                  skip = true
            end if
            if not skip then
                  reboot computername
            end if
      end if
loop

sub reboot(computername)
      ' ignore errors (already logged off, not Win2k, etc)
      on error resume next
      Set objs = GetObject("WinMgmts://" & computername & "/root/cimv2").InstancesOf("Win32_OperatingSystem")
      for each obj in objs
            obj.Win32ShutDown(6)
      next
      set objs = nothing
      on error goto 0
end sub
0
 

Author Comment

by:heqarota
ID: 17109477
Thanks so much for your help.  As I said before, I'm no programmer and have'nt touched any code in years.  I think both solutions are excellent.  I have downloaded VB and am attempting to compile the code now.  

Thanks again
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now