Updating vCenter Plug-in Registration URL's (from IP address to DNS) using PowerCLI

I've found this post by Josh Perkins helpful in more ways than the one demonstrated.  It's allowed me to not only update my vcops plugin registration w/ vCenter, but also helped me to update my Dell vCenter plug-in so that it connects via its DNS address rather than its IP.


However, I decided to explore the possibility of using PowerCLI to fix these registrations.
Turns out you can and the change is immediate, so you don't have restart the vCenter service.
YAY!  No more cert errors!  You still have to ssh into the vCOPs UI vm and update the viClientConfig.xml file, but that's easy enough.

Here is my result (specifically for vCOPs):

$BaseURL = "https://myvCOPsRegisteredDNS.Name.local"
$ExtURL = "/vcops-vsphere/"
Connect-VIServer my1stvCenterServer, my2ndvCenterServer
Foreach ($DefaultVIServer in $global:DefaultVIServers)
    $VIServerExtensionManager = Get-View -Server $DefaultVIServer ExtensionManager
    $vcopsext = $VIServerExtensionManager.ExtensionList | where {$_.key -match "com.vmware.vcops"}
    ($vcopsext.server | where {$_.url -match "viClientConfig"}).url = ($BaseURL + $ExtURL + "viClientConfig.xml")
    ($vcopsext.client | where {$_.url -match "vcops-ngc.zip"}).url = ($BaseURL + $ExtURL + "vcops-ngc.zip")
    # If you don't $null the below properties, then the objects underneath these produce errors in updating because those object properties are required.
    $vcopsext.ExtendedProductInfo = $null
    $vcopsext.solutionManagerInfo = $null

No comments: