.Net and therefore the powershell has the ability to define a secure string this means that the string is immediately deleted from memory if it is no longer needed
PS D:\> $MySecurePassword=read-host -assecurestring „Enter password“
Enter password: ******
PS D:\> $pPassPointer = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($MySecurePassword)
PS D:\> $DecryptedPass = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($pPassPointer)
PS D:\> # Imported: free memory
PS D:\> [System.Runtime.InteropServices.Marshal]::ZeroFreeCoTaskMemUnicode($Ptr)
PS D:\> write-host „PASS:“ $DecryptedPass
This entry was posted on Samstag, Januar 29th, 2022 at 10:01 and is filed under Administration, Microsoft Solution. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.