VMware Cloud Community
escapem2
Enthusiast
Enthusiast

Install Vmware Tools after creating VMs

hi guys

I have this Power CLI code I think I got it from here or from a blog any way. This script creates VMs and I want to know if there is a way to after creating the VM is there a way to install Vmware Tools?

Since I am not able to find it all I see the the powercli command update-tools

$worksheet = Import-CSV "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\VMs_.csv"
$worksheet | ForEach-Object {
      Get-OSCustomizationSpec -Name $_.Customization
      new-VM `
          -Name $_.VM_Name `
   -VMHost $_.Host `
          -Template $_.Template `
          -Datastore $_.Datastore `
   -OSCustomizationspec $_.Customization `
          -Location $_.Location `
          -DiskStorageFormat $_.DiskStorageFormat |`
   Set-VM -NumCpu $_.CPU -MemoryMB $_.Memory -Confirm:$false
      Start-VM -VM $_.VM_Name
     }

thanks a lot

0 Kudos
3 Replies
LucD
Leadership
Leadership

Update-Tools does exactly that, it updates the installed VMware Tools in a guest OS.

To install the VMware Tools you might want to have a look at Using VUM Powercli for VMTools and Hardware upgrades

It uses the Remediate-Inventory cmdlet from the Update Manager pssnapin to install the VMware Tools.

An alternative would be to use the Copy-VMGuestFile cmdlet to copy the VMware Tools installation files to the guest, and then use the Invoke-VMScript to start the installation.


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

0 Kudos
escapem2
Enthusiast
Enthusiast

yeah I know update-tools do what is say...I mis-typed.

I saw the link to posted...looks not that simple....

0 Kudos
LucD
Leadership
Leadership

In that case go for the Copy-VMGuestFile and the Invoke-VMScript cmdlets.

That is rather straightforward, I think.


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

0 Kudos