Auto Deploy: create updated HP ESXi image profile

This post has already been read 14600 times!

I must say, I took the script and edited to fit my needs. The script is basicly downloading the latest VMware VIB’s together with all the latest HP vibs.
A lot of drivers (which you may not use?) can be uncommented to be removed from the image (saves you some space and image load time)

  • I added the vCloud Agent (you’ll find the vCloud Director Agent inside your vCloud Director cell on  /opt/vmware/vloud-director/agent/vcloudagent-esx51-5.1.0-799577.zip)
  • I added the vShield Endpoint driver (download it from your vShield Manager: https://vsm-ip/bin/offline-bundles/vShieldEndpointMux.zip
# Add VMware's Online Depot so we can get the latest Image Profiles and Software Packages
Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
# Add HP's Online Depot to get access to all of HP's Software Packages
Add-EsxSoftwareDepot http://vibsdepot.hp.com/hpq/oct2012/index.xml
# Add vSphere HA agent
Add-EsxSoftwareDepot https://<vcenter>/vSphere-HA-depot/index.xml
# Add vCloud Agent
# Add-EsxSoftwareDepot D:\Images\vibs\vcloudagent-esx51-5.1.0-799577.zip
# Add vShield Endpoint MUX
# Add-EsxSoftwareDepot D:\Images\vibs\vShield-Endpoint-Mux.zip
#
# Vars used to set the ESXi image profile name, basically just a time stamped name
$DATESTAMP=get-date -Format yyyMMdd
# Sort the image profiles from VMware's online depot to get the latest image profile
$ImageProfiles = Get-EsxImageProfile | Where-Object {$_.Name -like "*standard*" -and $_.Name -notlike "*s-*" } | Sort-Object "ModifiedTime" -Descending
$ImageProfile = $ImageProfiles[1]
$PROFILEAME="ESX5i-$DATESTAMP-"+$ImageProfile.Name
# Create a copy of the latest image profile from VMware's online depot
New-EsxImageProfile -CloneProfile $ImageProfile -AcceptanceLevel PartnerSupported -Vendor "VMware, Inc." -name $PROFILEAME
# Remove unneeded ESX Drivers (uncomment when you need a driver)
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-bnx2i
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-sata-promise
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-forcedeth
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage misc-cnic-register
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-tg3
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-megaraid-sas
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-megaraid-mbox
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-ips
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ipmi-ipmi-si-drv
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-ahci
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-sata-svw
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-cnic
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-serverworks
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-mptspi
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-hpt3x2n
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-s2io
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-bnx2
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-megaraid2
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-amd
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-lpfc820
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-pdc2027x
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-atiixp
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ipmi-ipmi-devintf
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-qla2xxx
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-r8169
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-bnx2x
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-mpt2sas
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-ata-piix
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-hpsa
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-via
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-aacraid
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-rste
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-cmd64x
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ima-qla4xxx
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-sata-sil
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-sata-sil24
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-igb
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-qla4xxx
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage block-cciss
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-aic79xx
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-sky2
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage sata-sata-nv
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-nx-nic
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-ixgbe
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage uhci-usb-uhci
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-adp94xx
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ata-pata-sil680
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-enic
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-be2net
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage esx-xlibs
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ehci-ehci-hcd
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ohci-usb-ohci
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage net-r8168
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage scsi-fnic
# Remove-EsxSoftwarePackage -ImageProfile $PROFILEAME -SoftwarePackage ipmi-ipmi-msghandler
#
# Add the HP related packages to the our new image profile
Get-EsxSoftwarePackage -vendor "Hewlett*" | Add-EsxSoftwarePackage -ImageProfile $PROFILEAME
Get-EsxSoftwarePackage -vendor "hp" | Add-EsxSoftwarePackage -ImageProfile $PROFILEAME
# Add the HA Agent related packages to the our new image profile
Get-EsxSoftwarePackage -Name vmware-fdm | Add-EsxSoftwarePackage -ImageProfile $PROFILEAME
# Add the vCloud Agent to the our new image profile
# Get-EsxSoftwarePackage -Name vcloud-agent | Add-EsxSoftwarePackage -ImageProfile $PROFILEAME
# Add the vShield Endpoint MUX to the our new image profile
# Get-EsxSoftwarePackage -Name epsec-mux | Add-EsxSoftwarePackage -ImageProfile $PROFILEAME
# Export the image profile to a bundle
Export-EsxImageProfile -ImageProfile $PROFILEAME -ExportToBundle -FilePath D:\Images\$PROFILEAME.zip

When you need to load this image into your Auto Deploy Server, use the following PowerCli code:

Connect-VIServer 0.0.0.0 -User administrator –Password "password"
Add-EsxSoftwareDepot <drive>:\<Path>\ESX5i--<date>ESXi-5.1.0-<date>-standard.zip
New-EsxImageProfile -CloneProfile ESX5i--<date>ESXi-5.1.0-<date>-standard -name "ESX5i"
New-DeployRule –Name “HP-ESX5i” –Item “ESX5i", cluster, hostprofile -AllHosts
Add-DeployRule -DeployRule “HP-ESX5i"

You also need to check out the updater script from Alan Renouf at http://www.virtu-al.net/2012/01/06/updating-your-image-profile/

If you own the original script, please let me know. I was unable to find it again.