-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackupADFSRelyingPartyTrust.ps1
32 lines (25 loc) · 1.09 KB
/
BackupADFSRelyingPartyTrust.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Get-AdfsRelyingPartyTrust | Out-File “C:\temp\backup\RelyingPartyTrust_All.txt"
$All = Get-AdfsRelyingPartyTrust
foreach ($name in $all.name)
{
$temp = Get-AdfsRelyingPartyTrust -name $name
$temp | Out-File C:\temp\backup\"$name"_RelyingPartyTrust.txt
if ($temp.EncryptionCertificate)
{
$decimalcertencryption = ($temp.EncryptionCertificate.GetRawCertData())
[Convert]::ToBase64String($decimalcertencryption) | Out-File C:\temp\backup\"$name"_Encryption_Certificate.cer
}
if ($temp.RequestSigningCertificate)
{
$decimalcertsigning = ($temp.RequestSigningCertificate.GetRawCertData())
[Convert]::ToBase64String($decimalcertsigning) | Out-File C:\temp\backup\"$name"_Signing_Certificate.cer
}
}
$date = Get-Date -UFormat "%m-%d-%Y"
Compress-Archive -Path C:\temp\backup\* -DestinationPath C:\temp\backup\"$date".zip
$source = "C:\temp\backup\$date.zip"
$Destination = " "
New-Item -ItemType directory -Path $Destination -Force
Copy-Item -Path $Source -Destination $Destination -Force
Start-Sleep -s 15
Remove-Item –path C:\temp\backup\*