Section 1: Create Password File
# Get PasswordSection 2: Read Password File
$PassWord = Read-Host -Prompt 'Please Enter Password';
# Convert to System.Security.SecureString
$PassWord = ConvertTo-SecureString -String $PassWord -AsPlainText -Force
# Encrypt it
$Encrypted = ConvertFrom-SecureString -SecureString $Password
# Save to File
$Encrypted | Set-Content Encrypted.txt
# Read From File and Convert to System.Security.SecureString
$Password = Get-Content Encrypted.txt | ConvertTo-SecureString
沒有留言:
張貼留言