Write-DellBIOSPassword.ps1
Function Write-DellBIOSPassword { <# .Synopsis Writes a Dell BIOS password from secure string storage .Description Writes a DellBIOS password to System.Security.SecureString in the local app directory of the user. .Example Write-DellBIOSPassword .Example $DellBIOSCredential = Write-DellBIOSPassword .Example $SecureStringPwd = Read-Host -AsSecureString Write-DellBIOSPassword –Password $SecureStringPwd .Example Write-DellBIOSPassword [[-FilePath] <String>] [[-Key] <String>] [[-Hint] <String>] [-Password] <SecureString> [<CommonParameters>] #> [CmdletBinding()] Param ( [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true, position=0, HelpMessage="Path to Password File")] [string] $FilePath, [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$false, position=1, HelpMessage="An ASCII Key of 128,196 of 256 Length")] [byte []] $Key, [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$false, position=2, HelpMessage="Password Hint")] [string] $Hint, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$false, position=5, HelpMessage="DellBIOS Password")] [System.Security.SecureString] $Password ) PROCESS { if ([string]::IsNullOrEmpty($FilePath)) { $FilePath = (Get-DellBIOSPasswordPath).DellBIOSPwdFilePath } if ( (test-path $FilePath) -eq $false) { $fileItem = new-item -path $FilePath -itemtype file -force } [Xml]$xml="<Credential><Password></Password><Encryption>DAPI</Encryption></Credential>" if ([string]::IsNullOrEmpty($Key)) { $xml.Credential.Password= (ConvertFrom-SecureString -SecureString $Password).ToString() $xml.Credential.Encryption="DPAPI" Set-Content $FilePath $xml.OuterXml } else { $xml.Credential.Password= (ConvertFrom-SecureString -SecureString $Password -Key $Key).ToString() $xml.Credential.Encryption="Rijndael" Set-Content $FilePath $xml.OuterXml } }#EndProcess }#end Function # SIG # Begin signature block # MIIbEwYJKoZIhvcNAQcCoIIbBDCCGwACAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0B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