Mit dieser Sub wird die Uptime eines Rechners in Minuten ermittelt
Private Function GetUptime(ByVal Computer As String) As Integer
Dim objWMIService As Object
Dim objItems As Object
Dim objItem As Object
GetUptime = Nothing
objWMIService = GetObject("winmgmts:\\" & Computer & "\root\CIMV2")
objItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_System")
For Each objItem In objItems
GetUptime = Int(objItem.SystemUpTime / 60)
Next
objWMIService = Nothing
objItems = Nothing
objItem = Nothing
End Function
3 Kommentare zum Snippet