Saturday, January 28, 2012

Automating VMware View Client logon with Active Directory credentials on a Windows workstation

The client I’m currently working with is trying to extend the life of their desktops that was around since I was still attending university and slowly move to thin-clients as they require replacement and one of the tasks this weekend was to automate the login process to their VMware View 5.0 virtual desktops upon logging into Windows with their Active Directory credentials.  First off, the lesson I learned is not to use a server to do any testing as I had plenty of issues with the correct syntax for the VMware View Client to automatically login.

The method I used to automate the logon process was the switches accepted by the VMware View Client’s executable as the options provided by the adm file via GPO was too confusing for me.  The following are the switches available for VMware View Client (wswc.exe) which is located in the following directory:

C:\Program Files\VMware\VMware View\Client\bin\

Command line option must be followed by an option name

VMware View Client 5.0.0 build-481677 command line usage:
-desktopName XXX         Desktop to autostart
-domainName XXX          Domain for server login
-file XXX                File with additional command line parameters
-languageId XXX          LCID of language to use (if available), e.g. 0x409 for
English
-nonInteractive          Suppress error message boxes for fully scripted startup

-password XXX            Password for server login
-smartCardPIN XXX        PIN for smart card login
-desktopProtocol XXX     Attempt to use the specified desktop display protocol
-desktopLayout XXX       Specify desktop screen size (e.g. fullscreen, multimoni
tor, windowLarge, or windowSmall)
-serverURL XXX           URL for the View Connection Server
-logInAsCurrentUser XXX  Log in as current user (true or false)
-userName XXX            User name for server login
-unattended              Start in unattended mode. Connects to the entitled desk
top without user interaction
-connectUSBOnStartup XXX Connect all USB devices to a desktop when it is launche
d (true or false)
-connectUSBOnInsert XXX  Connect a USB device to the foreground desktop when the
device is plugged in (true or false)
-printEnvironmentInfo    Print information about the system
-rollback                Rolls back a check out (need -desktopName)
-confirmRollback         Confirm rollback operation in non-interactive mode
-?                       Show this help
Option names are case insensitive.

VMware’s documentation of the switches can be found here: http://pubs.vmware.com/view-50/index.jsp?topic=/com.vmware.view.administration.doc/GUID-C6E7AF06-1D9F-4096-8753-D6F6C7B58DB1.html

image

Note that all of the switches are CASE SENSITIVE so if you make a minor mistake in the capitalization, the switches will fail.

The command with switches I used is as follows:

C:\Program Files\VMware\VMware View\Client\bin\wswc.exe -desktopName "Some Desktop Name" -serverURL https://virtualdesktops -logInAsCurrentUser true

Note that I have highlighted the custom parameters in RED so please change them as required.  Also note that if your virtual desktop’s name has spaces, use the quotes to enclose the name.

Test the command on a desktop with the VMware View Client installed with the switches to ensure that the auto logon works and fire up Group Policy Management Console on a domain controller.  Assuming that you have your desktop computer objects already in an OU (we’re going to apply a GPO to computer objects and not the user), you can proceed with creating a GPO linked to the OU with the desktops:

image

Once the GPO has been created and linked, proceed with editing it and navigate to:

Computer Configuration –> Administrative Templates –> System –> Logon –> Run these programs at user logon

image

Open the Run these programs at user logon‘s settings, click on the Enabled radio button and then click on the Show button:

image

Click on the Add button to open up the Add Item window:

image

Within the Add Item window, add the path to the VMware View Client’s executable and include the switches:

image

Click the OK button to confirm:

image

Continue to click the OK buttons to exit out of the policy settings:

image

Log onto a desktop and test the login:

image

2 comments:

Ben Medes said...

Just to expand on this, I wanted to create a shortcut on my workstations to open specific linked pools as a specific user. Here is the batch script I use that even saves credentials:

> C:\Windows\System32\runas.exe /user:domain\username /savecred "C:\Program Files\VMware\VMware View\Client\bin\wswc.exe -serverURL https://serverurl -logInAsCurrentUser True -logInAsCurrentUser True -desktopName 'Pool Name' "

Hopes this helps someone!

Dan Rutter said...

Great post Terence - I just used your instructions to automate the login for my department!