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

2 Comments

  1. account money says

    After reading you site, Your site is very useful for me .I bookmarked your site!

    Reply
  2. Ryan Witschger says

    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.

    Reply

Leave a Reply

Leave a Reply
  • (required)
  • (required) (will not be published)

  • Archives

  • Tags

  • Subscribe
  • Pages

  • More

  • Disclaimer…

    This is my personal weblog. The opinions expressed herein are my own and are not representative of any 3rd party influence. The owner of this blog reserves the right to edit or delete any comments submitted to this blog without notice if they are deemed to be spam, offensive or otherwise inappropriate. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.


    Lastly, I do my best to document my sources if the article is not of my own creation. If I have missed or forgotten to source your work. I would love feedback via the comments section. Thank you.

DreamHost promos
SiteLock