That post was only published 4 hours ago
But luckily you can access the API methods from PowerCLI.
Try something like this (note that the folder should exist).$esxName = 'MyEsx'
$dsName = 'MyDS'
$dsFolder = 'ToolsRepo'
$esx = Get-VMHost -Name $esxName
$ds = Get-Datastore -Name $dsName
$oldLocation = $esx.ExtensionData.QueryProductLockerLocation()
$location = "/$($ds.ExtensionData.Info.Url.TrimStart('ds:/'))$dsFolder"
Write-Host "Tools repository moved from"
I know it only 4 hours only. but you know the question is going to come up, because what do you do when you have lots and lots of host to change, Powercli it!!!
thanks for the answer LucD.
That's the spirit, automate it (with PowerCLI preferably) when you do it more than once
should we be updating
UpdateProductLockerLocation or UpdateProductLockerLocation_task?
Both API methods do the same.
The ones with _Task at the end run in async mode, similar to the RunAsync switch on some PowerCLI cmdlets.
The post applies to vSphere 6.7U1.
If we are in a mixed environment, VC on 6.7U1, but ESXi still on 6.5 (upgrade planned), may I use this method?
Since the method is called on the ESXi node, I'm afraid your ESXi needs to be on 6.7U1.
While I realize this post is a bit older...but I just came across it. My environment is slightly different, but I can't seem to find anything.
When running your script I get the following error:
Method invocation failed because [VMware.Vim.HostSystem] does not contain a method named 'QueryProductLockerLocation'.
Thoughts? I can make the change manually in MOB, but would rather script it...
Doesn't this return the two methods?$esx = Get-VMHost -Name MyEsx
$esx.ExtensionData | Get-Member -MemberType Method -Name *ProductLocker*
Sorry, I was running an older version of PowerCLI (6.5). I upgraded to 11.5 and then it worked.
Thanks for the quick response though!