Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RebootAll_ST is not working

Posted on 2006-07-14
2
Medium Priority
?
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
graye earned 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

609 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