Microsoft Operations Manager |
For new scripts, use the following methods and properties of the Win32_ComputerSystemWMI class to achieve equivalent results.
Deprecated members | Equivalents |
---|---|
SystemManager.Domain | Domainproperty of the Win32_ComputerSystemWMI class |
SystemManager.OS | Captionproperty of the Win32_ComputerSystemWMI class |
SystemManager.OSBuildNumber | BuildNumberproperty of the Win32_ComputerSystemWMI class |
SystemManager.OSMajorVersion | Versionproperty of the Win32_ComputerSystemWMI class |
SystemManager.OSMinorVersion | Versionproperty of the Win32_ComputerSystemWMI class |
[VBScript]
'*********************************************************************
' Routine: Function Domain
' Purpose: A replacement for the SystemManager.Domain property
'**********************************************************************
Function Domain()
Dim objComputerSystem
Dim objNet
Dim strDomain
Dim strComputer
Set objNet = CreateObject("Wscript.Network")
strComputer = objNet.ComputerName
Set objNet = Nothing
Set objComputerSystem =
GetObject("WinMgmts:Win32_ComputerSystem.Name=""" & strComputer
& """")
If Not(objComputerSystem Is Nothing) Then
strDomain = objComputerSystem.Domain
End If
Set objComputerSystem = Nothing
Set objNet = Nothing
Domain = strDomain
End Function
[VBScript]
'*********************************************************************
' Routine: Function OS
' Purpose: A replacement for the SystemManager.OS property
'**********************************************************************
Function OS()
Dim objOperatingSystem
Dim strCaption
Dim strObjectName
' Note: the partition information in the Name property will
likely
' differ from computer to computer.
strObjectName = "Microsoft Windows 2000
Server|C:\\WINNT|\\Device\\Harddisk0\\Partition2"
Set objOperatingSystem =
GetObject("WinMgmts:Win32_OperatingSystem.Name=""" &
strObjectName & """")
If Not(objOperatingSystem Is Nothing) Then
strCaption = objOperatingSystem.Caption
End If
Set objOperatingSystem = Nothing
OS = strCaption
End Function
[VBScript]
'*********************************************************************
' Routine: Function OSBuildNumber
' Purpose: A replacement for the SystemManager.OSBuildNumber
property
'**********************************************************************
Function OSBuildNumber()
Dim objOperatingSystem
Dim strBuildNumber
Dim strObjectName
strObjectName = "Microsoft Windows 2000
Server|C:\\WINNT|\\Device\\Harddisk0\\Partition2"
Set objOperatingSystem =
GetObject("WinMgmts:Win32_OperatingSystem.Name=""" &
strObjectName & """")
If Not(objOperatingSystem Is Nothing) Then
strBuildNumber = objOperatingSystem.BuildNumber
End If
Set objOperatingSystem = Nothing
OSBuildNumber = strBuildNumber
End Function
[VBScript]
'*********************************************************************
' Routine: Function OSMajorVersion
' Purpose: A replacement for the SystemManager.OSMajorVersion
property
'**********************************************************************
Function OSMajorVersion()
Dim objOperatingSystem
Dim strFullVersion
Dim strMajorVersion
Dim strObjectName
Dim lngFirstSeparatorPos
strObjectName = "Microsoft Windows 2000
Server|C:\\WINNT|\\Device\\Harddisk0\\Partition2"
Set objOperatingSystem =
GetObject("WinMgmts:Win32_OperatingSystem.Name=""" &
strObjectName & """")
If Not(objOperatingSystem Is Nothing) Then
strFullVersion = objOperatingSystem.Version
lngFirstSeparatorPos = InStr(strFullVersion, ".")
strMajorVersion = Left(strFullVersion, lngFirstSeparatorPos
- 1)
End If
Set objOperatingSystem = Nothing
OSMajorVersion = strMajorVersion
End Function
[VBScript]
'*********************************************************************
' Routine: Function OSMinorVersion
' Purpose: A replacement for the SystemManager.OSMinorVersion
property
'**********************************************************************
Function OSMinorVersion()
Dim objOperatingSystem
Dim strFullVersion
Dim strMinorVersion
Dim strObjectName
Dim lngFirstSeparatorPos
strObjectName = "Microsoft Windows 2000
Server|C:\\WINNT|\\Device\\Harddisk0\\Partition2"
Set objOperatingSystem =
GetObject("WinMgmts:Win32_OperatingSystem.Name=""" &
strObjectName & """")
If Not(objOperatingSystem Is Nothing) Then
strFullVersion = objOperatingSystem.Version
lngFirstSeparatorPos = InStr(strFullVersion, ".")
strMinorVersion = Mid(strFullVersion, lngFirstSeparatorPos
+ 1, 1)
End If
Set objOperatingSystem = Nothing
OSMinorVersion = strMinorVersion
End Function
For more information about the Win32_ComputerSystemWMI class, see the Windows Management Instrumentation SDK.
Did you find this information useful? Please send your suggestions and comments about the documentation to momsdk@microsoft.com.