Importing/Exporting OVA in vSphere using VMware OVF Command line Tool

VMware OVF tool is a command line utility that supports import and export of OVF packages to and from vSphere infrastructure.

Download Tool –
Documentation –

Exporting Virtual Machine to OVA file

C:\Program Files\VMware\VMware OVF Tool>ovftool.exe "vi://username:password@vCenterIP:443/DataCenter_Name/vm/Demo-W7-VM" "C:\VM-Backup\Demo-W7-VM.ova"

Importing OVA VM to vSphere

C:\Program Files\VMware\VMware OVF Tool>ovftool.exe "--datastore=datastore1" "--network=VM-Network" "C:\VM-Backup\Demo-W7-VM.ova" "vi://username:password@vCenterIP/DataCenter_Name/host/Cluster_Name/hostIP"

Deploying Cisco UCS Emulator on VMware ESXi

Cisco UCS Emulator is a great tool to show many features that Cisco Unified Computing System (UCS) offers. It also gives something to use to get familiar with the system as well as can be used for the demo.

Download UCS Emulator Version 2.0 GA from

Download the 7zip open source archiver from to unzip the compressed emulator file.

Extract 7z archive. It contains VMDK files that can be used to deploy Virtual Machine on VMware Workstation or Fusion, but to deploy it on ESXi, some additional steps required to process files with VMware vCenter Converter and then we can deploy it to vCenter directly.

Download and Install VMware vCenter Converter from

Launch vCenter Converter and Click File -> New -> Convert Machine

Select “VMware Workstation or Other VMware virtual machine” as the source type and select UCSPE.vmx as virtual machine file to process for conversion.

You can click on “View Source Details” link to know the VM configuration and disks layout.

Close Source Details Dialog and Click Next to proceed with the selection of target destination type.

Select “VMware Infrastructure virtual machine” as the destination type and provide destination information for vCenter Server.

Click Next to Continue. Specify Destination VM name “UCSPE_V2”.

Select a destination cluster resource, datastore and Virtual machine Version “Version 7” for the new VM.

Set the ‘Conversion Options’ before hitting the Finish button. Configure the destination VM parameters as per your need. You can chose to set disk formats to “Thin” or “Thick”, adjust CPU/Memory allocation and set desired destination network.


Confirm selected options from the Summary and then click Finish. The Conversion job will then be processed and status can be watched within the Converter window.

When completed, the VM will appear in the vCenter inventory with the name and configuration specified above.

Go to vCenter and Power-on the VM.

VM is pre-configured to obtain DHCP IP address. Once the VM is booted, it will show the UCS Web UI location and login details on the console.


Default admin password is the cisco for the UCS manager console.

VMware View Client with PCoIP installation on Ubuntu 11.10

VMware View Client for Linux Tech Preview turns your Ubuntu PC into a thin client and connects to your company’s Virtual Desktop Infrastructure. With VMware View 5 PCoIP capacities you can deliver a personalized high fidelity experience for end-users across sessions, devices and operating systems.

Enable Ubuntu 11.10 partner channel package repository “oneiric-partner”

$ sudo gedit /etc/apt/sources.list
[sudo] password for divyen:

Uncomment (take out #) following lines from /etc/apt/sources.list and save file.

# deb oneiric partner
# deb-src oneiric partner

Retrive new list of packages and install vmware-view-client package.

$ sudo apt-get update
$ sudo apt-get install vmware-view-client

Search and Launch VMware View Client from Dash home

Read more about PC Repurposing with VMware View


When VMware view Client cannot verify that the connection to the server is secure, it warns about self-signed or expired certificate with this error “The certificate authority is invalid or incorrect”.

If you encounter this error and cannot connect to the virtual desktop, you can go to the File -> Preferences and set the mode which allows the unverifiable connection.

Snapshot of the VMware View Client Connected to the Windows 7 Virtual Machine on Ubuntu 11.10

Configuring Jumbo Frames on ESXi Server

1. SSH into ESXi Server

2. Set the MTU for the vSwitch

~ # esxcfg-vmknic -m 9000 VMkernel
[2011-11-18 03:01:47 'NotifyDCUI' warning] Notifying the DCUI of configuration change
~ # 

3. Verify vSwitch’s MTU

~ # esxcfg-vmknic -list
Interface  Port Group/DVPort   IP Family IP Address                              Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled Type
vmk0       135                 IPv4                   88:43:e1:c3:19:e8 1500    65535     true    STATIC
vmk1       VMkernel            IPv4                            00:50:56:73:a1:42 9000    65535     true    STATIC
~ #

Handy VMware vSphere PowerCLI Cmdlets

Connect to vShere Server (vCenter/ESX/ESXi Host)

Connect-VIServer -Server $vhost -Protocol $protocol -User $user -Password $password

Disconnect vSphere Server

Disconnect-VIServer -Confirm:$False

Poweron Virtual Machine

Get-VM -Name $VMName | Start-VM

Shutdown Virtual Machine

Get-VM -Name $VM_Name | Shutdown-VMGuest

Reset Virtual Machine

Get-VM -Name $VM_Name | Restart-VM

Disconnect Network Adapter on Virtual Machine

Get-VM -Name $VM_Name | Get-NetworkAdapter | Set-NetworkAdapter -Connected:$false

Connect Network Adapter on Virtual Machine

Get-VM -Name $VM_Name | Get-NetworkAdapter | Set-NetworkAdapter -Connected:$true

Check Network Adapters Connection State on VMs

Get-VM | Get-NetworkAdapter | Select-Object Parent,ConnectionState

Move Virtual Machine to different Port group

Get-VM -Name $VM_Name | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName $new_port_group

Register Virtual Machines by traversing Datastore directories

cd $vm_datastore_path
$vmdirectorylist=Get-ChildItem -Name W7-*

foreach($vmdirectory in $vmdirectorylist)
    cd $vm_datastore_path\$vmdirectory
    $vmxFile=Get-Item *.vmx
    New-VM -name $vmdirectory -VMHost $vHost -VMFilePath $vmxFile.DatastoreFullPath

Add NFS NAS as a new Datastore

New-Datastore -Nfs -VMHost $ESXiHost -Name $nfs_datastore_name -Path $nfs_mount_point -NfsHost $nfs_ip_address

Copy Directory from One Datastore to Other/Same Datastore Recursively

Copy-DatastoreItem $source_datastore\$source_directory $destination_datastore -Recurse

Enable SSH on ESXi Host

Get-VMHost "" | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Start-VMHostService

Getting Endpoint Device Information within VMware View Desktop

When a connection towards the virtual desktop is establishing the View Agent installed within the VM handles the session management. Client Device Information sent to the View Agent and can be gathered every time user logs in, connect and re-connect.

Client Device Information is changing when user changes location/endpoint.
This information is saved at (HKEY_CURRENT_USER -> Volatile Environment). This registry key contains a collection of values which relates to user’s non-persistent environment variable set.

Code (C++ Managed) to retrieve Endpoint Information

using namespace System;
using namespace Microsoft::Win32;

int main()
	RegistryKey^ regkey=Registry::CurrentUser->OpenSubKey("Volatile Environment");
	if(regkey==nullptr) {
		Console::WriteLine("Registry Key not found - aborting");
		return -1;

	Object^ obj;
	array ^keys = gcnew array(4);

	for(int i=0; i<keys->Length;; i++) {
		if(obj!=nullptr) {
			Console::WriteLine(keys[i] + ":" + obj->ToString());
	return 0;

Executing the compiled binary from within the View Desktop Session.

To download the code with Visual Studio project files, click here.

With configuring the group policy for CommandToRunOnConnect and CommandToRunOnReConnect we can execute a command to retrieve physical device and network information, and can pass on this information to any location aware application.

In addition, it enables the new way for Single Sign-On (SSO) access based on “where you are”.

For Configuring Group Policy for CommandToRunOnConnect and CommandToRunOnReConnect refer to my previous blog post –

For detailed information on Location Awareness in VMWare view refer to

Running Scripts/Commands on VMware View Desktop Connect/Reconnect

VMware View Connection server comes with set of Administrative Templates (.ADM) for Microsoft Windows Group Policy.

These template files are located at “C:\Program Files\VMWare View\Server\extras\GroupPolicyFiles”

vdm_agent.adm template file is for configuring Virtual Machines running the view agent. This provides an option to specify commands to run on view desktop connect/reconnect.

These templates can be deployed on the Domain Controller or on individual Virtual Machine if you don’t want to apply the configuration widely.

In this blog I am providing steps for configuring Group Policy using the “view_agent.adm” on the Domain Controller.

Login on the Domain Controller.
Open Server Manager and Go to Features -> Group Policy Management
Go Down the forest and expand Domain for which you want to create the configuration.
Right Click on the Group Policy Objects and Click “New” to create new Group Policy Object (GPO).

Right click newly created VMware View GPO and Click Edit to Open Group Policy Management Editor.
Go to the Computer Configuration -> Policies -> Administrative Template.
Right Click Administrative Template and Click Add/Remove Templates

Click on the Add button and select the “vdm_agent.adm” file.

New entry for “Classic Administrative Templates” should be added with this. Expand it and select Agent Configuration.
Find the Settings for “CommandsToRunOnConnect” and “CommandsToRunOnReconnect”.

Command set for the “CommandsToRunOnConnect” is to be run when a session is connected for the first time.
Command set for the “CommandsToRunOnReconnect” is to be run when a session is re-connected after a disconnect.

Double Click on these settings to open up the property window. From here you can enable this setting and specify the command/script to be executed. For testing purpose I am selecting the path to Notepad.exe file.

Specify the same command and enable CommandsToRunOnReconnect.
Finally apply this policy to your Organization Unit or to the entire domain.

Right Click on the Domain or Organization Unit and Click “Link an Existing GPO”.
Select the newly created “VMWare View” GPO and Click OK.

By default, computer Group Policy is updated in the background every 90 minutes, with a random offset of 0 to 30 minutes. Group Policy for the computer is always updated when the system starts. But if you want to do the quick test without restarting your VM.

Login to your VM Session
Press Start Button and Type CMD
Right Click cmd.exe and select Run as Administrator
Now type gpupdate and press enter.

Group policy will now refresh and your changes will be in effect.

You can disconnect and connect back to see how notepad.exe is launched automatically upon connect/reconnect. You can replace notepad.exe with any scripts or commands to do any administrative/automation job.


Getting more advanced with VMware view

Recommendations for managing Group Policy Administrative Template (.adm) files

Running scripts on Connect/reconnect