Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions HP/Manage-HPBiosSettings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Function Set-HPBiosSetting
$Count = 0
while($Count -lt $CurrentSettingSplit.Count)
{
if($CurrentSettingSplit[$Count].StartsWith('*'))
if($CurrentSettingSplit[$Count].TrimStart().StartsWith('*'))
{
$CurrentValue = $CurrentSettingSplit[$Count]
break
Expand Down Expand Up @@ -428,9 +428,9 @@ if($GetSettings)
$SplitCount = 0
while($SplitCount -lt $SettingSplit.Count)
{
if($SettingSplit[$SplitCount].StartsWith('*'))
if($SettingSplit[$SplitCount].TrimStart().StartsWith('*'))
{
$SetValue = ($SettingSplit[$SplitCount]).Substring(1)
$SetValue = ($SettingSplit[$SplitCount].TrimStart()).Substring(1)
break
}
else
Expand Down
11 changes: 9 additions & 2 deletions Lenovo/Manage-LenovoBiosSettings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ switch($PasswordSettings.PasswordState)
#Ensure passwords are set correctly
if($SetSettings -or $SetDefaults)
{
#get settings from the machine
$SettingList = $SettingList | Select-Object CurrentSetting | where {$_.CurrentSetting -and ($_.CurrentSetting -NotLike "*ShowOnly*")} | Sort-Object CurrentSetting

if($SvpSet)
{
Write-LogEntry -Value "Ensure the supplied supervisor password is correct" -Severity 1
Expand All @@ -476,8 +479,10 @@ if($SetSettings -or $SetDefaults)
{
Stop-Script -ErrorMessage "The supervisor password is set, but no password was supplied. Use the SupervisorPassword parameter when a password is set"
}
#create test string for the password call
$testValue = $SettingList[-1].CurrentSetting + "," + $SupervisorPassword + ",ascii,us"
#Supervisor password set correctly
if($PasswordSet.SetBiosPassword("pap,$SupervisorPassword,$SupervisorPassword,ascii,us").Return -eq "Success")
if(($Interface.SetBiosSetting($testValue)).Return -eq "Success")
{
Write-LogEntry -Value "The specified supervisor password matches the currently set password" -Severity 1
}
Expand All @@ -495,8 +500,10 @@ if($SetSettings -or $SetDefaults)
{
Stop-Script -ErrorMessage "The system management password is set, but no password was supplied. Use the SystemManagementPassword parameter when a password is set"
}
#create test string for the password call
$testValue = $SettingList[-1].CurrentSetting + "," + $SystemManagementPassword + ",ascii,us"
#System management password set correctly
if($PasswordSet.SetBiosPassword("smp,$SystemManagementPassword,$SystemManagementPassword,ascii,us").Return -eq "Success")
if(($Interface.SetBiosSetting($testValue)).Return -eq "Success")
{
Write-LogEntry -Value "The specified system management password matches the currently set password" -Severity 1
}
Expand Down