VMware Cloud Community
jvm2016
Hot Shot
Hot Shot
Jump to solution

adding _vmware tools_functinalities _powercli

Hi Luc,

Good morning

I thought of adding vmware tools functinality  snippet to our main html script which we discussed yestaerday .

i think we can add orange code to do so (this is what you provided few days back) .since it will update during next powercycle it wont cause any isueswith vm (or any network disconnection)??

can you suggest on this??

$vms_tools_upgrade_needed=$vms | Where-Object {$_.Guest.GuestFamily -eq 'windowsGuest' -and $_.ExtensionData.guest.toolsversionstatus -eq 'guesttoolsneedupgrade'}

$do = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec

$do.Tools = New-Object VMware.Vim.ToolsConfigInfo

$do.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"

Get-VM $vms_tools_upgrade_needed |

ForEach-Object -Process {

$_.ExtensionData.ReconfigVM_Task($do)

}

$fragments += $vms | Where-Object {$_.Guest.GuestFamily -eq 'windowsGuest' -and $_.ExtensionData.guest.toolsversionstatus -eq 'guesttoolsneedupgrade'}|

  select name|

   ConvertTo-Html -Property Name -Fragment -PreContent '<h2>WINDOWS_VM_TOOLS_NEED_UPGRADE</h2>' |

   Out-String

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That looks ok.

The only small improvement I can suggest is to not calculate the VMs twice.

The 2nd part could be

$fragments += $vms_tools_upgrade_needed |

  select name |

   ConvertTo-Html -Property Name -Fragment -PreContent '<h2>WINDOWS_VM_TOOLS_NEED_UPGRADE</h2>' |

   Out-String


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

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

That looks ok.

The only small improvement I can suggest is to not calculate the VMs twice.

The 2nd part could be

$fragments += $vms_tools_upgrade_needed |

  select name |

   ConvertTo-Html -Property Name -Fragment -PreContent '<h2>WINDOWS_VM_TOOLS_NEED_UPGRADE</h2>' |

   Out-String


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

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

thnaks.I am going to change that .

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

also .

yesterday i uploaded the 1.0 version to github.

https://github.com/jai-2018/vsphere-health-check

can you please tell me what steps will you follow to make changes to version 1.0 (yesterday's version)?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You mean changes to the code or how to use git to make changes?


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

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

how to use git to make changes .i can make changes to code and upload my file again .(i think this is what i need to do )

but if you(or other contributor ) want sto make changes what needs to be followed.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

There are many blog posts on how to contribute to a github project.

I find this one (The beginner's guide to contributing to a GitHub project) concise and not too technical.


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

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

thnaksLuc.

0 Kudos