Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 1.08 KB
# ----------------------------------------
# VARIABLES
# ----------------------------------------
$vCenterServer = "{vCenter FQDN}"
$User = "{Username}"
$Password = "{Password}"
$License = "{License Key}"
# ----------------------------------------
# VCENTER CONNECTION
# ----------------------------------------
$EncryptedPassword = ConvertTo-SecureString -String "$Password" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $EncryptedPassword
Disconnect-VIServer -confirm:$false -ErrorAction SilentlyContinue
Write-Host "Connecting to $vCenterServer"
$vCenter = Connect-VIServer -Server $vCenterServer -Credential $Credential
# ----------------------------------------
# VCENTER LICENSE CONFIGURATION
# ----------------------------------------
$LicenseManager = get-view ($vCenter.ExtensionData.content.LicenseManager)
$LicenseManager.AddLicense($License,$null)
$LicenseAssignmentManager = get-view ($LicenseManager.licenseAssignmentManager)
$LicenseAssignmentManager.UpdateAssignedLicense($vCenter.InstanceUuid,$License,$Null)
You can’t perform that action at this time.