Deployment Script for the Ctrl-Alt-Del IT Consultancy Tools

by Jeremy Saunders on May 10, 2009

A good friend of mine, Warren Simondson from Ctrl-Alt-Del IT Consultancy, writes some awesome tools. There are a particular set I use for all Terminal/Citrix Server deployments I refer to as “User Self-Help Tools”. The below script is what I use to deploy them. Simply add the tools you wish to deploy to an array. It can create shortcuts in a Start Menu folder and/or on the Desktop simply by setting a couple of boolean values as documented in the script.

Simply place this script in the same folder with the tools. Setup the arrTools and arrToolNames arrays. Execute it using the cscript processor. And voila…all done 🙂

Enjoy!


‘ Installation script for the Ctrl-Alt-Del IT Consultancy Self-Help Tools.
‘ http://www.ctrl-alt-del.com.au/CAD_TSUtils.htm

‘ Instructions:
‘ 1) Add the tool executable name in the arrToolExes array.
‘ 2) Add the tool name for the shortcut in the arrToolNames array.
‘ If you want the shortcut name to match the executable name, create
‘ an empty value in the arrToolNames array.
‘ 3) Set the blnStartMenuShortcut and blnDesktopShortcut to True or False
‘ depending on where you want a shortcut created, if at all.
‘ If you only want to publish the tool(s), set both to False.
‘ 4) Set the strStartMenuSubFolder for the name of the Start Menu sub folder
‘ to create the shortcuts in.
‘ Set strStartMenuSubFolder to an empty value, or comment out, to create
‘ them in the root of the Start Menu | Programs (All Programs) folder.
‘ 5) Set the blnAllUsersStartupFolder to True to create a shortcut for the
‘ DEFSET utility in the All Users Startup Folder.
‘ 6) Even though these are 32-bit applications…
‘ i) They will still run 100% correctly in a 64-bit environment.
‘ ii) In a 64-bit environment we deploy them to the “%ProgramFiles%”
‘ location and not the “%ProgramFiles(x86)%” location. This provides
‘ a single location for the published application regardless of the
‘ system architecture type.

‘ Revision 1.4 on 11th November 2009.
‘ Written by Jeremy@jhouseconsulting.com on 30th December 2008.

Option Explicit

Dim objfso, objFolder, wshShell, oShellLink, strAUPrograms, strAUDesktop
Dim strProgramFiles, strScriptPath, arrToolExes, arrToolNames, i
Dim blnStartMenuShortcut, blnDesktopShortcut, strStartMenuSubFolder
Dim strStartMenuFolder, blnAllUsersStartupFolder, strAUStartup
Dim strShortcutName

arrToolExes = Array(“TSSelfServReset.exe”,”TSTaskman.exe”,”TSPassChg.exe”,”DEFSET.exe”)
arrToolNames = Array(“Session Reset”,”Task Manager”,”Change Password”,”Default Printer Selection”)

blnStartMenuShortcut = True
blnDesktopShortcut = False
strStartMenuSubFolder = “User Self-Help Tools”
blnAllUsersStartupFolder = False

If IsArray(arrToolExes) And IsArray(arrToolNames) Then
If UBound(arrToolExes) <> UBound(arrToolNames) Then
WScript.Quit(0)
End If
End If

set WshShell = WScript.CreateObject(“WScript.Shell”)
set objfso = CreateObject(“Scripting.FileSystemObject”)

strProgramFiles = WshShell.ExpandEnvironmentStrings(“%ProgramFiles%”)
strAUPrograms = WshShell.SpecialFolders(“AllUsersPrograms”)
strAUDesktop = WshShell.SpecialFolders(“AllUsersDesktop”)
strAUStartup = WshShell.SpecialFolders(“AllUsersStartup”)
strScriptPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, “\”))

If blnStartMenuShortcut Then
If strStartMenuSubFolder <> “” Then
strStartMenuFolder = strAUPrograms & “\” & strStartMenuSubFolder
If NOT objFSO.FolderExists(strAUPrograms & “\” & strStartMenuSubFolder) Then
Set objFolder = objFSO.CreateFolder(strAUPrograms & “\” & strStartMenuSubFolder)
End If
Else
strStartMenuFolder = strAUPrograms
End If
End If

If IsArray(arrToolExes) And UBound(arrToolExes) > 0 Then
If NOT objFSO.FolderExists(strProgramFiles & “\Ctrl-Alt-Del”) Then
Set objFolder = objFSO.CreateFolder(strProgramFiles & “\Ctrl-Alt-Del”)
End If
For i = 0 to ubound(arrToolExes)
If objFSO.FileExists(strScriptPath & arrToolExes(i)) Then
If arrToolNames(i) <> “” Then
strShortcutName = arrToolNames(i)
Else
strShortcutName = arrToolExes(i)
If Len(arrToolExes(i)) – instrrev(arrToolExes(i), “.”) = 3 Then
strShortcutName = Left(arrToolExes(i), Len(arrToolExes(i)) – 4)
End If
End If
objFSO.CopyFile strScriptPath & arrToolExes(i), strProgramFiles & “\Ctrl-Alt-Del\”, True
If blnStartMenuShortcut Then
Set oShellLink = WshShell.CreateShortcut(strStartMenuFolder & “\” & strShortcutName & “.lnk”)
oShellLink.TargetPath = chr(34) & strProgramFiles & “\Ctrl-Alt-Del\” & arrToolExes(i) & chr(34)
oShellLink.WorkingDirectory= strProgramFiles & “\Ctrl-Alt-Del”
oShellLink.IconLocation = strProgramFiles & “\Ctrl-Alt-Del\” & arrToolExes(i) & “,0”
oShellLink.Save
End If
If blnDesktopShortcut Then
Set oShellLink = WshShell.CreateShortcut(strAUDesktop & “\” & strShortcutName & “.lnk”)
oShellLink.TargetPath = chr(34) & strProgramFiles & “\Ctrl-Alt-Del\” & arrToolExes(i) & chr(34)
oShellLink.WorkingDirectory= strProgramFiles & “\Ctrl-Alt-Del”
oShellLink.IconLocation = strProgramFiles & “\Ctrl-Alt-Del\” & arrToolExes(i) & “,0”
oShellLink.Save
End If
If Ucase(arrToolExes(i)) = “DEFSET.EXE” AND blnAllUsersStartupFolder Then
Set oShellLink = WshShell.CreateShortcut(strAUStartup & “\” & strShortcutName & “.lnk”)
oShellLink.TargetPath = chr(34) & strProgramFiles & “\Ctrl-Alt-Del\” & arrToolExes(i) & chr(34)
oShellLink.WorkingDirectory= strProgramFiles & “\Ctrl-Alt-Del”
oShellLink.IconLocation = strProgramFiles & “\Ctrl-Alt-Del\” & arrToolExes(i) & “,0”
oShellLink.Save
End If
End If
Next
End If

Set WshShell = Nothing
Set objfso = Nothing
Set objFolder = Nothing
Set oShellLink = Nothing

WScript.Quit(0)

Jeremy Saunders

Jeremy Saunders

Technical Architect | DevOps Evangelist | Software Developer | Microsoft, NVIDIA, Citrix and Desktop Virtualisation (VDI) Specialist/Expert | Rapper | Improvisor | Comedian | Property Investor | Kayaking enthusiast at J House Consulting
Jeremy Saunders is the Problem Terminator. He is a highly respected IT Professional with over 35 years’ experience in the industry. Using his exceptional design and problem solving skills with precise methodologies applied at both technical and business levels he is always focused on achieving the best business outcomes. He worked as an independent consultant until September 2017, when he took up a full time role at BHP, one of the largest and most innovative global mining companies. With a diverse skill set, high ethical standards, and attention to detail, coupled with a friendly nature and great sense of humour, Jeremy aligns to industry and vendor best practices, which puts him amongst the leaders of his field. He is intensely passionate about solving technology problems for his organisation, their customers and the tech community, to improve the user experience, reliability and operational support. Views and IP shared on this site belong to Jeremy.
Jeremy Saunders
Jeremy Saunders

Previous post:

Next post: