Start a Conversation

Unsolved

This post is more than 5 years old

110618

October 7th, 2013 15:00

OMCI Powershell SetBiosAttribute Implementation

Hello, I am trying to write up a powershell script that will allow me to change some Bios options.  I am using the following snippit:

(Get-WmiObject DCIM_BIOSService -namespace "root\dcim\sysman").setBIOSAttribute($null, , , , $null)

Which is yielding me:

Exception calling "SetBIOSAttribute" : "This method is not implemented in any class "

From the setBIOSAttribute.ToString() I have this list of parameters:

SetBIOSAttribute(String TargetBIOS, String AttributeName, String[] AttributeValue, AuthorizationToken, UInt32 PasswordEncoding)

My question is what int represents the ASCII password encoding?  I looked into the MOF of the method and to be honest I did not understand its explanation. 

October 7th, 2013 22:00

Hi MBALLIN,

DCIM_BIOSService doesn't SetBIOSAttribute method. It support only SetBIOSAttributes.

Powershell command to set BIOS attribute value using DCIM_BIOSService.SetBIOSAttributes is as follow,

 (Get-WmiObject -ComputerName $ComputerName -Namespace root/dcim/sysman -Class DCIM_BIOSService).SetBIOSAttributes($null, $null, , , )

Example:
$ComputerName = $env:COMPUTERNAME
(Get-WmiObject -ComputerName $ComputerName -Namespace root/dcim/sysman -Class DCIM_BIOSService).SetBIOSAttributes($null, $null,"Num Lock","2","dell")

Thanks/Prasanna

3 Posts

October 8th, 2013 09:00

Thanks for your quick reply Prasanna.

When I called SetBIOSAttributes as you mentioned I get the following error: 

Exception calling "SetBIOSAttributes" : "Invalid parameter "

How can i go about fixing this?

October 8th, 2013 11:00

Please make sure the parameters you are passing to SetBIOSAttributes are correct. 

1st and 2nd parameters are always $null. 

3rd parameter is the value of AttributeName from DCIM_BIOSEnumeration class, and 4th parameter is anyone of the value from PossibleValues property of same class and instance.  

If there is any bios password already exist on system,  provide that as 4th parameter,  otherwise you can keep it $null or leave this parameter itself. 

Thanks

3 Posts

October 8th, 2013 12:00

That is exactly how I am formatting my statement:

$BiosSettings = gwmi -namespace "root\dcim\sysman" -class DCIM_BIOSEnumeration
$BiosSettings | Sort-Object $_.AttributeName | Format-Table -autosize @{Label = "Attribute Name"; Expression={$_.AttributeName}},
@{Label = "Current Value"; Expression={$_.CurrentValue}},
@{Label = "Possible Values"; Expression={$_.PossibleValues}},
@{Label = "Description of Values"; Expression={$_.PossibleValuesDescription}}

This returns all bios settings, which I am using as inputs.  No matter which attribute I try I receive The Invalid Parameter Error. Ex:

(Get-WmiObject DCIM_BIOSService -namespace "root\dcim\sysman").SetBIOSAttributes($null,$null,"USB", "1" ,"adminPassword")

Is there anything else that could be causing this error?

38 Posts

October 9th, 2013 02:00

I tried follwoing commands and they work  -

(Get-WmiObject DCIM_BIOSService -namespace "root\dcim\sysman").SetBIOSAttributes($null,$null,"USB", "3" ,"adminPassword")

(Get-WmiObject DCIM_BIOSService -namespace "root\dcim\sysman").SetBIOSAttributes($null,$null,"Num Lock", "1" ,"adminPassword")

(Get-WmiObject DCIM_BIOSService -namespace "root\dcim\sysman").SetBIOSAttributes($null,$null,"Parallel Port", "1" ,"adminPassword")

Please note that If AttributeValue (4th arg) is not from PossibleValues array then "Invalid Parameter" error is returned.

 

Thanks

Vibha

February 2nd, 2014 20:00

@MBallin, Can you provide the system and setup configuration details so that we could investigate into the issue. It should cover importatnt information like the system model number, BIOS version, OS version. Also If you could dump the SMBIOS table and attach the same to the post would be very helpful.

No Events found!

Top