Forum Discussion

Heiko Watz's avatar
Heiko Watz
Iron Contributor
Dec 19, 2016
Solved

Store password in Windows credential manager and use it in Powershell

On the #ESPC16 in Vienna someone is showing a way to store credentials in the Windows credential manager and then use is in Powershell to connect to Exchange / SharePoint / Azure… online. It was a v...
  • Erwin van Hunen's avatar
    Erwin van Hunen
    Jan 05, 2017

    We use a class which is available in the PnP Core module to use retrieve credentials from the Windows Credential Manager. That class you can find here : 

     

    https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Utilities/CredentialManager.cs

     

    This would require you to either rewrite that to PowerShell, or use the PnP Core assembly in your project (or simply copy over this class to your own binary PowerShell module code).

     

    Alternatively you could install the PnP PowerShell cmdlets (install-module sharepointpnppowershellonline) and forget about all the other cmdlets and use:

     

    Get-PnPStoredCredential -Name "nameofthecredential" -Type PSCredential

     

Resources