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. if defined CLIENTNAME goto next
echo This is not a thin client.
GOTO end2. :next
rem Check where thin client is located.
SET v_part_name=%CLIENTNAME:~0,3%
IF NOT %v_part_name%==WBT GOTO :desktop3. 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 settingsgoto :next
:cardiff
rem cardiff settingsgoto :next
:edinburgh
rem Edinburgh settingsgoto :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