FASTTRACK SCRIPTING HOST
Components
This topic is covered in greater detail in Chapters 2 & 4 of the FastTrack Users Guide:
About the engine
The FSH Engine is the core of FastTrack Scripting Host 2010. It is the FSH Engine that processes and interprets Scripts, translating commands and functions into the many hundreds of lines of code needed to actually perform the tasks specified.
The engine is installed into the fshbin folder when FastTrack Scripting Host 2010 is installed. The FSH Engine is an executable file called fsh.exe and it runs just like any other Windows program.
A Script file can be run on a computer simply by specifying it on the command line with the engine. For example:
The engine is fsh.exe and the Script file (in this example) is InstallProgram.fsh, which is the single parameter passed to the engine.
The FSH Engine must be available to any computer that wants to process FSH Scripts. This can be achieved seamlessly for logon Scripts by simply installing folder fshbin (which contains the engine) into the NetLogon folder on the domain server for a network.
Using the engine to record network logon faults
The engine has two parameters related to the way faults are handled. In general there is a distinction between Script syntax errors and runtime errors:
- <!--[if !supportLists]-->Syntax errors are picked up before a Script is saved and executed. Errors are displayed to the Script Writer, so the offending lines can be corrected.
- <!--[if !supportLists]-->Runtime errors are not picked up until a Script executes. The default behaviour is to stop Script execution and run the error-handler Script.
If an error-handler Script file (called ErrorHandler.fsh) exists in the same directory as the engine, it gets executed when a fault occurs.
The error-handler Script is especially useful with logon Scripts. Creating the single line shown in Figure 2.1 in the Script ErrorHandler.fsh appends all logon execution errors for all Users on a network to a log file (in this example, called NetworkErrors.log in shared folder ITShare).
This single FSH command provides a comprehensive overview in one file of all logon errors occurring on a network.
Figure 2.1 Sample line in ErrorHandler.fsh
The FSH Engine is provided in the download package.
About the editor
The FSH Editor is an integrated development environment (IDE), with a standard and familiar look-and-feel, similar to Microsoft’s Visual Studio. Among the features supported by the editor are keyword recognition, syntax highlighting, context-sensitive help and guided completion.
Figure 2.2 shows a typical screen view of the FSH Editor:
Figure 2.2 The FSH Editor

The first time the FSH Editor is started, a demo Script is opened, which can be run from within the editor by pressing function key F5. The demo Script showcases some of the many capabilities provided by FastTrack Scripting Host 2010.
As well as executing a Script from within the editor using F5, a Script can be run in debug mode using F6. Running in debug mode enables a Script Writer to step through the Script and see exactly how it will be interpreted at runtime.
The FSH Editor is provided in the download package.
Elements of the editor
- <!--[if !supportLists]-->Script Window – this is the main part of the editor and takes up most of the editor screen space. It appears in the top center of the screen, immediately below the toolbar.
- <!--[if !supportLists]-->Engine Browser – the Engine Browser is a tree or hierarchy in the top left of the screen that shows all the commands, functions, collections and conditions available to be included in Scripts.
- <!--[if !supportLists]-->Property Builder – this is a dialog window that opens to help add the correct parameters. The Property Builder is opened when an item is double-clicked in the Engine Browser tree, as shown in Figure 2.3.The Property Builder can be disabled via the Properties Panel, for Script Writers who prefer to write parameters directly into the Script. If this property is set, a template is copied into the Script instead.
Figure 2.3 The FSH Editor Property Builder

- <!--[if !supportLists]-->Context Helper – the Context Helper appears below the Script Window and shows a full explanation of the item currently under the cursor in the Script Window, or marked in the Engine Browser tree. For example, to execute a program, locate the Run command in the Engine Browser and double-click it to insert that command into the Script at the cursor position. Alternatively, simply click and drag it into the Script.
- <!--[if !supportLists]-->Properties Panel – the Properties Panel is shown in the bottom right of the screen. This is where key settings for the editor, the engine and the current Script can be changed.
- <!--[if !supportLists]-->Recent Files Panel – this panel is shown in the top right of the screen and lists the Script files most recently opened.
Features of the editor
- <!--[if !supportLists]-->Syntax highlighting – the editor automatically indicates syntax highlighting on commands, functions, collections, conditions and loops (which are all explained later in this document).
- <!--[if !supportLists]-->Context-sensitive help – when moving the cursor around within a Script, the editor senses what is being done and automatically displays an explanation in the Context Helper.
- <!--[if !supportLists]-->Auto correction – as text is entered in the Script Window, the case (i.e. capitalization) is automatically adjusted. For example, the command splash is automatically corrected to Splash with a capital S.
- <!--[if !supportLists]-->Code completion – in Figure 2.2, at line 55 in the Script Window, co was typed and five commands are suggested.
- <!--[if !supportLists]-->Script validation – when a Script is saved or executed, a simulated run is performed to validate that there are no syntactical errors in the Script, such as a missing parameter. This ensures that a mal-formed Script is not accidentally saved.
If the Script cannot pass a simulated run, the Script Writer is notified and the line where the problem was found is identified. This means that an invalid Script cannot be saved or executed.Note:
There is a way around this check. In the Properties Panel, there is a setting Validate Before Save. Uncheck this setting to prevent the editor from performing the simulated run prior to saving a Script. There is also a checkmark button in the toolbox that can be clicked to check a Script before (or without) saving.
- – the FSH Editor is completely customizable. It is possible to change the skin (i.e. look and feel) and move panels just as can be done within Visual Studio. Figure 2.4 shows the editor where the Properties Panel is about to be docked.
Figure 2.4 Docking the Properties Panel in the FSH Editor

Language comparison for Script editor features
The FSH Editor has many more features than are provided natively with VBScript and PowerShell. Figure 2.5 compares the features of all three products.
Figure 2.5 Working with Scripts using FSH, VBScript and PowerShell
About FastTrack Logon
FastTrack Logon replaces logon .bat and .cmd files, and can also replace .wsh Scripts. Users logging on see a customizable graphics screen and run a powerful set of commands, all without requiring deployment to the client computers.
All that is needed is a 50kb FastTrack Logon file FTLogon.exe in the domain NetLogon directory and an update of User profiles to point logon Script to this executable. FastTrack Logon then automatically distributes the FSH Engine and all Scripts to client computers for execution when Users log on. FastTrack Logon can also be configured via Group Policy and Active Directory for large numbers of Users in enterprise or department groups.
FastTrack Logon is very simple and it works for all 32-bit and 64-bit Windows operating systems; desktop operating systems (Windows NT4/2000/XP/Vista/7), server operating systems (Windows Server 2000/2003/2008) and terminal server and Citrix sessions.
How does it work?
The process is straightforward – extract all files from FTLogon.zip into the NetLogon share on the domain controller and point the Users' logon Scripts to FastTrack Logon. When it is executed, it will do the following on each client computer:
<!--[if !supportLists]-->· <!--[endif]-->Synchronize the engine Fsh.Exe and logon Script files to Local Settings\Application Data\FastTrack in each User’s non-roaming part of the profile.
<!--[if !supportLists]-->· <!--[endif]-->Execute the predefined logon Scripts from this client location.
<!--[if !supportLists]-->· <!--[endif]-->Associate the .fsh extension to the profile copy of Fsh.exe.
The first time each User logs on to a client computer, about 1 MB of data is copied from the domain controller to the non-roaming part of the User’s profile. After that, copying happens only when the files in the fshbin folder are changed on the domain controller – anything put into the fshbin directory on the domain controller will be synchronized to each client computer.
There is no limitation on the files and directories that can be put under fshbin on the domain controller. A Windows Active Directory is not a requirement; FastTrack Logon also works for domains without Active Directory.
The local copy of the files and the file association is per User, because this way no further work is required for client computers to support FSH Scripts in general in each User’s context. There is no need for a per-machine deployment and the User is not required to be a local administrator. The client location of files can be customized, if they need to be placed somewhere else.
File and folder structure
The FastTrack Logon package is a compressed zip file called FTLogon.zip, installed by default into <Program Files>\FastTrack Software\FastTrack Scripting Host when FSH 2010 is installed. It contains the FastTrack Logon program FTLogon.exe, SmartDock and the sample Scripts.
When installation is complete, including obtaining a license file and extracting the FastTrack Logon package, the following two file and folder structures are created (assuming default installation locations).
1. Folder <Program Files>\FastTrack Software\FastTrack Scripting Host
This structure is created after running the installation program Setup.exe and applying a license file:
<!--[if !supportLists]-->· <!--[endif]-->DemoScript.fsh
<!--[if !supportLists]-->· <!--[endif]-->Editor.exe
<!--[if !supportLists]-->· <!--[endif]-->Fsh.exe
<!--[if !supportLists]-->· <!--[endif]-->Fsh.lic
<!--[if !supportLists]-->· <!--[endif]-->Fsh.pk
<!--[if !supportLists]-->· <!--[endif]-->FTLogon.zip
2. Share name \\<Domain Server>\NetLogon
This structure is created after extracting FTLogon.zip into the domain NetLogon share and copying the license file into the fshbin folder:
<!--[if !supportLists]-->· <!--[endif]-->Fshbin (folder)
<!--[if !supportLists]-->§ <!--[endif]-->ErrorHandler.fsh
<!--[if !supportLists]-->§ <!--[endif]-->Fsh.exe
<!--[if !supportLists]-->§ <!--[endif]-->Fsh.lic
<!--[if !supportLists]-->§ <!--[endif]-->PostInstall.fsh
<!--[if !supportLists]-->§ <!--[endif]-->PostLogon.fsh
<!--[if !supportLists]-->§ <!--[endif]-->PostUninstall.fsh
<!--[if !supportLists]-->§ <!--[endif]-->PreLogon.fsh
<!--[if !supportLists]-->§ <!--[endif]-->SmartDock.exe
§ SmartDock.fsh
<!--[if !supportLists]--><!--[endif]-->
<!--[if !supportLists]-->· <!--[endif]-->FTLogon.exe
· ftlogon.ini
<!--[if !supportLists]--><!--[endif]-->
About SmartDock
SmartDock is a small executable program, called SmartDock.exe, which detects whenever the IP settings of any network adapter change on a computer.
In programming jargon, an IP address settings change is known as an event – once such an event is detected, SmartDock can execute a Script called SmartDock.fsh.
SmartDock can run in any of the following scenarios:
- <!--[if !supportLists]--> <!--[endif]-->start-up or reboot
- <!--[if !supportLists]-->resume from standby
- <!--[if !supportLists]-->connection to a virtual private network (VPN)
- <!--[if !supportLists]-->connection to a wireless network
- <!--[if !supportLists]-->manual change of IP address settings
- <!--[if !supportLists]-->any other scenario where the IP settings are changed
For any event where IP settings change, SmartDock.exe runs and triggers the execution of SmartDock.fsh.
Why is SmartDock useful?
Users of portable computers often put their computers into standby or hibernation at one location and then resume the session somewhere else, such as moving from a work network to a home environment.
With SmartDock, both Users and Network Administrators have control over what happens every time the computer is resumed or connects to a network. The SmartDock tool is a good supplement to domain logon Script for portable computers.
Running SmartDock
What actually happens when SmartDock executes (i.e. when the commands and functions in SmartDock.fsh are interpreted) is entirely up to the Script Writer.
A SmartDock Script is no different from any other FSH Script – the default name of SmartDock.fsh simply means that it is the Script executed when SmartDock.exe is triggered.
SmartDock is useful for portable computers that roam. Setting or removing proxy server settings based on whether or not the computer is on a LAN would be one thing to do instead of using the Internet Explorer auto detection mechanism. Another use could be connecting or disconnecting common shares and local printers. Think of the SmartDock Script as an offline supplement to the logon Script.
An executable program, not a service
SmartDock is not a Windows Service but a small executable file. The reason for this is simple; if it was a Windows Service, it could not run in the User's context and then it would be worthless to both Users and Network Administrators. It would be impossible to set proxy server settings, changing default printers and all the other things that are related to a particular User.
A sample SmartDock Script is included later in this chapter under Sample Scripts.
SmartDock is provided in the download package.
Included in the download package
Several sample Scripts are provided in the download package for FSH 2010. As well as the demo Script, these include a sample logon Script (both pre- and post-Windows explorer service), several installation Scripts, an error-handling Script and a SmartDock Script.
Demo Script
DemoScript.fsh

Logon Scripts
Pre-Windows explorer.exe process
PreLogon.fsh

Post-Windows explorer.exe process
PostLogon.fsh

Installation Scripts
PostInstall.fsh

PostUninstall.fsh

Error-handling Script
ErrorHandler.fsh

SmartDock.fsh

<<< For more, please consult Chapters 2 & 4 of the FastTrack Users Guide. >>>


