Start a Conversation

Unsolved

This post is more than 5 years old

111936

April 20th, 2012 11:00

OMCI 8 VBS Sample Scripts Error\don't work

Hi,

None of the OMCI sample scripts seem to work.  Consistently I get Invalid parameter - swbemobjectex error for the line:

Set returnValue = objInstance.ExecMethod_("SetBIOSAttributes", oInParams)

WMI is know to be working on the machine as other WMI scripts work.

I tried uninstalling\reinstalling OMCI 8 on several machines.

I tried install OMCI 7.6 and 8 togher.

I tried removing the authorization part of the script as I have no BIOS passwords.

I see other people have posted this issue on the forums with no resolution.  Can someone assist ? 

Which class has "Chassis Intrustion Status" reported ?  It's not in the documentation , only for OMCI legacy versions.

Here is the script that generates the invalid parameter error.

'**********************************************************************
'*** Name: SampleChassisIntrusionClear.vbs
'*** Purpose: To clear the chassis intrusion status on a Dell OMCI client.
'*** Usage: cscript.exe //nologo SampleChassisIntrusionClear.vbs
'***
'*** This sample script is provided as an example only, and has not been
'*** tested, nor is warranted in any way by Dell; Dell disclaims any
'*** liability in connection therewith. Dell provides no technical
'*** support with regard to such scripting. For more information on WMI
'*** scripting, refer to applicable Microsoft documentation.

'*** NOTE: Replace in line 57 (inside the quotes)
'*** with the desired values if there is any password set in the system.
'*** If both passwords(Admin and Boot) are set please replace it with Admin Password.
'*** If there is no password set in the system please leave it as empty.
'**********************************************************************

Option Explicit

'*** Declare variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strKeyValue
Dim objInstance
Dim strPropName
Dim strPropValue
Dim oInParams
Dim objWMIService
Dim returnValue
Dim ColSystem
Dim strAttributeName(2)
Dim strAttributeValue(2)
'Dim strAuthorizationToken

'*** 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
End If

'*** Initialize variables
strNameSpace = "root/dcim/sysman"
strComputerName = WScript.Arguments(0)
strClassName = "DCIM_BIOSService"
strAttributeName(0) = "Chassis Intrusion Status"

'*** All possible values for Chassis Intrusion Status are as follows:
'*** 1 = Tripped (Read-only)
'*** 2 = Door open (Read-only)
'*** 3 = Door closed (Read-only)
'*** 4 = Trip reset (Write-only)

strAttributeValue(0) = "4"
'strAuthorizationToken = " "

returnValue = 0
'*** Retrieve the instance of DCIM_BIOSService class
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate," &_
"AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" &_
strNameSpace)
Set ColSystem=objWMIService.execquery ("Select * from " & strClassName)

For each objInstance in ColSystem
Set oInParams= objInstance.Methods_("SetBIOSAttributes").InParameters.SpawnInstance_
oInParams.AttributeName = strAttributeName
oInParams.AttributeValue = strAttributeValue
'oInParams.AuthorizationToken = strAuthorizationToken
Set returnValue = objInstance.ExecMethod_("SetBIOSAttributes", oInParams)
Next

'*** If any errors occurred, let the user know
If Err.Number <> 0 Then
WScript.Echo "Clear chassis intrusion failed."
End If

'*** Sub used to display the correct usage of the script
Sub Usage()
Dim strMessage
strMessage = "incorrect syntax. You should run: " & vbCRLF & _
"cscript.exe /nologo SampleChassisIntrusionClear.vbs "
WScript.Echo strMessage
End Sub

-thanks

1 Message

May 17th, 2013 15:00

The answer is..... If you have a machine that does not have a password set and you want to set the

password using objInstance.ExecMethod_ "SetBIOSAttributes", oInParams pass it any string as the

current password, anything except nothing. If you pass it "" it will error but if you pass it any random

string it will not error and set the password to the value you passed for AttributeValue. Also the method

does not return anything, at least from what I can tell, so do not call it as a function.

Example code:

           strNameSpace = "root/dcim/sysman"
           strComputerName = "."
           strClassName = "DCIM_BIOSService"
           strKeyValueChassis = "DCIM_Chassis"
           strAttributeName(0) = "AdminPwd"
           strAttributeValue(0) =
           strAuthorizationToken =

           err.clear
           Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" & strNameSpace)
           if err = 0 then
              Set ColSystem=objWMIService.execquery ("Select * from " & strClassName)
              err.clear
              For each objInstance in ColSystem
                 Set oInParams= objInstance.Methods_("SetBIOSAttributes").InParameters.SpawnInstance_
                 oInParams.AttributeName = strAttributeName
                 oInParams.AttributeValue = strAttributeValue
                 oInParams.AuthorizationToken = strAuthorizationToken
                 objInstance.ExecMethod_ "SetBIOSAttributes", oInParams
              Next

6 Posts

August 5th, 2013 05:00

You can also use this powershell script to set Wake on lan token.

Thanks,

Arti

September 27th, 2013 09:00

Looks like the Support for the feature itself is missing in BIOS. Do you see the feature in F2 screen? Also I did suggest you to check the specs of the system to understand if this feature is supported in this system.

No Events found!

Top