Solved

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

Posted on 2014-12-22
3
217 Views
Last Modified: 2014-12-23
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.
0
Comment
Question by:AD1080
3 Comments
 
LVL 18

Accepted Solution

by:
Raheman M. Abdul earned 500 total points
ID: 40514749
You can use this powershell script to run at startup to create the shortcut on the desktop:

$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\ProgramShortcut.lnk")
$server=hostname
$user=[Environment]::UserName

$Shortcut.TargetPath = "M:\$server\$user\program.exe"
$Shortcut.Save()

Open in new window

0
 

Author Closing Comment

by:AD1080
ID: 40515060
Thanks a lot.
0
 
LVL 23

Expert Comment

by:Coralon
ID: 40515853
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
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
When we have a dead host and we lose all connections to the ESXi, and we need to find a way to move all VMs from that dead ESXi host.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now