Home
Solutions
Download
Purchase
Documentation
Get Help
Reseller
My Account
Testimonials
Customers
Contact
Fasttrack Global

SmartDock - offline logon scripts

SmartDock is a small free exe file that detects whenever the computer changes IP address of any network adapter.

Once an IP address change is detected, SmartDock executes a FastTrack script. This means that whenever the computer is booted, resumed from standby, connected to VPN or a wireless network, or any other scenario where the computer changes IP settings, it triggers the execution of a script. This is very handy for portable computers that roam. What the script does is entirely up to you.

Examples of script content could be setting or removing proxy server settings based on whether the computer is on a LAN or not, instead of relying the quirky IE auto-detection mechanism. Or it could be connecting or disconnecting work shares.

A similar execution tool called SmartConnect for executing a printer remapping script when a remote session is re-established is available here.

Setup execution

SmartDock is not a Windows Service but a small exe file. The reason for this is simple: If it was a Windows service, it would not run as the current user and would then be worthless - and there would also be an installation step in such cas. It would be impossible to set proxy server settings, change default printer, connect user shares and all other things that are related to the user, if it was a service.

SmartDock is included in the FastTrack Logon zip file and therefore it is already replicated automatically to users' profiles from netlogon and no deployment is needed. You only need to activate it. The easiest way to do that is to include a line like this in your prelogon.fsh logon script:

If Portable Then SetUserStartupItem SmartDock,[FastTrackPath]\SmartDock.exe

This makes SmartDock execute any time the user logs on, whether the computer is on LAN or not, because it points to the local cache of your logon scripts - and you don't need to update SmartDock.exe or the SmartDock script manually. Once the users logs on to the LAN, the local cache files are automatically updated along with the logon script files.

Since you replicated the script file and the SmartDock executable to the local logon cache directory with FastTrack Logon, it can now also execute without LAN access. The client location from the FastTrackPath function is used, as the SmartDock.exe file is, by default, located in the same client directory as the executing FSH.Exe.

SmartDock as an MSI package

If you do not like the FastTrack Logon installation approach or you need to use SmartDock for non-domain computers, you can also build an MSI package with the SmartDock files. Please refer to this page for more information. If SmartDock is deployed this way, SmartDock will be installed locally and execute every time a user logs on, thus yielding the same result. However, the FastTrack Logon approach should be preferred, because the files are automatically updated, when they are changed on netlogon and you will also be able to "filter" your laptops for installation of SmartDock with the "Portable" condition. Note that the MSI version uses the SetStartupItem (per machine requiring admin permissions), whereas the FastTrack Logon approach uses SetUserStartupItem and installs it per laptop user profile.

Example script

SmartDock executes a script named "SmartDock.fsh" in the same directory as the SmartDock.exe. In the FastTrack Logon binary folder there is already a template script. All lines are commented out to avoid accidental execution, but the scripts looks like this:

SmallSplash "Setting up network, please wait..."

If Alive AcmeProxy Then

  SetProxyServer AcmeServer,8080

  ConnectShare J:,\\AcmeServer\CommonShare

  ConnectShare [UserHomeDrive],[UserHomeDir]

Else

  DisableProxyServer

  DisconnectAllShares

End If

If the server AcmeProxy is reachable, proxy server is set and two shares are connected. If the server is not reachable, all shares are disconnected and the proxy server is disabled to make sure that the user can actually browse the internet outside the company. You could also detect whether the user is on a LAN or not by checking the IP scope. You can expand the script with all sorts of other things specific to your company needs. Remember that the script will also execute on LAN after your logon script, so do not do anything that voids the functionality of the logon script.

You should consider to include the UploadInventory command at the end of your script, if you want your VPN computers to upload inventory information; please refer to this page for more information.

Configuring SmartDock

SmartDock comes with a file called SmartDock.xml. This XML file is the configuration file for SmartDock. The reason that the settings are in an XML file instead of using registry keys, is that the settings can then be deployed along with the exe file. SmartDock.xml is located in the FTLogon.zip file along the SmartDock.exe file and looks like this by default:
<SmartDock>
  <RunAtStartup>True</RunAtStartup>
  <RunOnIPChange>True</RunOnIPChange>
  <RunOnIPLost>False</RunOnIPLost>
  <AutoRerun>True</AutoRerun>
  <IdleHours>24</IdleHours>
  <ExecDelayInSeconds>10</ExecDelayInSeconds>
</SmartDock>
The purpose of the AutoRerun feature is to get a script executed every once and a while for desktop computers that are almost always on and rarely logged on and off. The settings explained:
SmartDock.xml settings
RunAtStartup Determines if the script is executed when StartDock.exe is started (Default: True).
RunOnIPChange Determines if the script is executed when an IP address is changed (Default: True).
RunOnIPLost Determines if the script is executed when all IP addresses are lost (Default: False).
AutoRerun / IdleHours Determines if the script is executed when is has not been executed for the number of hours defined with the "IdleHours" setting (Default: True/24).
ExecDelayInSeconds The delay in seconds before executing the script. When connecting through VPN, DNS information may not be propagated for a few seconds. The default 10 seconds is normally a good tradeoff interval (Default: 10).

Supplement backup script example

This example could be part of a SmartDock script. If the primary backup routine is located in the prelogon.fsh part of the logon script or put as an on-demand backup on the user's desktop, it is a good idea to remind them, if they do not backup their documents within a certain number of days. As we know that SmartDock will eventually fire the script every day, we can check that the backup is recent. The "DoBackup" custom command below stamps the time of the backup to the registry. If there is an additional backup routine in the logon script or as an on-demand desktop icon, this script must set the same registry key. So when a user connects to VPN without a recent backup, the user is asked the question below and answering 'Yes' will refresh the backup.

SmartDock Backup

The script listed below and is a template script to do this. The registry key names "Acme Corporation" should be replaced with your company name. The initial condition tests, if the server "AcmeServer" is reachable. This is to detect, if there is access to the corporate network. This server name must be replaced by a server name that you have on your network, for example the actual target server of the backup.

If Portable And Alive AcmeProxy Then

  If Not RegistryKeyExists HKCU\Software\Acme Corporation\LastBackup Then

    If Ask "You never backed up your documents.[Return][Return]Would you like to do this now?","Backup Notice","Harddrive" Then DoBackup

  Else

    If [RegistryValue HKCU\Software\Acme Corporation\LastBackup]<[SubtractDays 3] Then

      If Ask "You have not backed up your documents for over 2 days.[Return][Return]Would you like to do this now?",_

                "Backup Notice","Harddrive" Then DoBackup

    End If

  End If

End If

 

Command DoBackup()

  SyncDir [UserDocumentsDir],[UserHomeDrive]\Backup\[ComputerName]

  WriteRegistry HKCU\Software\Acme Corporation\LastBackup,[DateTime]

End Command

The script requires version 6.6. For earlier versions, the "Empty" condition must be replaced with a comparison to an empty string and the third parameter to the "Ask" conditions must be removed. The third parameter selects the "Hardrive" icon.

NOAA GLS Maersk Kawasaki Disney Goodyear Telenor AJG All testimonials ->
More customers ->