|
|
Page Last Updated: 21/02/2010 Machine Identification
|
This information was originally on our community
site amset.info, and you may have been
redirected to this site by following a link to a URL
on that domain. This is the same information, from
the same source, just in a new location.
|
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.
- 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.
- 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.
- Then the location code is checked and the script sends them off to the relevant locations.
- If the script has managed to get through the other traps, then a message is sent to the screen.
- 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 settingsgoto :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
About this site
This information originally started life as a page on amset.info, our community assistance site. However that site is targeted at Microsoft Exchange server, as Sembee Ltd. is a Microsoft Exchange consultancy. Therefore it was moved to its own domain in early 2010. Traffic from amset.info is directed here.
Other sites that are owned and operated by Sembee Ltd include kbsearch.info, certificatesforexchange.com, dosprompt.info, office-recovery.info, wuauclt.info, blog.sembee.co.uk, exbpa.com and amset.info.
|