38 lines
861 B
PowerShell
38 lines
861 B
PowerShell
<#
|
|
.DESCRIPTION
|
|
Clear HP Password Bios
|
|
|
|
.NOTES
|
|
|
|
Author: Aurelien HAMEZ & Patrick Pattyn
|
|
Version: 1.0
|
|
Date: 2021-07-22
|
|
|
|
|
|
.EXAMPLE
|
|
.\Clear-HPPwd.ps1
|
|
|
|
#>
|
|
|
|
Begin {
|
|
$MDPs = "password1.bin", "password2.bin", "password3.bin", "password4.bin", "password5.bin", "password6.bin"
|
|
}
|
|
Process {
|
|
#On configure le mot de passe si vide
|
|
$process = Start-Process -FilePath "$PSScriptRoot\BiosConfigUtility64.exe" -ArgumentList "`"/nspwdfile:`"", "/log" -Wait -PassThru
|
|
|
|
#Si le mot de passe est configuré, le code erreur 10 est retourné, on test différent mot de passe
|
|
if($process.ExitCode -eq 10)
|
|
{
|
|
Foreach($MDP in $MDPs)
|
|
{
|
|
$process = Start-Process -FilePath "$PSScriptRootBiosConfigUtility64.exe" -ArgumentList "`"/nspwdfile:`"", "`"/cpwdfile:$MDP`"", "/log" -wait -PassThru
|
|
if($process.ExitCode -ne 10)
|
|
{
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
End {
|
|
} |