Login Scripts
Machine Identification

In Citrix or Microsoft Terminal Server environments it can be useful to detect what machine the client is connecting from. With Citrix and TS installations, the users might move around but the terminals themselves stay put.

In this example, there are thin clients in three offices - London, Cardiff and Edinburgh. Each thin client is named WBT<location letter>-<asset number> where <location letter> is the first letter of the place name (l, c or e) and asset number is a five digit number.
Note: Numbers in the notes correspond with the numbers down the side of the example script.

  1. The script was written for a Citrix server, so it first checks whether the variable "Clientname" has been set. If it hasn't then it probably means some one logging in to this domain from a normal computer (not a Citrix/thin client) and skips a lot of the script.
  2. The next part is checking what the location letter is.
    Of this section, the first line detects whether the first three letters are WBT, which further weeds out any desktops - for example people using the Citrix client from their own machine. You may want to adjust the naming of the host in the Citrix client to reneable this functionality. 
  3. Then the location code is checked and the script sends them off to the relevant locations.
  4. If the script has managed to get through the other traps, then a message is sent to the screen.
  5. The destination of the script
    If desired the script can be combined with other login script commands, such as ifmember which could be used to further control the access to the printers and drive mappings.
    Remember to put in a "goto" command to skip the rest of the location based information. Otherwise the script will just continue moving down and will execute the next set of commands as well.
1. if defined CLIENTNAME goto next
echo This is not a thin client.
GOTO end
2. :next

rem Check where thin client is located.

SET v_part_name=%CLIENTNAME:~0,3%
IF NOT %v_part_name%==WBT GOTO :desktop
3. SET v_part_name=%CLIENTNAME:~0,4%
IF %v_part_name%==WBTL GOTO :london
IF %v_part_name%==WBTC GOTO :cardiff
IF %v_part_name%==WBTE GOTO :edinburgh
 
4 net send %username% "Your thin client doesn't have location information. Get the configuration checked"
5. :desktop
rem desktop settings

goto :next

:london
rem london settings

goto :next

:cardiff
rem cardiff settings

goto :next

:edinburgh
rem Edinburgh settings

goto :next

:next

:end


Complete Sample - Ready to Copy and Paste.

Remember to turn off word wrap when working in notepad


Top of the Page - Home Page
Last Page Update: 28/03/2015

Copyright Sembee Ltd. 1998 - 2024.

Reproduction of any content on this web site is prohibited without express written consent. Use of this web site is subject to our terms and conditions.

All trademarks and registered trademarks are property of their respective owners. This site is not endorsed or recommended by any company or organisation mentioned within and is to provide guidance only and as such we cannot be held responsible for any consequences of following the advice given.

Sembee Ltd. is registered in England and Wales at 1 Carnegie Road, Newbury, Berkshire, RG14 5DJ.
Registered company number: 4704428. VAT Number GB 904 5603 43.

Server 1