How to manage iSCSI targets with PowerCLI part 2

In part 2 of this series I will show how to remove iSCSI targets with PowerCLI.

But first, let’s see which targets are configured on vSphere host esx2.ict-freak.local:

$esx = Get-VMHost "esx2.ict-freak.local"
Get-IScsiHbaTarget -IScsiHba ($esx | Get-VMHostHba -Type iScsi | Where {$_.Model -eq "iSCSI Software Adapter"})

The following targets are configured:


In this post I want to show you how to remove the target with PowerCLI. So I opened the vSphere PowerCLI Cmdlets Reference and searched for the Remove-IScsiHbaTarget. On this page you’ll find the following examples:

————– Example 1 ————–

Get-IScsiHbaTarget -Address -Type Send | Remove-IScsiHbaTarget

Retrieves and removes the targets of type Send on the specified address.

————– Example 2 ————–

Remove-IScsiHbaTarget -Target (Get-IScsiHbaTarget -Address

Removes the specified iSCSI HBA targets.

Unfortunately this example doesn’t work because the –Address parameter doesn’t exist in VMware vSphere PowerCLI 4.1 build 264274.

Continue reading “How to manage iSCSI targets with PowerCLI part 2”


PowerCLI: Find and Set the Service Console Memory value


Last year I wrote a blog post about changing the COS memory. You can find the post here: (it’s written in Dutch). In that post there is already a one-liner made by LucD butt in this post you’ll get an extra one-liner to determine the COS memory value.

If you want to see how much memory is allocated for the Service Console run the next script:

Get-VMHost | Sort Name | Get-View | Select Name, `
@{N="Service Console Memory";E= {"" + `
[math]::round($_.Config.ConsoleReservation.ServiceConsoleReserved / 1MB, 0) + " MB "}}


Just add | Export-Csv -NoTypeInformation "D:\cosmem.csv" to export the data to a CSV file.

The output will look like this:


The script/one-liner:

Get-VMHost | Get-View | % { 
$_.Name | Where { $_.Config.ConsoleReservation.ServiceConsoleReserved -eq "314572800" }
(Get-View -Id $_.ConfigManager.MemoryManager).ReconfigureServiceConsoleReservation(800*1mb) }

You can monitor the changes in vCenter:


More information about the maximum values can be found here:  vsp_40_config_max.pdf.

The maximum value for the COS Memory is 800MB so that’s what the script will use to set the COS memory.

Note: You have to restart the server to apply the changes.

Error when deploying an OVF on vSphere


If you want to deploy an OVF template within vSphere, you might get the following warning/error:

You don’t hold privilege ‘ Datastore > Allocate space’ on the Datastore connected to the selected Cluster.

See the screenshot below:


The solution is simple, click on Inventory followed by Host and Clusters:


Start the deploy OVF wizard again and the error/warning will not show up.

Add an ESX 3.x host to your vSphere Cluster


If you add an ESX 3.5 host to your vSphere Cluster,there is a change you’ll get this warning:


The solution is simple, you need the “old” license server running in your network. So download the “old” license server from


Install the License Server for ESX 3.5 on different server than your vCenter box. I tried installing it on the same box, but it ended with a failed startup of the License server services. The installation is straight forward (read next, next, add license file, next and finish).

After the installation open the vCenter Service Settings option.


And enter the address of your license server and press ok.


Now it’s possible to add the ESX 3.5 host to your cluster.

Upgrade ESX3i to ESX4i with the vSphere Host Update Utility


In this post I will introduce a new VMware tool called VMware vSphere Host Update tool. With this tool you’re able to update an ESX host without VUM, just like the VMware Infrastructure Update utility. See my previous post here. An other interesting feature of the vSphere Host Update tool is the option to upgrade an existing ESX(i) Host to vSphere.  In this post I will guide you through the upgrade process of an ESXi host which runs from a memory stick.

Start the vSphere Host Update Utility from  Start – Programs – VMware – VMware vSphere Host Update Utility.  When you already accessed your ESXi host with the VI Client, The host are already added to the Host List. If this is not the case, you can add your host via the Add Host… link at the right corner.  So now we’re ready to upgrade. Select the host and press the upgrade button.


The ESXi 4.0 Upgrade Wizard starts. You’ll have to add the upgrade zip file which you can download from if you’re a Beta user.


Enter the credentials for your host. In the screenshot below, you’ll see an error: The host must be in maintenance mode to perform an upgrade. So when the host is in maintenance mode, we can continue the upgrade process.


After the Host Compatibility check, the host will be upgraded to vShere.


After a couple of minutes the host is ready and is running ESXi 4.