I have revised my KIX login script for Remote Desktop Services Server (Terminal Server) post last week. This is also a revised/update of my original post: KIX login script to map printers, network drives and setting changes.  Here is what the revised script looks like:

Firstly, there are a total of three scripts here.

  1. The Logon_new.bat batch file which all users have set as their login script. This script simply executes the KIX32.exe command to run the Logon_new.kix file
  2. The Logon_new.kix first maps company wide drives, then determines if the Workstation that the user is logged into is one of the Remote Desktop Services server, it will then execute Logon_RDSServer.kix. Otherwise continue on with the rest of the script
  3. The Logon_RDSServer.kix is settings specifically for the Remote Desktop Services (Terminal Serices) server and will only run if two conditions are met.

The logic behind why I did this is because I wanted everyone to have the SAME Logon_new.bat file as their login script. This keeps everyone’s Active Directory account consistent so if a user needs to have a specific drive or access to an application, we know that everyone’s settings are set in that login script.  Normal users will then have the same Logon_new.kix file and if the user is logging into a different environment – eg: Remote Desktop Services (Terminal) server, then they will have the Logon_RDSServer.kix login script instead. However, everyone starts with the same Logon_new.bat file as the initial login script.

The Logon_new.bat file contains only one line: %0\..\kix32 %0\..\Logon_new.kix
This simply calls on the KIX32 executable (which has to be in the same folder as this file and is generally stored on the \\SERVER\Netlogon share) to run the Logon_new.kix file.

The Logon_new.kix file is the Kixtart script which contains the following (which I will explain in detail):


This line says if the user is a member of the “Drive_G” security group, then map the G: drive to the share \\SERVER\general

If InGroup(“Drive_G”)
        Use G: “\\SERVER\general”


This line says if the workstation (ie: hostname of the computer) that the user is logged into is called PRODRDSH01 or PRODRDSH02 or DRRDSH01 or DRRDSH02, then run the Logon_RDSServer.kix script file then exit out of the rest of the Logon_new.kix file


 Call @ScriptDir + “\Logon_RDSServer.kix”


Note the ORDER where the commands are in the kix file is important. Because everyone will have the same drive mappings regardless if they are logging into their laptop/desktops or a RDS/Terminal Server, the network drive mappings is BEFORE the IF statement that directs the user to use the Logon_RDSServer.kix file if the user is logged into a RDS/Terminal server . This just means if you need to change network drive mappings, you only do this on the one Logon_new.kix file. If you moved the command Call @ScriptDir + “\Logon_RDSServer.kix” to the top then you would skip the rest of the commands so you’ll have to create a Map Network Drive command on the Logon_RDSServer.kix file as well as the Logon_new.kix file.


The next command in the Logon_new.kix file (this part of the script will only run if the user is not on the RDS/Terminal Server now) says if the user is part of the “HeadOffice_PRINTERS” security group, they will get both the HeadOffice_DocuCentre_2260 and HeadOffice_HPLaserJet_5200 printers mapped for them (which is on the server called “PRINTSERVER”):

If InGroup(“HeadOffice_PRINTERS”)

The command below says if the user is part of the “Default_HeadOffice_HPLaserJet_5200” security group, then set the printer HeadOffice_HPLaserJet_5200 as the user’s default printer. This command will only work if the printer is already mapped for the user so it’s important that the printer is mapped BEFORE the SETDEFAULTPRINTER command runs.

If InGroup(“Default_HeadOffice_HPLaserJet_5200”)


As we haven’t moved everything across from our old .vbs login script yet, I had this line below which then executes the old .vbs login script as well so nothing gets missed.

If InGroup(“Old_Login_Script”)
 SHELL ‘wscript \\SERVER\netlogon\logon.vbs’


Continued on Page 2 –>

GD Star Rating
GD Star Rating

Related Posts: