To get and store the credential for the current user
Thank sean.
1
2
| $notespw = Read-Host "Enter the password for the Notes ID file" -AsSecureString
$notespw | ConvertFrom-SecureString | Set-Content $pwfile -force |
To retrieve the password and create the PSCredential object:
1
2
| $notespw = get-content $pwfile | ConvertTo-SecureString
$notesid = new-object -typename system.management.automation.pscredential -argumentlist "-default-",$notespw |
Example of use:
1
| Get-DominoMailbox mary@contoso.com -SourceCredential $notesid |
After reading you site, Your site is very useful for me .I bookmarked your site!
Excellent write-up! I doscovered while working with this that the password stored is encrypted using a credential attached to your Windows login, so if another account tries to read the file it will fail. I was attempting to allow unpriviledged users to run a script with elevated privledges. To make it work you have to supply the encryption string to the convert-securestring statement.