Link to home
Start Free TrialLog in
Avatar of AD1080
AD1080

asked on

Create Short Cuts at Log-in on Citrix Desktops in Load Balanced Environment

Hi,

Our users log into virtual Citrix sessions via thin clients, which load on one of 2 different virtual servers depending on the current load those servers are under at the time the user logs in.  

We are looking for a way to use some type of scripting to create shortcuts on the user desktop, using the actual server they end up connected to, and also their user name as parameters.  

So if user D4141 logged on, and connected up to Server X01, they would get a shortcut that points to M:\X01\D4141\program.exe

Is there a good, reliable way to achieve this goal.
ASKER CERTIFIED SOLUTION
Avatar of Raheman M. Abdul
Raheman M. Abdul
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AD1080
AD1080

ASKER

Thanks a lot.
Although the points are already awarded, I would not use powershell for this.  Powershell requires a number of .net libraries to be loaded, it generally slower for what is effectively a login time solution.  

The same script as a vbscript will execute much more quickly and transparently.
option explicit

dim wshShell, sServerName, sUserName, oShortCut, sUserProfilePath, sProgramPath

set wshShell = CreateObject ("wscript.shell")
sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")
sServerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%)
sUserProfilePath = wshShell.ExpandEnvironmentStrings("%USERPROFILE%)

set oShortCut = wshShell.CreateShortcut(sUserProfilePath & "\Desktop\MyProgramShortCut.lnk")
oShortCut.TargetPath = "m:\" & sServerName & "\" & sUserName & "\program.exe"
oShortCut.Save()

set wshShell = nothing
set oShortCut  = nothing

Open in new window


And if you want to be 100% sure of it, you would set the script up to read the registry value from HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop" in case of a redirected desktop.

Coralon