I have a need for storing multiple logins/passwords in a single credential object. Some time ago, I received a PowerShell Tip, which said it is possible. But I have lost that mail.
Here’s the crude way, I’m using:
$senduser1 = "User1" $password1 = "Pwd1"$senduser2 = “User2”
$password2 = “Pwd2”$PWord11 = ConvertTo-SecureString –String $password1 –AsPlainText -Force
$PWord22 = ConvertTo-SecureString –String $password2 –AsPlainText -Force$Credz = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $senduser1, $PWord11
$Credz| where {$_.UserName -like ‘User1’}$Credz = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $senduser2, $PWord22
$Credz| where {$_.UserName -like ‘User2’}
Is there a better way to do this?