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!
InstallCtrlAltDelITConsultancySelfHelpTools.vbs
' 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)
Post a Comment