Hello all,

I'm new to VBS, however need to figure out a way to create a logoff script,
that can check the OS version of the machine, then based on that condition,
import a .REG file.

For example, I only work with 2000 and XP workstations. If the machine is a
2000 machine, I want lines A of code to execute, however if the machine is a
XP machine, I want lines B of code to execute. Then perhalps in the lines B
of code, I can put another check for whether it is a SP1 or SP2 machine, then
have different code execute based on that....

Can anyone help me get started on this?

Thanks

Re: import a .REG file based on Operating system condition. by DiGiTAL

DiGiTAL
Wed Sep 14 13:34:39 CDT 2005

As far as detecting the OS, I have not found any way that is as reliable
as the old-fashioned 'ver'to detect exactly which OS you are running the
script on. WMI would work, but if the WMI is shutting down or there is
another problem with it, your script will bomb.

Option Explicit
Dim oShell, oShellExec, oExecStdOut, sText, iXP
Set oShell=CreateObject("Wscript.Shell")
iXP = 0
Set oShellExec = oShell.Exec("%comspec% /c ver")
Set oExecStdOut = oShellExec.StdOut
Do While Not oExecStdOut.AtEndOfStream
sText = oExecStdOut.ReadLine
If InStr(sText, "Microsoft Windows XP") Then iXP = 1
Loop
Select Case iXP
Case 0
WScript.Echo "This Windows 2000"
Case 1
WScript.Echo "This is Windows XP"
End Select


---
Life is all about ass; you're either covering it, laughing it off,
kicking it, kissing it, busting it, trying to get a piece of it,
behaving like one, or living with one!

*** Sent via Developersdex http://www.developersdex.com ***