Read-DellBIOSPassword.ps1
Function Read-DellBIOSPassword { <# .Synopsis Reads a Dell BIOS Password from secure string storage .Description Reads a Dell BIOS Password from secure string storage. .Notes Reads System.Security.SecureString from the default user path. .Example Read-DellBIOSPassword .Example Read-DellBIOSPassword [[-FilePath] <String>] [[-Key] <String>] [<CommonParameters>] .Example $SecureStringPwd = read-DellBIOSPassword #> [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="Encryption Key")] [byte []] $Key ) PROCESS { if ([string]::IsNullOrEmpty($FilePath)) { $FilePath = (Get-DellBIOSPasswordPath).DellBIOSPwdFilePath } [xml]$xml=Get-Content $FilePath if ($xml.Credential.Encryption -eq "PlainText") { $password=ConvertTo-SecureString -AsPlainText -String $xml.Credential.Password -Force } elseif ($xml.Credential.Encryption -eq "DPAPI") { $password=ConvertTo-SecureString -String $xml.Credential.Password } elseif ($xml.Credential.Encryption -eq "Rijndael") { # [byte[]]$KeyBytes = [System.Text.Encoding]::ASCII.GetBytes($Key) # $password=ConvertTo-SecureString -Key $KeyBytes -String $xml.Credential.Password $password=ConvertTo-SecureString -Key $Key -String $xml.Credential.Password } $password }#EndProcess }#end Function # SIG # Begin signature block # MIIZCAYJKoZIhvcNAQcCoIIY+TCCGPUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUKNOX5a2QPxwhUzvh7dtST2q5 # U7+gghQAMIID7jCCA1egAwIBAgIQfpPr+3zGTlnqS5p31Ab8OzANBgkqhkiG9w0B # AQUFADCBizELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2Fw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