Secure Password with PowerShell

Command:
(Get-Credential).Password | ConvertFrom-SecureString | Out-File “C:\Temp\ABC_A1000001_PW.txt”

Script:

$username = “ABC\A1000001”

$password = Get-Content ‘\\server.domain.xyz\Scripts\Migration\ABC_A1000001_PW.txt’ | ConvertTo-SecureString

$cred = new-object -typename System.Management.Automation.PSCredential `

-argumentlist $username, $password


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *