CmdID / PowerShell / Cmdlets / Get
Get-CmsMessage
Gets content that has been encrypted by using the Cryptographic Message Syntax format. PowerShell reference
From the PowerShell reference 3 parameters
What it does
Gets content that has been encrypted by using the Cryptographic Message Syntax format. The Get-CmsMessage cmdlet gets content that has been encrypted using the Cryptographic Message Syntax (CMS) format. The CMS cmdlets support encryption and decryption of content using the IETF format for cryptographically protecting messages, as documented by RFC5652. The CMS encryption standard uses public key cryptography, where the keys used to encrypt content (the public key) and the keys used to decrypt content (the private key) are separate. Your public key can be shared widely, and is not sensitive data. If any content is encrypted with this public key, only your private key can decrypt it. For more information, see Public-key cryptography. Get-CmsMessage gets content that has been encrypted in CMS format. It does not decrypt or unprotect content. You can run this cmdlet to get content that you have encrypted by running the Protect-CmsMessage cmdlet. You can specify content that you want to decrypt as a string, or by path to the encrypted content. You can pipe the results of Get-CmsMessage to Unprotect-CmsMessage to decrypt the content, provided that you have information about the document encryption certificate that was used to encrypt the content.
Get-CmsMessage [-Content] <String> [<CommonParameters>]Get-CmsMessage [-Path] <String> [<CommonParameters>]Get-CmsMessage [-LiteralPath] <String> [<CommonParameters>]
Get encrypted content
$Msg = Get-CmsMessage -Path "C:\Users\Test\Documents\PowerShell\Future_Plans.txt"
$Msg.ContentIdentifyPipe encrypted content to Unprotect-CmsMessage
$Msg = Get-CmsMessage -Path "C:\Users\Test\Documents\PowerShell\Future_Plans.txt"
$Msg | Unprotect-CmsMessage -To "cn=youralias@emailaddress.com"IdentifyIts page in the reference: Get-CmsMessage.
Parameters
-ContentSpecifies an encrypted string, or a variable containing an encrypted string.-LiteralPathSpecifies the path to encrypted content that you want to get. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcard characters. If the path includes escape characters, enclose each one in single quotation marks. Single quotation marks tell PowerShell not to interpret enclosed characters as escape characters.-PathSpecifies the path to encrypted content that you want to decrypt.