XenApp – User’s Drive Mapping to shared locations


Scenario: In the traditional application access methodology, applications used to be installed on the client machines and when the user need some shared locations to be accessed from the application like for importing or saving some files to those locations, they use to map those location to some drives beforehand and thus they were able to access those shared locations from the application.

In the application virtualization, in SBC [Server based computing], all the applications are installed and run from the remote XenApp in the user’s session. By user’s session, I mean, when user connects to the remote application using XenApp client like web client, memory is allocated to the users where they can access applications, printers etc and whatever changes they did, those get saved to the roaming profile once they logs out from their session.

Now even if the application is installed and running from the remote servers, the users want their shared/mapped drives. To make this happen, we have to map the drives to the required locations during the application launch in the User’s session. We can use the below VBScript to map the drives before application launch. 

'##############################################################################
'#
'# Language     VBscript
'# Script Name  Sample Script for XenApp   
'# Version      1.0
'#
'# Author       Mohd Aslam
'# Date	     09.17.09
'# Description  This script maps drives to the required locations, then  
'#              executes the notepad program.
'#
'##############################################################################
On Error Resume Next
Dim objFSO, objNetwork, WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
set ObjFSO = CreateObject("Scripting.FileSystemObject")
set objNetwork = CreateObject("WScript.Network")
'-----------------------------------------------------------------
'If the "P" drive is already mapped, disconnect the mapping
 If (objFSO.DriveExists("p:")) Then
 objNetwork.RemoveNetworkDrive "p:", True, True
 End If
'-----------------------------------------------------------------
'Map the "P" drive to the required directory
 objNetwork.MapNetworkDrive "p:", "\\abcd\test\"
'-----------------------------------------------------------------
'Execute the Notepad program
 WshShell.Run "c:\Windows\notepad.exe",0,True
'-----------------------------------------------------------------

This VBScript is first checking if the drive that is supposed to be mapped, is available or not. If it is already mapped, it is disconnecting it and then mapping to the required location.

Once mapping is done, next step will be to launch the application.

Note: This VBScript should run in user’s session. This means that instead of publishing the application, we need to publish this VBScript. This VBScript will in turn call the application.

Result: After the successful execution of the VBScript, application will be launched and all the required drive mappings will be available to the users.

Advertisements

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