Decrypts a string using the Data Protection API (DPAPI).
Unprotect-String [-ProtectedString] <String> [<CommonParameters>]
Decrypts a string with the Data Protection API (DPAPI). The string must have also been encrypted with the DPAPI and the same scope used to decrypt as was used to encrypt.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
ProtectedString | String | The text to encrypt. | true | true (ByValue) |
$encryptedPassword = Protect-String -String 'MySuperSecretPassword' -ForUser
PS> $password = Unprotect-String -ProtectedString $encryptedPassword
Decrypts a protected string which was encrypted at the current user or default scopes.
$encryptedPassword = Protect-String -String 'MySuperSecretPassword' -ForComputer
PS> $cipherText = Unprotect-String -ProtectedString $encryptedPassword
Encrypts the given string and stores the value in $cipherText. Because the string was encrypted at the LocalMachine scope, the string must be decrypted at the same scope.
Protect-String -String 'NotSoSecretSecret' -ForUser | Unprotect-String
Demonstrates how Unprotect-String takes input from the pipeline. Adds 'NotSoSecretSecret' to the pipeline.