‘ This script returns the following details on the local computer:
1. IP address
2. Computer name
3. Last reboot time
4. user name
I compiled it to exe and push it to all the workstations using GPO
It looks like this
Copy and save as vbs file:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Function WMIDateStringToDate(dtmBootup)
WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & “/” & _
Mid(dtmBootup, 7, 2) & “/” & Left(dtmBootup, 4) _
& ” ” & Mid (dtmBootup, 9, 2) & “:” & _
Mid(dtmBootup, 11, 2) & “:” & Mid(dtmBootup, _
13, 2))
End Function
Dim NIC1, Nic, StrIP, CompName, objWMIService, colOperatingSystems, dtmBootup, dtmLastBootupTime
Set NIC1 = GetObject(“winmgmts:”).InstancesOf(“Win32_NetworkAdapterConfiguration”)
For Each Nic in NIC1
if Nic.IPEnabled then
StrIP = Nic.IPAddress(i)
Set WshNetwork = WScript.CreateObject(“WScript.Network”)
CompName= WshNetwork.Computername
end If
Next
Set objWMIService = GetObject(“winmgmts:” & strComputer & “\root\cimv2”)
Set colOperatingSystems = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”)
For Each objOS in colOperatingSystems
dtmBootup = objOS.LastBootUpTime
dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
MsgBox “IP Address: “&StrIP & vbNewLine _
& “Computer Name: ” &CompName & vbNewLine _
& “Last Reboot Time: “&dtmLastBootupTime & vbNewLine _
& “User Name : “& WshNetwork.UserName
‘MsgBox “Last Reboot: ” & dtmLastBootupTime
‘MsgBox “The current user is ” & WshNetwork.UserName
wscript.quit
Next
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Good luck