• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

is there a way to see from ADUC or something how long a server has been up?

right now i have to log into each one and run "net statistics server" PAIN
0
NAMEWITHELD12
Asked:
NAMEWITHELD12
  • 3
  • 2
  • 2
  • +2
1 Solution
 
Joseph DalyCommented:
You might want to take a look at psuptime from sysinternals (now part of ms)
http://doc.sch130.nsc.ru/www.sysinternals.com/ntw2k/freeware/psuptime.shtml
0
 
Donald StewartNetwork AdministratorCommented:
Or the script from this page


http://www.naterice.com/articles/32
0
 
NAMEWITHELD12Author Commented:
I have used this but i am instested in like an AD QUERRY HMMMMMMMMM???/ to do this to see it on one page and export it to a XLS or something like that
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Joseph DalyCommented:
In active directory itself there is no built in uptime counter. The only thing that is even really close to that would be the last logon time stamp but I dont think that will do what you are looking for.

0
 
Alan HardistyCommented:
Press CTRL + SHIFT + ESC to bring up Task Manager, click on the processes tab, click onto the CPU Time column (if you have one - if not click on View, Select Columns and add it, then click on it) and this wil show you how long the server has been running for.
This shows Hours:Minutes:Seconds.  So you may see something like 138:10:33 which equates to nearly 6 days.
0
 
NAMEWITHELD12Author Commented:
I am trying to do this with out logging into each server like from ADUC or something
0
 
Donald StewartNetwork AdministratorCommented:
0
 
mass2612Commented:
Hi,

As long as you have admin rights to each of the servers I use a simple script that I run run as a scheduled task.
You need a file called "Computers.txt" in the same directory as the vbScript which has each server name on a seperate line.

Then run :-
cscript UptimeReport.vbs > UptimeReport.csv

I run this as a schduled task and check it the result regularly.

'UptimeReport.vbs
'creates report on server uptime for a list of servers

Option Explicit

Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim strUserName
Dim strPassword
Dim colItems
Dim strBootDate
Dim strTimeAtRun
Dim objFile
Dim objFSO

strUserName = ""
strPassword = ""
strTimeAtRun = Now

Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("Computers.txt", 1)

WScript.Echo "Current Time: " & strTimeAtRun

Do Until objFile.AtEndOfStream
    strComputer = objFile.ReadLine
    On Error Resume Next
    Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root\CIMV2",strUserName,strPassword)
	Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
	For Each objItem In colItems
		strBootDate = WMIDateStringToDate(objItem.LastBootUpTime)
		WScript.Echo "Computer Name: " & "," & strComputer & "," & "Last Boot Time: " & "," & strBootDate

'		WScript.Echo "Last Boot Time: " & strBootDate
		'WScript.Echo "Time since last boot (HH:MM:SS): " & ConvertSecondsToTime(DateDiff("s",strBootDate,strTimeAtRun))
	Next
	On Error GoTo 0
Loop
objFile.Close

Function WMIDateStringToDate(dtmInstallDate)
    WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & _
        Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) _
            & " " & Mid (dtmInstallDate, 9, 2) & ":" & _
                Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, _
                    13, 2))
End Function

Function ConvertSecondsToTime(intNumSeconds)
	Dim intHours
	Dim intMinutes
	
	intHours = Int(intNumSeconds/3600)
	intNumSeconds = intNumSeconds - (intHours * 3600)
	intMinutes = Int(intNumSeconds/60)
	intNumSeconds = intNumSeconds - (intMinutes * 60)
	
	ConvertSecondsToTime = intHours & ":" & intMinutes & ":" & intNumSeconds
End Function

Open in new window

0
 
NAMEWITHELD12Author Commented:
AWESOME I will give it a try , but not tonight have to go home
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now