VMware Cloud Community
Globalresponse
Contributor
Contributor
Jump to solution

Configuring a VMware Tools Repository in vSphere 6.7U1

read a great article about a new API for updating the tools repository. Configuring a VMware Tools Repository in vSphere 6.7U1 - VMware vSphere Blog

it uses the new  UpdateProductLockerLocation_Task method. there is currently no module to do this.

does anyone have any idea how we could do this in a powerCLI script?

thanks

Scott

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That post was only published 4 hours ago :smileygrin:

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"

$esx.ExtensionData.UpdateProductLockerLocation($location)


Write-Host "Tools repository moved from"

Write-Host $oldLocation

Write-Host "to"

Write-Host $location


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

10 Replies
LucD
Leadership
Leadership
Jump to solution

That post was only published 4 hours ago :smileygrin:

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"

$esx.ExtensionData.UpdateProductLockerLocation($location)


Write-Host "Tools repository moved from"

Write-Host $oldLocation

Write-Host "to"

Write-Host $location


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Globalresponse
Contributor
Contributor
Jump to solution

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. 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That's the spirit, automate it (with PowerCLI preferably) when you do it more than once Smiley Happy


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Globalresponse
Contributor
Contributor
Jump to solution

question:

should we be updating

UpdateProductLockerLocation or UpdateProductLockerLocation_task?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
RiaanVanNiekerk
Contributor
Contributor
Jump to solution

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?

regards

Riaan

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Since the method is called on the ESXi node, I'm afraid your ESXi needs to be on 6.7U1.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BubbaMik3
Contributor
Contributor
Jump to solution

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.

ESXi 6.7u2ep10

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...

Thanks!

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Doesn't this return the two methods?

$esx = Get-VMHost -Name MyEsx

$esx.ExtensionData | Get-Member -MemberType Method -Name *ProductLocker*


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BubbaMik3
Contributor
Contributor
Jump to solution

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!

Reply
0 Kudos