One of the first challenges that we ran into was having to constantly type the password for the various transporter cmdlets that we placed into any of our automation for the conversion of mailboxes from Notes to Exchange. There are no examples that I could find for how to pass this information to a cmdlet such as Move-DominoMailbox. After some digging around I eventually stumbled upon the solution.
This allowed me to prompt for the credentials one time and store them in an encrypted file in a central location. The encrypted password information is user and workstation specific so it cannot be used by another user or even the same user on a different computer.
The following example will successfully allow the passing of a notes credential to the various Transporter Suite cmdlets without being prompted for the notes credentials:
To get and store the credential for the current user:
- $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:
- $notespw = get-content $pwfile | ConvertTo-SecureString
- $notesid = new-object -typename system.management.automation.pscredential -argumentlist "-default-",$notespw
Example of use: