As we discussed in Part 1, if an application is storing user specific data in the application folder or on some other location on the client machine, this application will not behave as expected on XenApp.
To address this issue, we might have to revisit the application design for storing the user specific data to the user’s roaming profile. Sometimes it is not feasible to change the application quickly for such issues.
The workaround to address this issue is to write some script that will copy the user specific data from client machine to the user’s roaming profile and then the same script will launch the application for the user.
Below is the VBScript to do the same. This VBScript copies the user specific data from some temporary location to the user’s roaming profile location. Once it copies the file, it runs the application.
'##############################################################################
'#
'# Language VBscript
'#
'# Author Mohd Aslam
'# Date 10.18.09
'# Description A script that copied user specific configuration file
'# from application folder to the roaming profile.
'##############################################################################
Dim objFSO, WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")
strDirectory = WshShell.ExpandEnvironmentStrings("%Homeshare%")
& "\Application Data"
if Not ObjFSO.FolderExists(strDirectory) Then
Set objFolder = ObjFSO.CreateFolder(strDirectory)
End If
strDirectory = WshShell.ExpandEnvironmentStrings("%Homeshare%")
& "\Application Data\Notepad"
if Not ObjFSO.FolderExists(strDirectory) Then
Set objFolder = ObjFSO.CreateFolder(strDirectory)
End If
Source = "C:\temp\Notepad\"
Destination = WshShell.ExpandEnvironmentStrings("%Homeshare%")
& "\Application Data\Notepad\"
Filename = "Notepad.xml"
'***************************************************************
' Execute Procedures
'***************************************************************
On Error Resume Next
'First copy the file from application folder or some temp location
'to the roaming profile.
If Not ObjFSO.FileExists(Destination & Filename) Then
ObjFSO.CopyFile Source & Filename, Destination & Filename
End If
' execute the application
Wshshell.Run "c:\Windows\notepad.exe"
In XenApp, we just need to publish this VBScript.
It can be published in XenApp as shown below:
Important point to be noted is that the application should have some way to know where the user’s specific data is stored on roaming profile. By this I mean, application should be configured to look for the user’s data from the roaming profile.
If application is hardcoded to look for the user’s data from some specific location only then application virtualization [application streaming/isolation] could be the only solution as there we can implement the redirection rules to point to the correct location.