Globalresponse
Contributor
Contributor

Configuring a VMware Tools Repository in vSphere 6.7U1

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

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

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

Globalresponse
Contributor
Contributor

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. 

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
Globalresponse
Contributor
Contributor

question:

should we be updating

UpdateProductLockerLocation or UpdateProductLockerLocation_task?

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
RiaanVanNiekerk
Contributor
Contributor

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

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
BubbaMik3
Contributor
Contributor

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!

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
BubbaMik3
Contributor
Contributor

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!

0 Kudos