KiXtart is an independent script language developed by Ruud van Velsen of Microsoft Benelux. You find KiXtart at http://netnet.net/~swilson/kix/download.htm. It contains a logon script processor and a script language extension for Windows Server 2003. KiXtart lets you query information, set environment variables, modify the registry, and access the file system using a free-form language syntax with many functions that the default command-line prompt does not have.
The KiXtart package comprises several files. Only the main program (Kix32.exe) is needed for Windows Server 2003. It is recommended that the Kix32.exe program file be saved in a system directory that is already linked to the default path. In principle, Kix32.exe can be saved in the same directory as a KiXtart script to be executed. That is all the installation effort required.
KiXtart scripts are simple text files that can be invoked from the local hard drive or a network drive. If KiXtart is used for global logon scripts, Kix32.exe should be located in a network directory.
KiXtart is started by entering Kix32 in the command line or referencing Kix32 as a logon script. One or more script files can be set as Kix32 parameters.
The KiXtart script language has three core components: commands, functions, and macros. It also uses basic operators and special syntax characters. All these are described in the KiXtart documentation delivered with the product.
KiXtart has a free-form language that is independent of capitalization. However, it has become customary to differentiate the core components by spelling—for example, capital letters for commands, initial caps for functions, and all lowercase for macros.
KiXtart commands perform actions such as deleting screen contents, setting text colors, changing font size, or connecting network drives. For instance, the Use command connects and disconnects a network resource.
Expressions for conditional situations are supported by command sequences, such as If—Else—Endif or Select—Case—Endselect. KiXtart supports nested If conditions. To control execution flow, the While—Loop and Do Until commands loop instructions until defined abort conditions are met causing the execution loop to be exited.
Additionally, Gosub or Goto commands can be used for jumping subroutines. The Run command allows executing external programs, and the Call command enables invoking of further KiXtart scripts, similar to the language syntax of standard command-line scripts.
Functions exceed command possibilities and usually need one or more expressions for parameters. The character strings can be included in single or double quotation marks.
Most functions return a character string or a numerical value. They also set the @error value to indicate possible problems that might prevent a script from running properly.
Let us now look at some functions that can handle important tasks for terminal servers.
AddPrinterConnection, DelPrinterConnection Adds or deletes printer connections
AddProgramGroup, AddProgramItem Adds program groups and program icons
EnumLocalGroup, EnumGroup Determines the local and global groups to which a user belongs
LogEvent Writes messages in the systemwide Event Viewer log file
CompareFileTimes, GetFileVersion Supports input and output at file level
If a KiXtart script runs in user context, only personal program groups or user- specific areas of the registry can be modified. Only an administrator has extended permissions granted for relevant scripts.
KiXtart macros provide information such as network addresses or logon servers. The following table lists the most important macros.
KiXtart supports the logical operators AND and OR. You can also use these conditional operators: < (smaller than), <= (smaller than or equal), > (larger than), >= (larger or equal), = (equal), and <> (not equal).
Under KiXtart, several special characters can be used to mark special syntactic constructions. For instance, the dollar sign ($) is used to mark a variable, the at sign (@) specifies a macro, and the percent sign (%) indicates an environment variable.
A brief example can illustrate how a logon script is generated. We are going to verify which group a user belongs to during the logon procedure. Depending on the group, we will assign the file server for the home directory, and we will connect the default printer.
; Check group membership and set the $server variable IF InGroup("marketing") $server = "FILESRV1" ENDIF IF InGroup("development") $server = "FILESRV2" ENDIF ; Assign drive letter u to home directory USE U: "\\$server\@userid" ; Set printer parameters addprinterconnection (\\PRINTSRV\HPLJ22) setdefaultprinter (\\PRINTSRV\HPLJ22)
For the script to run during user logon, it needs to be assigned to the relevant account properties or to be invoked from a conventional logon script. If the KiXtart script is named Klogin.src, the following line applies:
kix32 klogins.src