No, not something new at all, more of a answer on a lot of questions I got from folks. At TechNet Wiki there is a page that describes how to deal with passwords, secure strings and such.
Working with Passwords, Secure Strings and Credentials in Windows PowerShell
Here is the most common I use:
Create SecureString
Type the password in an interactive prompt:
$SecurePassword = Read-Host -Prompt “Enter password” -AsSecureString
Convert from existing plaintext variable
$PlainPassword = “P@ssw0rd”
$SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force
Create PSCredentials
Assuming that you have password in SecureString form in $SecurePassword variable:
$UserName = “Domain\User”
$Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $UserName, $SecurePassword
Read the rest of the Wiki here: http://social.technet.microsoft.com/wiki/contents/articles/4546.working-with-passwords-secure-strings-and-credentials-in-windows-powershell.aspx
/mike
Categories: PowerShell
Länken verkar vara kaputt :-(
Testade den nyss, funkar
You should really blank out the clear text password after it’s converted so it’s not stored in memory.
You should really blank it the clear text password after conversion so it’s not stored in memory.
Yes