How to Recover Credentials from Secure Store Service in SharePoint using PowerShell?

So the previous SharePoint administrator left without documenting passwords from SharePoint secure store Service? Unfortunately, There is no way to get stored user name, passwords from SharePoint secure store service from Central Administration site.
Recover secure store service credentials in SharePoint using powershell

No worries, Lets use PowerShell to decrypt all user names and passwords stored in SharePoint secure store service.

PowerShell script to Get Credentials from Secure Store Service: 
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Any web application associated with SSS proxy application or central admin

#Establish the Context
$Provider = New-Object Microsoft.Office.SecureStoreService.Server.SecureStoreProvider
$Provider.Context =  Get-SPServiceContext -Site $WebAppURL
#Get All Target Applications
$TargetApps = $provider.GetTargetApplications()
foreach ($App in $TargetApps)
    Write-Output $App.Name
    #Get the credentials for the App
    $Credentials = $provider.GetCredentials($App.Name)
    foreach ($Cred in $Credentials)
        $EncryptString  = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($cred.Credential)
        $DecryptString  = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($EncryptString)
        Write-Output "$($cred.CredentialType): $($DecryptString)"

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.