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.

References:

Getting more advanced with VMware view
http://vmguy.com/wordpress/index.php/archives/1144

Recommendations for managing Group Policy Administrative Template (.adm) files
http://support.microsoft.com/kb/816662/en-us

Running scripts on Connect/reconnect
http://www.thatsmyview.net/2009/04/24/running-scripts-on-connectreconnect/

Advertisements

One thought on “Running Scripts/Commands on VMware View Desktop Connect/Reconnect

  1. Pingback: Getting Endpoint Device Information within VMware View Desktop « Divyen Patel's weblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s