Quantcast
Channel: Virtu-Al.Net » Image Builder
Viewing all articles
Browse latest Browse all 4

More Auto Deploy PowerCLI shortcuts

$
0
0


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

image

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

image

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

image

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 &quot;no-tools&quot;} | Select -first 1   <br />Export-EsxImageProfile -ImageProfile $IP -FilePath C:\Tmp\LatestImage.zip –ExportToBundle

image

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

image

More Auto Deploy PowerCLI shortcuts is a post from: Virtu-Al.
Virtu-Al is one of the authors of VMware vSphere PowerCLI Reference: Automating vSphere Administration"

Buy it now from: Amazon USA Amazon UK Sybex


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images