PowerShell Script to Change Dell Bios Password

Most of our systems are Dell and I wanted to find a way to automate the change of the bios password. This helps in imaging new systems and to standardize the different bios passwords. What I came up with was to install OMCI v8 and use PowerShell 2.0 to change the bios password.
Requirements: Dell System, OMCI v8 or above, PowerShell 2.0

#*** Requirements
#*** Dell System, OMCI v8 or above, PowerShell 2.0

#*** BIOS Admin Password Change
#*** Created By MaddMatt99 http://sccm.davestechnologynetwork.com/
#*** This powershell code attempts to set the BIOS Admin Password by attempting several known password in the work envirenment

#*** Declare variables

$NameSpacePwdSet = $null
$ClassNamePwdSet = $null
$AttributePwd = $null
$AttributeValue = $null
$tokenpass = $null
#*** Initialize variables
$NameSpacePwdSet = "root\dcim\sysman"
$ClassNamePwdSet = "DCIM_BIOSService"
$AttributePwd = "AdminPwd"
$AttributeValue = "newpassword"
$tokenpass = @("oldpassword1","oldpassword2","oldpassword3","oldpassword4","oldpassword5", "oldpassword6")
#***Attempts to set the BIOS password when there is no password set
Try
{
$test = (gwmi $ClassNamePwdSet -namespace $NameSpacePwdSet).SetBIOSAttributes($null,$null,"$AttributePwd","$AttributeValue")
}
Catch
{}
#***Attempts to set the BIOS password when with the rest of the potential passwords
foreach ($element in $tokenpass)
{
Try
{
$test = (gwmi $ClassNamePwdSet -namespace $NameSpacePwdSet).SetBIOSAttributes($null,$null,"$AttributePwd","$AttributeValue","$element")
}
Catch
{}
}

One Response to PowerShell Script to Change Dell Bios Password

To comment, click below to log in.

Leave a Reply