troubleshooting Question

Script for last reboot

Avatar of tw525
tw525Flag for United States of America asked on
VB Script
7 Comments1 Solution1059 ViewsLast Modified:
I have a great script I found to reboot all the machines within a specific OU.

JeremyW posted this wonderful vbs script on Petri forums to force reboots:

On Error Resume Next

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

'--- change the DN to where you want to start your search ---
objCommand.CommandText = _
"<LDAP://ou=workstations,ou=corp,dc=domain,dc=com>;" & _
"(objectCategory=computer);distinguishedName,name; subtree"

Set objRecordSet = objCommand.Execute

While Not objRecordSet.EOF

RestartComputer objRecordSet.Fields("Name")



Sub RestartComputer(strComputer)

set objShell = CreateObject("WScript.Shell") 
objShell.Run "shutdown -s -t 0 -f -m \\" & strComputer

End Sub  

Open in new window

So now I'm looking to alter this script to again look inside a specific OU and report back the last reboot time for every computer within that OU.  Just a pop up with the info would be fine.  Can anyone help me alter this script to get the output I'm looking for?  (Or create a new script if that's easier)

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros