Skip to content
Open
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
13 changes: 12 additions & 1 deletion Dell/Manage-DellBiosPasswords.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
.PARAMETER OldAdminPassword
Specify the old admin password(s) to be changed. Multiple passwords can be specified as a comma seperated list.

.PARAMETER OldAdminPasswordsAsString
Specify the old admin password(s) to be changed. Multiple passwords can be specified as a comma seperated list in a single string. This is required when executing from command line.

.PARAMETER SystemPassword
Specify the new system password to set.

Expand Down Expand Up @@ -56,6 +59,7 @@
.CHANGELOG
01/30/2020 - Removed the AdminChange and SystemChange parameters. AdminSet and SystemSet now work to set or change a password. Changed the DellChangeAdmin task sequence variable to DellSetAdmin.
Changed the DellChangeSystem task sequence variable to DellSetSystem. Updated the parameter validation checks.
10/06/2020 - Added possibility to pass old passwords in a single string (OldAdminPasswordsAsString) because in TS it's not possible to pass an Array value.
#>

#Parameters ===================================================================================================================
Expand All @@ -67,6 +71,7 @@ param(
[Parameter(Mandatory=$false)][Switch]$SystemClear,
[Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][String]$AdminPassword,
[Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][String[]]$OldAdminPassword,
[Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][String]$OldAdminPasswordsAsString,
[Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][String]$SystemPassword,
[Parameter(Mandatory=$false)][ValidateNotNullOrEmpty()][String[]]$OldSystemPassword,
[Parameter(Mandatory=$false)][Switch]$NoUserPrompt,
Expand Down Expand Up @@ -291,6 +296,12 @@ else
#Parameter validation
Write-LogEntry -Value "Begin parameter validation" -Severity 1

if(-not [String]::IsNullOrWhiteSpace($OldAdminPasswordsAsString)){
$OldAdminPassword = $OldAdminPasswordsAsString.Split(",")
Write-LogEntry -Value "OldAdminPasswordsAsString split to OldAdminPassword" -Severity 1
}


if (($AdminSet) -and !($AdminPassword))
{
$ErrorMsg = "When using the AdminSet switch, the AdminPassword parameter must also be specified"
Expand Down Expand Up @@ -494,7 +505,7 @@ if ($AdminPasswordCheck -eq "True")
{
$TSEnv.Value("DellSetAdmin") = "Failed"
}

Write-LogEntry -Value "Passed $($OldAdminPassword.Count) old Passwords" -Severity 1
try
{
Set-Item -Path DellSmbios:\Security\AdminPassword $AdminPassword -Password $AdminPassword -ErrorAction Stop
Expand Down