Skip to content

Instantly share code, notes, and snippets.

@namob
Created September 16, 2016 20:56
Show Gist options
  • Save namob/97c258163460590c73e65eceb4f64967 to your computer and use it in GitHub Desktop.
Save namob/97c258163460590c73e65eceb4f64967 to your computer and use it in GitHub Desktop.
Regenerate vCloud Director certificates
$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