Following on from a post I created a while back which gave you a couple of new functions to use with Auto Deploy I wanted to add a few extra pieces of code which I use on a regular basis that may save people time when they are building out their image profiles or working with auto deploy:

Adding the VMware hosted software depots to your PowerCLI Session:

Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

Listing the 5 most recent image profiles from the online depot (Thanks to Andreas Peetz):

Get-EsxImageProfile | Sort-Object -Descending -Property @{Expression={$_.Name.Substring(0,10)}},@{Expression={$_.CreationTime.Date}},Name | Select -first 5 | FT -AutoSize

List the latest image profile which includes VMTools:

Get-EsxImageProfile | Sort-Object -Descending -Property @{Expression={$_.Name.Substring(0,10)}},@{Expression={$_.CreationTime.Date}},Name | Where { $_.Name -notmatch "no-tools"} | Select -first 1 | Format-Table –AutoSize

List the latest image profile which does not include VMTools:

Get-EsxImageProfile | Sort-Object -Descending -Property @{Expression={$_.Name.Substring(0,10)}},@{Expression={$_.CreationTime.Date}},Name | Where { $_.Name -match "no-tools"} | Select -first 1 | Format-Table –AutoSize

Export the latest Image profile with VMTools to disk so that we can use it later:

$IP = Get-EsxImageProfile | Sort-Object -Descending -Property @{Expression={$_.Name.Substring(0,10)}},@{Expression={$_.CreationTime.Date}},Name | Where { $_.Name -notmatch "no-tools"} | Select -first 1 Export-EsxImageProfile -ImageProfile $IP -FilePath C:\Tmp\LatestImage.zip –ExportToBundle

When everything looks right in your rule set and your Image Profiles are still not booting correctly make sure you have checked the rule set compliance and repaired it with the following:

Test the rule set compliance for all hosts:

Get-VMHost | Test-DeployRuleSetCompliance

Repair the rule set compliance for all hosts:

Get-VMHost | Test-DeployRuleSetCompliance | Repair-DeployRuleSetCompliance

-Alan

Share this: Email

Print

Twitter

Facebook

Reddit

