From bd9d992e191e0620a63f9b86ac54d063dd22af7b Mon Sep 17 00:00:00 2001 From: ralfk Date: Thu, 21 Sep 2023 11:44:58 +0000 Subject: [PATCH] Add Powershell Folder and one script --- Eingang/Csharp.md | 6 +++++ .../get-securestorecredentials.ps1 | 24 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 Eingang/Csharp.md create mode 100644 Powershellscripts/get-securestorecredentials.ps1 diff --git a/Eingang/Csharp.md b/Eingang/Csharp.md new file mode 100644 index 0000000..cf93e3e --- /dev/null +++ b/Eingang/Csharp.md @@ -0,0 +1,6 @@ +# C\# oder Csharp + + +Operatoren = ?? +?? und ??=: die NULL-Sammeloperatoren +siehe hierzu https://learn.microsoft.com/de-de/dotnet/csharp/language-reference/operators/null-coalescing-operator diff --git a/Powershellscripts/get-securestorecredentials.ps1 b/Powershellscripts/get-securestorecredentials.ps1 new file mode 100644 index 0000000..8643682 --- /dev/null +++ b/Powershellscripts/get-securestorecredentials.ps1 @@ -0,0 +1,24 @@ +Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue +#Any web application associated with SSS proxy application or central admin +$WebAppURL="https://collaboration-int.bauer-de.bauermedia.group" + +#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 newline at end of file