'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' File: DellResetChassisIntrusion.vbs
' Updated: Feb 22, 2006
' Version: 1.0
' Author: Dan Thomson, myITforum.com columnist
' I can be contacted at dethomson@hotmail.com
'
' Purpose: To clear the chassis intrusion alert on a Dell OMCI client.
'
' Usage: cscript.exe DellResetChassisIntrusion.vbs
'
' Input: systemname = Name of system to reset
'
' Requirements:
' - Dell Open Manage Client (see below for tested version)
' - Windows Script
' http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
' - WMI version 1.5
'
' Notes:
' Tests performed using:
' Windows XP Professional SP2
' Windows Script v5.6
' Dell Open Manage Client version 6.1.1.259 or greater
' Precision 530MT ( success )
' Optiplex GX260 & GX280 ( success )
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
On Error Resume Next
'*** Declare variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strKeyValue
Dim objInstance
Dim strPropName
Dim strPropValue
'*** Check that the right executable was used to run the script
'*** and that all parameters were passed
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count < 1) Then
Call Usage()
WScript.Quit(-1)
End If
'*** Initialize variables
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_SMBIOSSettings"
strKeyValue = "0"
strPropName = "ChassisIntrusionStatus"
'*** Retrieve the instance of Dell_SMBIOSSettings class
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" & _
strComputerName & "/" & strNameSpace & ":" & strClassName & "=" & _
Chr(34) & strKeyValue & Chr(34))
strPropValue = objInstance.Properties_.Item(strPropName).Value
'*** Clear the value of ChassisIntrusionStatus only if it = 3
' A value of 3 = "Detected"
' Setting this value to 5 (Clear) will cause the ChassisIntrusionStatus
' property to really be reset to 4 (Not Detected).
If strPropValue = 3 then
'*** Set the new value for the property and save the instance
objInstance.Properties_.Item(strPropName).Value = 5
objInstance.Put_
'*** If any errors occurred, let the user know
If Err.Number <> 0 Then
WScript.Echo "Clearing the chassis intrusion alert failed."
End If
End If
Set objInstance = Nothing
WScript.Quit(Err.Number)
'*** Sub used to display the correct usage of the script
Sub Usage()
Dim strMessage
strMessage = "incorrect syntax. You should run: " & vbCRLF & _
"cscript.exe //nologo DellResetChassisIntrusion.vbs "
WScript.Echo strMessage
End Sub