Forked from namob/regenerate-federation-certificates.ps1
Created
July 29, 2019 09:54
-
-
Save imtrinity94/dae009946f7ac848a841801f0fdef696 to your computer and use it in GitHub Desktop.
Regenerate vCloud Director certificates
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
$vcloudhost = "" | |
# Load cloud module from VMware | |
try {import-module VMware.VimAutomation.Cloud} catch {} | |
# Connect to | |
connect-ciserver $vcloudhost | |
# Get all organisations | |
$orgs = get-org | |
foreach ($o in $orgs) | |
{ | |
$orgview = $o | get-ciview | |
# If SAML is not configured | |
if ($orgview.Settings.OrgFederationSettings.Enabled -match "False") | |
{ | |
# Regenerate the certificate and get the new expiration date | |
$orgview.Settings.OrgFederationSettings.RegenerateFederationCertificate() | |
$orgview = $o | get-ciview | |
write-host "Updated certificate on org"$o.Name", Certificate expiration:"$orgview.Settings.OrgFederationSettings.CertificateExpiration | |
} | |
else | |
{ | |
# Else notify that the organisation is using SAML | |
write-host "SAML enabled on org"$o.Name", not touching federation regeneration" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice