Ajout dela structure MDT dans Infra-LAB
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Set HP Password Bios
|
||||
|
||||
.NOTES
|
||||
|
||||
Author: Aurelien HAMEZ & Patrick Pattyn
|
||||
Version: 1.0
|
||||
Date: 2021-07-22
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
.\Set-HPPwd.ps1
|
||||
|
||||
#>
|
||||
|
||||
Param(
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$New_PasswordFile = "new_password.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile1 = "password1.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile2 = "password2.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile3 = "password3.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile4 = "password4.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile5 = "password5.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile6 = "password6.bin",
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$PasswordFile7 = "password7.bin"
|
||||
)
|
||||
|
||||
Begin {
|
||||
#On initialise les différents mots de passe
|
||||
$MDPs = $PasswordFile1, $PasswordFile2, $PasswordFile3, $PasswordFile4, $PasswordFile5, $PasswordFile6, $PasswordFile7
|
||||
}
|
||||
Process {
|
||||
#On configure le mot de passe si vide
|
||||
$process = Start-Process -FilePath "$PSScriptRoot\BiosConfigUtility64.exe" -ArgumentList "`"/nspwdfile:$PSScriptRoot\$New_PasswordFile`"", "/log" -Wait -PassThru
|
||||
|
||||
#Si le mot de passe est configuré, le code erreur 10 est retourné, on test différent mot de passe, lorsqu'il est modifié, l'ExitCode 0 = Success est retourné. On sort.
|
||||
if($process.ExitCode -eq 10)
|
||||
{
|
||||
Foreach($MDP in $MDPs)
|
||||
{
|
||||
$process = Start-Process -FilePath "$PSScriptRoot\BiosConfigUtility64.exe" -ArgumentList "`"/nspwdfile:$PSScriptRoot\$New_PasswordFile`"", "`"/cpwdfile:$PSScriptRoot\$MDP`"", "/log" -wait -PassThru
|
||||
if($process.ExitCode -eq 0)
|
||||
{
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
End {
|
||||
}
|
||||
Reference in New Issue
Block a user