|
Free SmartDock connectivity tool - offline logon scripts
SmartDock is a small exe file that detects whenever the computer changes IP settings of any network adapter. Once detected, SmartDock executes a FastTrack script.
Thus, 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. What the script does and based on what logic is entirely up to you. This is very handy for portable computers that roam.
Examples of script content could be setting or removing proxy server settings based
on whether or not 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.
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. 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.
|
Related pages
|
How to set up logon scripts with FastTrack Logon.
|
|
Get inspired by our example Logon Scripts.
|
|
How to set up Startup Scripts with FastTrack Logon.
|
|
Browse online documentation.
|
|
|
Setup execution
SmartDock is included in the
FastTrack Logon zip file.
The easiest way to use it 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. Since you replicated the script file and
the SmartDock executable to the local logon directory with FastTrack Logon, it can 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.
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.
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.
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.
Configuring SmartDock
From version 7 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 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>
<AutoRerun>True</AutoRerun>
<IdleHours>24</IdleHours>
<ExecDelayInSeconds>10</ExecDelayInSeconds>
<Script>SmartDock.fsh</Script>
</SmartDock>
|
 |
Versions before FastTrack Scripting Host 7 do not have a configuration file and the default settings
above are used. The AutoRerun feature did not exist prior to version 7. The purpose of the AutoRerun feature is
to get a script executed every once and awhile for desktop computers that are almost always on and rarely logged on and off.
The settings explained:
 |
|
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).
|
|
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).
|
|
Script
|
The script to execute. The reason why the script name is configurable is that
you can copy SmartDock.exe and SmartDock.xml to different names and have multiple
copies in the same directory. SmartDock will look for an xml file that has the same
name excluding the .exe extension (Default: SmartDock.fsh).
|
|
 |
|
Copyright 2005-2012 FastTrack Software
|
|
|