Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save imtrinity94/dae009946f7ac848a841801f0fdef696 to your computer and use it in GitHub Desktop.
Save imtrinity94/dae009946f7ac848a841801f0fdef696 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"
}
}
@imtrinity94
Copy link
Author

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment