Custom Login Script

Sales: 800.456.4522 | Support: 800.888.8075

© 2016 Compulink Business Systems, Inc. All rights reserved.

Compulink’s Custom Login Script: LaunchCBS.cmd PREFACE Normally, users launch Compulink Advantage software via a shortcut to the executable file (.exe) associated with their Compulink Advantage product (i.e. EYECARE, EYEMD, CHIRO, , PODIA, MD, PT, etc).

Certain Environment Variables can be added to the workstation or Remote Desktop User’s profile to determine licensing and location options.

Occasionally, it will be necessary to assign static licenses to workstations that access Twain imaging devices and Lab Equipment interfaces (or merely because they wish to assign licenses per computers or usernames).

Clients using Roaming Profiles (Remote Desktop users which access the Terminal Server from various workstations), may not wish to have a static license applied to their username, but rather to the workstation from which they are accessing the Terminal Server.

In this case, the custom login script can be configured to request the license assigned by computername instead.

The LaunchCBS.cmd file can be configured to assign licenses to computernames based on a CBS.TXT file which can be easily edited for this purpose.

This document will instruct clients how to make use of the LaunchCBS.cmd file and its related CBS.TXT file for customized login procedures.

CBS.TXT FILE The CBS.TXT file determines the variables assigned to computernames when launching Compulink Advantage software via the LaunchCBS.cmd file. Clients can easily edit this document to update their preferred licensing and envornment variable options. This simple text document contains columns relating to Computername, License Variables, Location variables, and mobile option variables. See example below:

COMPUTERNAME CBS CBSWAN DEPT CBSDIR CBSMOBILE ------EXAM A 001 EYE Y N FRONTDESK * * * Y Y OPTICAL B * * Y Y

Per the CBS.TXT file sample content above, If launching the Compulink Advantage software from a computer named: EXAM, the following Environment Variables for that user’s session:

CBS=A CBSWAN=001 DEPT=EYE CBSDIR=Y CBSMOBILE=N Compulink Advantage software will pick up license A, login to location 001, Dept EYE.

If user is physically at computername FRONTDESK, they will be assigned a CONCURRENT (Dynamic) CBS License. If user is physically at computername OPTICAL, Compulink Advantage software will launch with License B.

CBS.TXT LOCATION The CBS.TXT file should be placed in the Domain Controller’s shared Netlogon folder. The launchscript is written to look for the CBS.TXT File in this location.

Custom LaunchCBS.cmd Script| rev.11.2016 1

LAUNCHCBS.CMD FILE The LaunchCBS.cmd file is an advanced scripting file that is able to look at which Computername the user is accessing and assign preferred variables based on its associated CBS.TXT file. Editing of this file is not recommended, unless performed by an Advanced IT Technician completely familiar with the syntax of every line.

Please contact Compulink’s IT Support for assistance with this script.

LAUNCHSCRIPT LOCATION Place the LaunchCBS.cmd file in your Advantage product’s folder (i.e. EYEMD, EYECARE, CHIRO, MD, PODIA, PT,PSYCH, etc.). Create a shortcut on the desktop to the cmd file. The Target should be a UNC path to the file, and the Start in should be the mapped drive\product folder: Target: \\server_IP\sharename\eyecare\LaunchCBS.cmd Start in: \\server_IP\sharename\EYECARE

LAUNCHSCRIPT EDIT - ADVANCED The contents of the LaunchCBS.cmd file should only be edited by Advanced IT Professionals. Below are the contecnts of the script file. The highlighted contents must be edited to match the client’s environment.

@ECHO OFF REM **SET THE 'PRODUCT' ENVIRONMENT VARIABLE EQUAL TO THE NAME OF THE COMPULINK SOFTWARE YOU ARE USING SET PRODUCT=EYECARE

REM **SET THESE TWO VARIABLES EQUAL TO THE NETBIOS NAMES OF TWO OF YOUR DOMAIN CONTROLLERS SET SERVER01=DC1_IP_ADDRESS SET SERVER02=DC2_IP_ADDRESS

REM **SET THE 'SHARE' VARIABLE EQUAL TO THE SHARENAME ON YOUR DOMAIN CONTROLLERS WHERE CBS.TXT WILL RESIDE SET SHARE=NETLOGON

REM **TRY CONTACTING ONE OF THE DOMAIN CONTROLLERS IF EXIST \\%SERVER01%\NETLOGON\CBS.TXT GOTO SERVER01 IF EXIST \\%SERVER02%\NETLOGON\CBS.TXT GOTO SERVER02

REM **IF NO DOMAIN CONTROLLERS ARE AVAILABLE THEN FAIL OUT WITH AN ERROR GOTO ERROR :ERROR ECHO !!!!!!!ERROR!!!!!!!! ECHO Problem reading CBS.TXT file from domain controller ECHO Contact IT Department at (800) 888-8075 ECHO. GOTO END

REM **SET THE 'SERVER' ENVIRONMENT VARIABLE EQUAL TO THE AVAILABLE DOMAIN CONTROLLER :SERVER01 SET SERVER=%SERVER01% GOTO LAUNCH :SERVER02 SET SERVER=%SERVER02%

Custom LaunchCBS.cmd Script| rev.11.2016 2

:LAUNCH ECHO. ECHO ***Launching Compulink Advantage*** ECHO.

REM ***CHECK TO SEE IF THEY ARE LOGGING INTO THE TERMINAL SERVER*** IF "%CLIENTNAME%"=="Console" GOTO :LANCLIENTS IF NOT "%CLIENTNAME%"=="" GOTO :TERMINALSERVER

:LANCLIENTS REM ***USE THE 'COMPUTERNAME' ENVIRONMENT VARIABLE FOR LAN CLIENTS*** SET CBSLOOKUP="%COMPUTERNAME%" ECHO LAN Client Login ECHO ------ECHO Local Computername=%COMPUTERNAME% ECHO Local Username=%USERNAME% ECHO. ECHO Local *.DS files under C:\Windows\TWAIN_32: ECHO ------DIR C:\WINDOWS\TWAIN_32\*.ds /s/b GOTO LOOKUP

:TERMINALSERVER REM ***USE THE 'CLIENTNAME' ENVIRONMENT VARIABLE FOR WAN CLIENTS*** SET CBSLOOKUP="%CLIENTNAME%" SET TWAINWAN= ECHO Terminal Server Session Login ECHO ------ECHO TWAINWAN=%TWAINWAN% ECHO Remote Client Computername=%CLIENTNAME% ECHO Terminal Server Username=%USERNAME%

:LOOKUP REM ***CLEAR VARIABLES TO BLOCK ANY STATICALLY ASSIGNED VALUES IN SYSTEM PROPERTIES*** SET CBS= SET CBSWAN= SET CBSMOBILE= SET DEPT= SET CBSDIR=

REM ***RUN FIND AND PARSE THE CBS.TXT FILE*** FOR /F "TOKENS=2" %%A IN ('FINDSTR "%CBSLOOKUP%" \\%SERVER%\%SHARE%\CBS.TXT') DO SET CBS=%%A FOR /F "TOKENS=3" %%B IN ('FINDSTR "%CBSLOOKUP%" \\%SERVER%\%SHARE%\CBS.TXT') DO SET CBSWAN=%%B FOR /F "TOKENS=4" %%C IN ('FINDSTR "%CBSLOOKUP%" \\%SERVER%\%SHARE%\CBS.TXT') DO SET DEPT=%%C FOR /F "TOKENS=5" %%D IN ('FINDSTR "%CBSLOOKUP%" \\%SERVER%\%SHARE%\CBS.TXT') DO SET CBSDIR=%%D FOR /F "TOKENS=6" %%E IN ('FINDSTR "%CBSLOOKUP%" \\%SERVER%\%SHARE%\CBS.TXT') DO SET CBSMOBILE=%%E

Custom LaunchCBS.cmd Script| rev.11.2016 3

REM ***LOOK FOR CBS=* AND ALLOCATE TO CONCURRENT LICENSING BY CLEARING THE CBS VARIABLE*** IF NOT "%CBS%"=="*" GOTO :NORMAL SET CBS= :NORMAL

REM ***LOOK FOR VALID CBSMOBILE VALUES. CLEAR THE VARIABLE IF IT IS ANYTHING OTHER THAN 'Y'.*** IF "%CBSMOBILE%"=="Y" GOTO :CBSMOBILE SET CBSMOBILE= :CBSMOBILE

REM ***LOOK FOR VALID CBSDIR VALUES. CLEAR THE VARIABLE IF IT IS ANYTHING OTHER THAN 'Y'.*** IF "%CBSDIR%"=="Y" GOTO :CBSDIR SET CBSDIR= :CBSDIR

ECHO. ECHO CBS Environment Variables ECHO ------ECHO CBS=%CBS% ECHO CBSWAN=%CBSWAN% ECHO CBSMOBILE=%CBSMOBILE% ECHO CBSDIR=%CBSDIR% ECHO DEPT=%DEPT% ECHO COMPUTERNAME=%CBSLOOKUP% ECHO USERNAME=%USERNAME% REM PAUSE

REM ***LAUNCH COMPULINK ADVANTAGE USING THESE VARIABLES START “Compulink” /D \\%SERVER%\%SHARE%\%PRODUCT% %PRODUCT%.EXE

REM ** DISPLAY VARIABLES FOR A FEW SECONDS FOR TROUBLESHOOTING PURPOSES REM ** PLACE THE SLEEP.EXE FILE IN THE \\SERVER\SHARE FOLDER

ECHO. ECHO This window will close automatically in a few seconds... \\%SERVER%\%SHARE%\sleep 8

:END

Custom LaunchCBS.cmd Script| rev.11.2016 4