Wed. Jun 8th, 2022
$inputFile = 'c:\PSscripts\admin\Administrators List.csv'
$AdminList = Import-Csv $inputFile -Delimiter ","
$Me = whoami
$Server = $Me.Split("\")[0]
$Me = $Me.Split("\")[1]

foreach ($row in $AdminList)
{
    if($Me -eq $row.LoginName) 
    {
        $Initials = $row.Initials
        $dstServiceAccount = $row.dstServiceAccount
        $srcServiceAccount = $row.srcServiceAccount
    }
}

$Message = "Enter the password for $srcServiceAccount" 
$fileName = $null
$fileName = "c:\PSscripts\Credentials\" + $Server + "_"+$Initials+"_"+$srcServiceAccount+"_password.txt"
$securePassword = Read-host -Prompt $Message -AsSecureString | ConvertFrom-SecureString
$securePassword | Out-File -FilePath $fileName

$Message = "Enter the password for $dstServiceAccount" 
$fileName = $null
$fileName = "c:\PSscripts\Credentials\" + $Server + "_"+$Initials+"_"+$dstServiceAccount+"_password.txt"
$securePassword = Read-host -Prompt $Message -AsSecureString | ConvertFrom-SecureString
$securePassword | Out-File -FilePath $fileName

This website uses cookies. By continuing to use this site, you accept our use of cookies.