Information please on SYSINFO 
Author Message
 Information please on SYSINFO

I've come across the code snippet below as a method of determining the OS
and version.

SYSINFO is not a valid object on my system.  What is required to get it
working?  Thank you.

    Set WSHShell = WScript.CreateObject("WScript.Shell")
    set objSysInfo = Wscript.CreateObject("SYSINFO.Sysinfo")
    wscript.echo objSysInfo.OSBuild
    wscript.echo objSysInfo.OSPlatform
    wscript.echo objSysInfo.OSVersion



Tue, 15 Apr 2003 02:23:49 GMT  
 Information please on SYSINFO
Branimir posted this file here a while back. Wouldn't be that hard to add WinMe.

'==========================================================================
' NAME:   OSinfo-CLS.vbs
'
' AUTHOR:  Branimir Petrovic , CPAS Systems Inc.
' DATE  :  3/13/2000
'
' COMMENT:  Class designed to returns OS type
'    and Windows Desktop Update  status
'
' METHODS:  
' objOS.GetOS  returns one of these strings
'      "Win95A", "Win95B", "Win98", "Win98SE"
'      "WinNT4-Wrkstat", "WinNT4-Srvr", "WinNT4-Srvr-DC"
'      "Win2K"
' objOS.GetWDU  returns TRUE if Winows Desktop Update is installed
'
'
' EXAMPLE:
' Dim objOS
' Set objOS = new OSinfo
' MsgBox  "OS = " & objOS.GetOS & vbCrLf & "Windows Desktop Update = " & objOS.GetWDU
'==========================================================================
Option Explicit

' *************************************************************************
Class OSinfo
 Private oFSO, oShell

 ' =====
 Private Sub Class_Initialize
  Set oFSO = CreateObject("Scripting.FileSystemObject")
  Set oShell = CreateObject("Wscript.Shell")
 End Sub
 ' =====
 Private Sub Class_Terminate
  Set oFSO = Nothing
  Set oFSO = Nothing
 End Sub
 ' =====
 Public Function GetOS()
 'Description: Determine OS by reading reg val & comparing to known values
  Dim sModule
  sModule = "GetOS"

  Dim sOStype, sOSversion

  On Error Resume Next
  sOStype = oShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType")
  If Err.Number<>0 Then     ' Hex(Err.Number)="80070002" - Could not find this key, OS must be Win9x
   Err.Clear
   sOStype = oShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\VersionNumber")
   If Err.Number<>0 Then
    GetOS = "Unknown Win9x"   ' Could not pinpoint exact Win9x type
    Exit Function  ' >>>
   End If
  End If

  If sOStype = "LanmanNT" OR sOStype = "ServerNT" OR sOStype = "WinNT" Then
   Err.Clear
   sOSversion = oShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
   If Err.Number<>0 Then
    GetOS = "Unknown NTx"   ' Could not determine NT version
    Exit Function  ' >>>
   End If
  End If

  If sOSversion = "4.0" Then
   Select Case sOStype
    Case "LanmanNT"
     sOStype = "WinNT4-Srvr-DC" ' From HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType
    Case "ServerNT"
     sOStype = "WinNT4-Srvr"  ' From HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType
    Case "WinNT"
     sOStype = "WinNT4-Wrkstat" ' From HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType
   End Select
  ElseIf sOSversion = "5.0" Then
   sOStype = "Win2K"
  Else
   Select Case sOStype
    Case "4.00.950"
     sOStype = "Win95A"
    Case "4.00.1111"
     sOStype = "Win95B"
    Case "4.03.1214"
     sOStype = "Win95B"
    Case "4.10.1998"
     sOStype = "Win98"
    Case "4.10.2222"
     sOStype = "Win98SE"
    Case Else
     MsgBox "sOStype = " & sOStype & vbCrLf &  "Could not recognize this particular OS.  Please contact your system administrator.", vbCritical, "Error in module: " & sModule
   End Select
  End If
  GetOS = sOStype
 End Function

 ' =====
 Public Function GetWDU()
  Dim oSysFldr, sSysPath, sFileVer, arVerNums

  Const csSystemFolder = 1
  Const csShell = "shell32.dll"

  Set oSysFldr = oFSO.GetSpecialFolder (csSystemFolder)
  sSysPath = oSysFldr.Path
  sFileVer = oFSO.GetFileVersion(oFSO.BuildPath (sSysPath,csShell))
  arVerNums = Split(sFileVer,".")

  If Eval(CInt(arVerNums(0)) = 4) AND Eval(CInt(arVerNums(1)) => 71) Then
   GetWDU = TRUE
  ElseIf Eval(CInt(arVerNums(0)) > 4) Then
   GetWDU = TRUE
  Else  
   GetWDU = FALSE
  End If

  'MsgBox sFileVer
  Set oSysFldr = Nothing
 End Function

End Class
' *************************************************************************

--
Mark L. Ferguson    Reply Only in Newsgroup
marfer's notes for OE 5.0 > http://www.geocities.com/marfer_mvp/IE_ng_notes.htm

Quote:

> I've come across the code snippet below as a method of determining the OS
> and version.

> SYSINFO is not a valid object on my system.  What is required to get it
> working?  Thank you.

>     Set WSHShell = WScript.CreateObject("WScript.Shell")
>     set objSysInfo = Wscript.CreateObject("SYSINFO.Sysinfo")
>     wscript.echo objSysInfo.OSBuild
>     wscript.echo objSysInfo.OSPlatform
>     wscript.echo objSysInfo.OSVersion



Tue, 15 Apr 2003 05:35:17 GMT  
 Information please on SYSINFO
hi John,

If you are courageous enough (or foolhardy enough) to use a third party
control, then the "wsh Operating System Information Utility" (ocx) found on
the following website will get that info for you.

    http://home.att.net/~wshvbs/index.htm

cheers, jw


Quote:
> I've come across the code snippet below as a method of determining the OS
> and version.

> SYSINFO is not a valid object on my system.  What is required to get it
> working?  Thank you.

>     Set WSHShell = WScript.CreateObject("WScript.Shell")
>     set objSysInfo = Wscript.CreateObject("SYSINFO.Sysinfo")
>     wscript.echo objSysInfo.OSBuild
>     wscript.echo objSysInfo.OSPlatform
>     wscript.echo objSysInfo.OSVersion



Wed, 16 Apr 2003 02:08:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Information please on SYSINFO

2. Getting SysInfo that is not in Sysinfo Control

3. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

4. Status/Error information PLEASE HELP

5. I need two information out of vbs please

6. SysInfo

7. SysInfo Script

8. Create a Sysinfo Object

9. SysInfo

10. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

11. Thanks so much, Please read for more information.

12. Sysinfo in a web form

 

 
Powered by phpBB® Forum Software