«

»

Dec 26 2011

VMware View Remote Agent Install using PowerCLI

VMware View in it’s full sense is a connection brokering solution that also create virtual desktops in vCenter Server to be consumed by entitled users. However, users can access VMware View desktops delivered by physical Windows XP/7/2K8 machines that are not managed by vCenter Server, or virtual Windows Server 2K8 managed by vCenter server. Unamanaged desktop sources can include physical computers, terminal servers, and virtual machines running on VMware Server and other virtualization platforms.  Those desktops are assigned to a Manual or Terminal Services Pools.

 

image

I have been recently tasked with delivering automation and orchestration that goes beyond VMware View capabilities today. As part of this PoC I have been working with EMC resident enterprise management and PowerShell Guru Clint Kitson @clintonskitson to address few of the shortcomings.

The tidbits I am posting during the next few articles are a small part of a bigger automation and orchestration piece that will become more clear as we move forward. The main idea is to  automate the creation of vAPPs containers and make them accessible directly via VMware View without jump box requirement (that should give you an insight on what we are trying to accomplish but I will write more on that later).

 

After creating a Manual Desktop Pool the administrator must prepare an unmanaged desktop source to deliver VMware View desktop access. You must install View Agent on an all unmanaged desktop sources. VMware View cannot manage an unmanaged desktop source unless View Agent is installed. The install can be done interactively or silently, however must be done locally.

Important Note: Windows Server 2008 that is managed by vCenter Server is considered by VMware View as an unmanaged resource. Managed resources can only be Windows Desktop versions such as XP and 7.

This example installs View Agent on an unmanaged computer and registers the desktop with the specified View Connection Server. The installer configures the SSO, Virtual Printing, and USB redirection custom setup options.

VMware-viewagent-y.y.y-xxxxxx.exe /s /v"/qn VDM_VC_MANAGED_AGENT=0 VDM_SERVER_NAME=cs1.companydomain.com VDM_SERVER_USERNAME=admin.companydomain.com VDM_SERVER_PASSWORD=secret ADDLOCAL=Core,ThinPrint,USB"

Read the article I previously published at VMware View 4.5 Command Line Usage

 

The following assumes you are logged into PowerCLI and have done a Connect-VIserver to get access to VM resources. The sample below makes use of PowerCLI Invoke-VMScript and Copy-VMGuestFile cmdlets to copy and install the View Agent remotely.

 

1) Set all of the variables

$vmname=“VMname”

$agentpath="\\connserver\install\VMware-viewagent-x86_64-e.x.p-443491.exe"

$file=$agentpath.split(‘\’)[-1]

$destinationpath="c:\"

$destinationfilepath="$($desinationpath)$($file)"

$viewConnServer="connserver"

$viewAdminUser="administrator"

$viewAdminPassword="password"

$viewAddLocal="Core,PCoIP"

$desktopGuestUser="administrator"

$desktopGuestPassword="password"

 

2) Attempt to copy the Agent to the remote system

 

try {

get-item$agentpath|copy-vmguestfile-destination$destinationpath-vm$vmname-guestuser$desktopGuestUser-guestpassword$desktopGuestPassword-localtoguest-eastop

} catch {

    "Failed to copy agent";$error[0]

} 

 

3) Check to make sure VMTools is running

 

Do{

$status=Get-vm$vmname|%{ $_.guest |%{ $_.extensiondata.toolsrunningstatus } }

} until ($status–eq  "guestToolsRunning")

 

4) Set the scriptblock with parameters for VMware View Agent installer


$script
=‘"’+$destinationfilepath+‘" /s /v"/qn VDM_VC_MANAGED_AGENT=0

VDM_SERVER_NAME=’+

              $viewConnServer+‘ VDM_SERVER_USERNAME=’+$viewAdminUser+‘ VDM_SERVER_PASSWORD=’+

              $viewAdminPassword+‘ ADDLOCAL=’+$viewAddLocal+‘"’

 

4) Attempt to remotely start VMware View Agent

 

try {

    Invoke-VMScript-ScriptText$script–VM$vmname-guestuser$desktopGuestUser-guestpassword$desktopGuestPassword-ScriptTypebat-eastop

} catch { if ($error[0]-match"the guest operations agent") { "View Agent kicked off a reboot"} else { $error[0] } }

 

 

Clint Kitson has published this initial PowerShell script on his blog http://velemental.com/2011/12/25/installing-vmware-view-agent-remotely-using-powercli/

Similar Posts:

Permanent link to this article: http://myvirtualcloud.net/?p=2573

2 pings

  1. - Cliff Davies

    [...] first bits that Client created you will find at VMware View Remote Agent Install using PowerCLI. Clint now delivered in his blog the second automation piece in format of PowerShell [...]

  2. - Cliff Davies

    [...] Additionally, we wanted to provide users with an easy and seamless way to access each individual Lab (vAPP) without having to jump between console screens. For this reason we included a Windows 7 VM in each vAPP and scripted (PS) the sysprep process and the inclusion of that VM into VMware View desktop pools. I hinted that in my post  VMware View Remote Agent Install using PowerCLI. [...]

Leave a Reply