Created
March 15, 2021 13:59
-
-
Save janv8000/c122fe33363a920d293cb4e3e4f8f244 to your computer and use it in GitHub Desktop.
adfs_dumper.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$huidigTijdstipFilenameSafe = $(get-date -f yyyyMMddTHHmmssZ); | |
# Output folders aanmaken | |
New-Item -ItemType "Directory" C:\temp\AdfsConfigDump\"$env:computername" -Force | |
$stampedFolder = New-Item -ItemType "Directory" "C:\temp\AdfsConfigDump\$env:computername\$huidigTijdstipFilenameSafe" -Force | |
Remove-Item C:\temp\AdfsConfigDump\"$env:computername"\LATEST -Recurse -Force -ErrorAction Ignore | |
$latestFolder = New-Item -ItemType "Directory" "C:\temp\AdfsConfigDump\$env:computername\LATEST" | |
Get-AdfsApplicationGroup | ConvertTo-Json -Depth 10 | Out-File "$stampedFolder\alles.json" | |
Get-AdfsApplicationPermission | | |
Sort-Object -property ServerRoleIdentifier | | |
Select-Object -Property ConsentType, ClientRoleIdentifier, ScopeNames, ServerRoleIdentifier | | |
ConvertTo-Json | Out-File "$stampedFolder\AdfsApplicationPermission.json" | |
Get-AdfsApplicationGroup | | |
ForEach-Object { | |
$veiligeNaam = $($_.Name).Split([IO.Path]::GetInvalidFileNameChars()) -join '_' ; | |
ConvertTo-Json -Depth 10 $_ | Out-File "$stampedFolder/$veiligeNaam.json" | |
} | |
Get-AdfsWebApiApplication | ForEach-Object { | |
$veiligeNaam = $($_.Name).Split([IO.Path]::GetInvalidFileNameChars()) -join '_' ; | |
$applicid = $($_.ApplicationGroupIdentifier).Split([IO.Path]::GetInvalidFileNameChars()) -join '_' ; | |
$dirk = "$stampedFolder" + "\" + $applicid + "_" + $veiligeNaam + "_rules_txt" | |
$_.IssuanceTransformRules | Out-File $dirk | |
} | |
Get-AdfsRelyingPartyTrust | ForEach-Object { | |
$relyingPartyTrustName = $($_.Name).Split([IO.Path]::GetInvalidFileNameChars()) -join '_' ; | |
ConvertTo-Json -Depth 10 $_ | Out-File ($stampedFolder.FullName + "\relying_" + $relyingPartyTrustName + ".json") | |
$_.IssuanceTransformRules | Out-File ($stampedFolder.FullName + "\relying_" + $relyingPartyTrustName + "_rules_txt" ) | |
} | |
Get-AdfsClaimsProviderTrust | | |
ForEach-Object { | |
$adfsClaimsProviderTrustName = $($_.Name); | |
ConvertTo-Json -Depth 10 $_ | Out-File ($stampedFolder.FullName + "\claimsprovider_" + $adfsClaimsProviderTrustName + ".json") | |
$_.AcceptanceTransformRules | Out-File ($stampedFolder.FullName + "\claimsprovider_" + $adfsClaimsProviderTrustName + "_rules_txt") | |
} | |
Copy-Item -Path "$stampedFolder\*" -Destination "$latestFolder\" -Recurse | |
Invoke-Item "$stampedFolder" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment