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

'v3.6***************************************************
' File: WinVerSP.VBS
' Autor: dieseyer@gmx.de
' dieseyer.de
'
' Programm ermittelt WindowsNT-Version und Sp-Version
'*******************************************************

Option Explicit

Dim WSHShell, FSO, WSHNet
Dim ObjRemote, RootKey, ObjReg, oVal
Dim Text, Text1, Text2, TextX, KeyX, Server

Set WSHShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSHNet = WScript.CreateObject("WScript.Network")

If (fso.FileExists("REGOBJ.DLL")) Then ' Regobj.dll registrieren (erfordert AdminRechte)
TextX = "REGSVR32.EXE " & "REGOBJ.DLL" & " /S" ' damit lt sich besser auf die registry zugreifen
WshShell.Run (TextX),,TRUE ' mu im gleichen Verzeichnis wie das Script stehen
Set ObjReg = WScript.CreateObject("RegObj.Registry")

Else
MsgBox "REGSVR32.EXE " & "REGOBJ.DLL" & " /S" & vbTab & " konnte nicht aufgerufen werden!", , WScript.ScriptName
WScript.Quit
End If

Text1 = "Von welchem Computer soll das Betriebssystem ermittelt werden?"
Server = wshnet.ComputerName
Server = InputBox (Text1, WScript.ScriptName, Server)
If Server = "" then Server = InputBox (Text1, WScript.ScriptName)
If Server = "" then MsgBox " . . . denn eben nicht!", 64, WScript.ScriptName
If Server = "" then WScript.Quit
Server = UCase(Server)


Set ObjRemote = objReg.RemoteRegistry( Server ) ' Objekt auf (Remote-) PC zeigen (REGOBJ.DLL)

KeyX = "\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion"

Text1 = ""
Text2 = ""
On Error Resume Next
Set RootKey = objRemote.RegKeyFromString(KeyX)
For Each oVal In RootKey.Values ' Auflistung Werte
if oVal.Name = "ProductName" then Text1 = oVal.Value
if oVal.Name = "CurrentVersion" then Text1 = "Windows NT " & oVal.Value
if oVal.Name = "CSDVersion" then Text2 = oVal.Value
Next
On Error GoTo 0

Text = "Der Computer " & vbTab & UCase(Server) & vbCRLF
Text = Text & "verwendet als Betriebssystem:" & vbCRLF & vbCRLF
Text = Text & Text1 & " " & Text2 & " " & vbCRLF

MsgBox Text, , WScript.ScriptName

Set ObjReg = nothing
WshShell.Run ("REGSVR32.EXE " & "REGOBJ.DLL" & " /U /S"),,TRUE ' REGOBJ.DLL - Registrierung aufheben

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