esxi5 custom iso image building

short quick procedure for building custom iso image esx5 .
First download the offline esxi5 depo file from vmware and then in powercli :

Add-EsxSoftwareDepot -DepotUrl C:\esx-depot-5.0.0-469512\VMware-ESXi-5.0.0-469512-depot.zip

New-EsxImageProfile -CloneProfile ESXi-5.0.0-469512-standard -Name “Esxi5-469512-hp-cisco”

Add-EsxSoftwareDepot -DepotUrl C:\esx-depot-5.0.0-469512\HP-drivers.zip

Add-EsxSoftwareDepot -DepotUrl C:\esx-depot-5.0.0-469512\CISCO-drivers.zip

Add-EsxSoftwarePackage -ImageProfile “Esxi5-469512-hp-cisco” -SoftwarePackage hp-driver

Add-EsxSoftwarePackage -ImageProfile “Esxi5-469512-hp-cisco” -SoftwarePackage Cisco-driver

## double checking if all is inside our new custom cisco/hp iso

(Get-EsxImageProfile -Name “Esxi5-469512-hp-cisco”).VibList

Export-ESXImageProfile -ExportTo-Iso -ImageProfile “Esxi5-469512-hp-cisco” -FilePath “c:\my_custom_cd.iso” -Force -NoSignatureCheck

and so on…

Advertisements

Can not set set-executionpolicy to remotesigned

Set-ExecutionPolicy : Access to the registry key ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell’ is denied
When you receive that error while trying to set up the execution policy, try to right click on the powershell shortcut, and run as administrator.
It worked for me.

Forcing vSphere client locale

“Sphere Client Locale Forcing Mode
With vSphere 5.0, you can configure the VMware vSphere Client™ to provide the interface text in English even when the machine on which it is running is not English. You can set this configuration for the duration of a single session by supplying a command-line switch. This configuration applies to the interface text and does not affect other locale-related settings such as date and time or numeric formatting.

The following vSphere Client command causes the individual session to appear in English:

vpxClient -locale en_US”
as per release notes in vSphere 5.0
http://www.vmware.com/support/vsphere5/doc/vsphere-esx-vcenter-server-50-release-notes.html

Label expression and changing expression when it’s going to be negative

Get-Datacenter -Name “xxx Datacenter” | Get-Datastore | Select-Object @{Label=”DataStore Name”;Expression={$_.Name}},@{Label=”GB Left”;Expression={[Math]::Round($_.FreeSpaceMB/1024,2)}},@{Label=”Capacity GB”;Expression={[Math]::Round($_.CapacityMB/1024,2)}},@{Label=”Free %”;Expression={[Math]::Round($_.FreeSpaceMB/$_.CapacityMB,3)*100}},@{Label=”New VMs”;Expression={[Math]::Floor(“{0:0.00;’0′}” -f (($_.FreeSpaceMB – 30000)/20480)) }} | ConvertTo-Html -Head $head -Body $header | Out-File “d:\bbb.html”

“{0:0.00;’0′}” -f (($_.FreeSpaceMB – 30000)/20480) -> will put 0 when the value will be negative, if positive if will leave the value like it is.

More about formatting:

http://msdn.microsoft.com/en-us/library/0c899ak8%28v=vs.71%29.aspx