http://dieseyer.de • all rights reserved • © 2011 v11.4

'*** v9.3 *** www.dieseyer.de ******************************
'
' Datei: remotewinversion.vbs
' Autor: dieseyer@gmx.de
' Auf: www.dieseyer.de
'
' Die Prozedur ist Bestandteil von WinTuC_vbs.vbs (WinTuC.de)
' und formatiert die Ifirmationen für WiTuC.
'
'***********************************************************

Option Explicit ' Siehe http://dieseyer.de/dse-wsh-lernen.html#OptionExpl

MsgBox WMIWinVer( WScript.CreateObject("WScript.Network").ComputerName ), , "14 :: " & WScript.ScriptName
' MsgBox WMIWinVer( "PC04" ), , "15 :: " & WScript.ScriptName

Wscript.Quit

'*** v9.2 *** www.dieseyer.de ******************************
Function WMIDateStringToDateYear2(dtmDate) ' zweistellige Jahreszahl, ohne Sekunden
'***********************************************************
WMIDateStringToDateYear2 = CDate(Mid(dtmDate, 7, 2) & "." & Mid(dtmDate, 5, 2) & "." & Left(dtmDate, 4) & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2) )
WMIDateStringToDateYear2 = Replace( WMIDateStringToDateYear2, Year( WMIDateStringToDateYear2 ), Mid( Year( WMIDateStringToDateYear2 ), 3, 2 ) )
WMIDateStringToDateYear2 = Mid( WMIDateStringToDateYear2, 1, InStrRev( WMIDateStringToDateYear2, ":" ) - 1 )
End Function ' WMIDateStringToDateYear2(dtmDate)

'*** v9.3 *** www.dieseyer.de ******************************
Function WMIWinVer( PC )
'***********************************************************
Dim Txt

Dim objWMIService
On Error Resume Next
err.Clear
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & PC & "\root\cimv2")
Txt = err.Number & " - " & err.Description
On Error Goto 0
If Len( Txt ) > 4 Then : WMIWinVer = "Fehler: WMI-OS. " & Txt : Exit Function

Txt = ""
Dim colOSes : Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
Dim objOS
For Each objOS in colOSes
' Txt = Txt & vbCRLF & "Computer Name: " & objOS.CSName

' Txt = Txt & vbCRLF & "Caption: " & objOS.Caption 'Name
Txt = TxT & objOS.Caption

' Txt = Txt & vbCRLF & "Service Pack: " & objOS.ServicePackMajorVersion & "." & objOS.ServicePackMinorVersion
Txt = TxT & " Sp" & objOS.ServicePackMajorVersion

' Txt = Txt & vbCRLF & "Version: " & objOS.Version 'Version & build
' Txt = TxT & " (Build " & objOS.Version & ")"

Txt = TxT & "; installiert am " & WMIDateStringToDateYear2( objOS.InstallDate )

' Txt = Txt & vbCRLF & "Build Number: " & objOS.BuildNumber 'Build
' Txt = Txt & vbCRLF & "Build Type: " & objOS.BuildType
' Txt = Txt & vbCRLF & "OS Type: " & objOS.OSType
' Txt = Txt & vbCRLF & "Other Type Description: " & objOS.OtherTypeDescription
Next
' MsgBox PC & vbCRLF & vbCRLF & ">" & Txt & "<", , "62 :: "

Txt = Replace( Txt, "Edition", "" )
Txt = Replace( Txt, "(R)", "" )
Txt = Replace( Txt, "Microsoft", "" )
Txt = Replace( Txt, "Windows", "Win" )
Txt = Replace( Txt, "Professional", "Prof." )
Txt = Replace( Txt, " ", " " )
WMIWinVer = Txt

End Function ' WMIWinVer( PC )

http://dieseyer.de • all rights reserved • © 2011 v11.4