Created
September 16, 2016 20:56
-
-
Save namob/97c258163460590c73e65eceb4f64967 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