Ermittelt das Betriebssystem des angegebenen Rechners über WMI. Dieses wird als Text ausgegeben. Z.B.: "Microsoft 7 Professional N"
Private Function getOs(ByVal Computer As String) As String
Dim objWMIService As Object
Dim objItems As Object
Dim objItem As Object
getOs = Nothing
objWMIService = GetObject("winmgmts:\\" & Computer & "\root\CIMV2")
objItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objItem In objItems
getOs = objItem.Caption
Next
objWMIService = Nothing
objItems = Nothing
objItem = Nothing
End Function
Kommentare zum Snippet