Obscurities: A startup script to update Securus clients
If you run Securus on your network, you'll occasionally need to update your client to resolve some daft issue. Whilst the client comes as an MSI - very helpful - it's a pain to do anything with because of the way Securus runs.
The MSI's have different product codes, so running the new MSI doesn't upgrade or overwrite the old install, it just installs alongside, and the old version seems to take precedence. Depending on how your original install was pushed out, you may not be able to send out a reliable uninstall command.
I tried using a task sequence in SCCM, and running a script as a Package in SCCM, but neither worked because securusn.exe was running so the uninstall failed, and closing securusn.exe by force does funny things (by design). Long story short, I ended up writing a VBS script to run at startup, that checks the installed version via reg keys and takes the appropriate steps. Copy and paste all this into a text file and save with a .vbs extension:
' regCheck from http://jagspage.wordpress.com/2013/04/08/check-if-a-registry-key-exists-using-vbscript/
Dim oShell
Set oShell = CreateObject("WScript.Shell")
Dim Value, StartupKey, startupKeyName, startupKeyValue
startupKeyName = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\Securus Network Client"
startupKeyValue = "C:\Program Files (x86)\securus\securusclient\securusn.exe s1=[iP] uselocaldrive nobroadcast"
Function RegKeyExists(Key)
Dim entry
On Error Resume Next
entry = oShell.RegRead(Key)
If Err.Number = 0 Then
Err.Clear
RegKeyExists = False
Else
Err.Clear
RegKeyExists = True
End If
End Function
' v7.00.24 = {11B677BC-75DC-42AB-8FF1-034E93FD0C56}
' v7.00.30 = {8B15A993-98C7-444C-8794-38D9A5C0A75B}
' Check for earlier version on line below
Value=RegKeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{11B677BC-75DC-42AB-8FF1-034E93FD0C56}\")
If Value=0 Then
' v7.00.24 installed, need to uninstall then install newer version
StartupKey=RegKeyExists(startupKeyName)
If StartupKey=0 Then
' startupkey is in place, need to remove & restart to let this script run again without software running (else can't uninstall)
oShell.RegDelete startupKeyName
oShell.Run "C:\WINDOWS\system32\shutdown.exe /r /t 2"
Else
' startupkey already removed, uninstall, wait, install (which re-adds key)
oShell.Run "TASKKILL /F /IM securusn.exe"
oShell.Run "msiexec /x {11B677BC-75DC-42AB-8FF1-034E93FD0C56} /q"
Wscript.Sleep 10000
oShell.Run "msiexec /i \\server.domain.local\share\Securus\v7.00.30v7.msi /q"
End If
Else
' v7.00.24 NOT installed, check if v7.00.30 is (in case no client installed)
Value=RegKeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{8B15A993-98C7-444C-8794-38D9A5C0A75B}\")
If Value=0 Then
' v7.00.30 installed OK, nothing more need be done
Else
' need to install v7.00.30
oShell.Run "msiexec /i \\server.domain.local\share\Securus\v7.00.30v7.msi /q"
End If
' sanity check for startup reg key
StartupKey=RegKeyExists(startupKeyName)
If StartupKey=0 Then
' startupkey is in place, all is dandy
Else
' startupkey needs replacing
oShell.RegWrite startupKeyName,startupKeyValue,"REG_SZ"
End If
End If
That is explicitly for updating 7.00.24 to 7.00.30v7 - you will likely have different versions at one step or both, so steps you need to take to get the code working:
* open regedit and search the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall node for "securus". You should get some keys turn up, with the DisplayName value telling you what version it relates to. Change the keys as relevant in the two regkey checks and in the uninstall line (msiexec /x)
* Change the path to your install file (written as \\server.domain.local\share\ above)
* Get the correct value for your startup key - it will be different from above as it will have an IP in the value. You should be able to get it from any PC before you've done this.
* If you're on x86 instead of x64 you will need to update your reg paths as relevant so you're not in the Wow6432Node
Once it's all coded, set it as a startup script on a grou policy; once in force, computers will restart once at startup (removing the Run regkey then rebooting so securus isn't open) then uninstall the old version, wait a few seconds for that to complete, then install the new one. By the time you log in it should have had time to install & set the reg key and it should have started up when you log in.
Best of luck!

0 Comments
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now