Can someone help me with script to Export License usage report from Vcenter. This is done manually by logging into webclient> Licensing> reports> products > Export License Usage Report > .
I receive the following error on line 3 ($LicenseAssignmentManager.GetType().GetMethod("QueryAssignedLicenses").Invoke($LicenseAssignmentManager,@($null)) |), when I try executing the script . It says I cant use "null"
Ok, I know what happened.
You have multiple vCenter connections open.
You can check with displaying $global:defaultVIServers.
Close all those connections with
Disconnect-VIServer -Server * -Force -Confirm:$false
Then run that code again.
But perhaps add a Disconnect-VIServer at the end of the script to avoid the same issue on a 2nd or subsequent run of the script