{"id":298,"date":"2009-05-10T20:46:38","date_gmt":"2009-05-10T12:46:38","guid":{"rendered":"http:\/\/www.jhouseconsulting.com\/?p=298"},"modified":"2009-11-29T01:25:35","modified_gmt":"2009-11-28T17:25:35","slug":"deployment-script-for-the-ctrl-alt-del-it-consultancy-tools","status":"publish","type":"post","link":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2009\/05\/10\/deployment-script-for-the-ctrl-alt-del-it-consultancy-tools-298","title":{"rendered":"Deployment Script for the Ctrl-Alt-Del IT Consultancy Tools"},"content":{"rendered":"<p>A good friend of mine, Warren Simondson from <a href=\"http:\/\/www.ctrl-alt-del.com.au\/\" target=\"_blank\">Ctrl-Alt-Del IT Consultancy<\/a>, writes some awesome tools. There are a particular set I use for all Terminal\/Citrix Server deployments I refer to as &#8220;User Self-Help Tools&#8221;. 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.<\/p>\n<p>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&#8230;all done  \ud83d\ude42<\/p>\n<p>Enjoy!<!--more--><\/p>\n<p><dirtycode:InstallCtrlAltDelITConsultancySelfHelpTools.vbs><br \/>\n&#8216; Installation script for the Ctrl-Alt-Del IT Consultancy Self-Help Tools.<br \/>\n&#8216; http:\/\/www.ctrl-alt-del.com.au\/CAD_TSUtils.htm<br \/>\n&#8216;<br \/>\n&#8216; Instructions:<br \/>\n&#8216; 1) Add the tool executable name in the arrToolExes array.<br \/>\n&#8216; 2) Add the tool name for the shortcut in the arrToolNames array.<br \/>\n&#8216;    If you want the shortcut name to match the executable name, create<br \/>\n&#8216;    an empty value in the arrToolNames array.<br \/>\n&#8216; 3) Set the blnStartMenuShortcut and blnDesktopShortcut to True or False<br \/>\n&#8216;    depending on where you want a shortcut created, if at all.<br \/>\n&#8216;    If you only want to publish the tool(s), set both to False.<br \/>\n&#8216; 4) Set the strStartMenuSubFolder for the name of the Start Menu sub folder<br \/>\n&#8216;    to create the shortcuts in.<br \/>\n&#8216;    Set strStartMenuSubFolder to an empty value, or comment out, to create<br \/>\n&#8216;    them in the root of the Start Menu | Programs (All Programs) folder.<br \/>\n&#8216; 5) Set the blnAllUsersStartupFolder to True to create a shortcut for the<br \/>\n&#8216;    DEFSET utility in the All Users Startup Folder.<br \/>\n&#8216; 6) Even though these are 32-bit applications&#8230;<br \/>\n&#8216;    i) They will still run 100% correctly in a 64-bit environment.<br \/>\n&#8216;    ii) In a 64-bit environment we deploy them to the &#8220;%ProgramFiles%&#8221;<br \/>\n&#8216;        location and not the &#8220;%ProgramFiles(x86)%&#8221; location. This provides<br \/>\n&#8216;        a single location for the published application regardless of the<br \/>\n&#8216;        system architecture type.<br \/>\n&#8216;<br \/>\n&#8216; Revision 1.4 on 11th November 2009.<br \/>\n&#8216; Written by Jeremy@jhouseconsulting.com on 30th December 2008.<br \/>\n&#8216;<br \/>\nOption Explicit<\/p>\n<p>Dim objfso, objFolder, wshShell, oShellLink, strAUPrograms, strAUDesktop<br \/>\nDim strProgramFiles, strScriptPath, arrToolExes, arrToolNames, i<br \/>\nDim blnStartMenuShortcut, blnDesktopShortcut, strStartMenuSubFolder<br \/>\nDim strStartMenuFolder, blnAllUsersStartupFolder, strAUStartup<br \/>\nDim strShortcutName<\/p>\n<p>arrToolExes = Array(&#8220;TSSelfServReset.exe&#8221;,&#8221;TSTaskman.exe&#8221;,&#8221;TSPassChg.exe&#8221;,&#8221;DEFSET.exe&#8221;)<br \/>\narrToolNames = Array(&#8220;Session Reset&#8221;,&#8221;Task Manager&#8221;,&#8221;Change Password&#8221;,&#8221;Default Printer Selection&#8221;)<\/p>\n<p>blnStartMenuShortcut = True<br \/>\nblnDesktopShortcut = False<br \/>\nstrStartMenuSubFolder = &#8220;User Self-Help Tools&#8221;<br \/>\nblnAllUsersStartupFolder = False<\/p>\n<p>If IsArray(arrToolExes) And IsArray(arrToolNames) Then<br \/>\n  If UBound(arrToolExes) <> UBound(arrToolNames) Then<br \/>\n    WScript.Quit(0)<br \/>\n  End If<br \/>\nEnd If<\/p>\n<p>set WshShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)<br \/>\nset objfso = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<\/p>\n<p>strProgramFiles = WshShell.ExpandEnvironmentStrings(&#8220;%ProgramFiles%&#8221;)<br \/>\nstrAUPrograms = WshShell.SpecialFolders(&#8220;AllUsersPrograms&#8221;)<br \/>\nstrAUDesktop = WshShell.SpecialFolders(&#8220;AllUsersDesktop&#8221;)<br \/>\nstrAUStartup = WshShell.SpecialFolders(&#8220;AllUsersStartup&#8221;)<br \/>\nstrScriptPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, &#8220;\\&#8221;))<\/p>\n<p>If blnStartMenuShortcut Then<br \/>\n  If strStartMenuSubFolder <> &#8220;&#8221; Then<br \/>\n    strStartMenuFolder = strAUPrograms &#038; &#8220;\\&#8221; &#038; strStartMenuSubFolder<br \/>\n    If NOT objFSO.FolderExists(strAUPrograms &#038; &#8220;\\&#8221; &#038; strStartMenuSubFolder) Then<br \/>\n      Set objFolder = objFSO.CreateFolder(strAUPrograms &#038; &#8220;\\&#8221; &#038; strStartMenuSubFolder)<br \/>\n    End If<br \/>\n  Else<br \/>\n    strStartMenuFolder = strAUPrograms<br \/>\n  End If<br \/>\nEnd If<\/p>\n<p>If IsArray(arrToolExes) And UBound(arrToolExes) > 0 Then<br \/>\n  If NOT objFSO.FolderExists(strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del&#8221;) Then<br \/>\n    Set objFolder = objFSO.CreateFolder(strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del&#8221;)<br \/>\n  End If<br \/>\n  For i = 0 to ubound(arrToolExes)<br \/>\n    If objFSO.FileExists(strScriptPath &#038; arrToolExes(i)) Then<br \/>\n      If arrToolNames(i) <> &#8220;&#8221; Then<br \/>\n        strShortcutName = arrToolNames(i)<br \/>\n      Else<br \/>\n        strShortcutName = arrToolExes(i)<br \/>\n        If Len(arrToolExes(i)) &#8211; instrrev(arrToolExes(i), &#8220;.&#8221;) = 3 Then<br \/>\n          strShortcutName = Left(arrToolExes(i), Len(arrToolExes(i)) &#8211; 4)<br \/>\n        End If<br \/>\n      End If<br \/>\n      objFSO.CopyFile strScriptPath &#038; arrToolExes(i), strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221;, True<br \/>\n      If blnStartMenuShortcut Then<br \/>\n        Set oShellLink = WshShell.CreateShortcut(strStartMenuFolder &#038; &#8220;\\&#8221; &#038; strShortcutName &#038; &#8220;.lnk&#8221;)<br \/>\n        oShellLink.TargetPath = chr(34) &#038; strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221; &#038; arrToolExes(i) &#038; chr(34)<br \/>\n        oShellLink.WorkingDirectory= strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del&#8221;<br \/>\n        oShellLink.IconLocation = strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221; &#038; arrToolExes(i) &#038; &#8220;,0&#8221;<br \/>\n        oShellLink.Save<br \/>\n      End If<br \/>\n      If blnDesktopShortcut Then<br \/>\n        Set oShellLink = WshShell.CreateShortcut(strAUDesktop &#038; &#8220;\\&#8221; &#038; strShortcutName &#038; &#8220;.lnk&#8221;)<br \/>\n        oShellLink.TargetPath = chr(34) &#038; strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221; &#038; arrToolExes(i) &#038; chr(34)<br \/>\n        oShellLink.WorkingDirectory= strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del&#8221;<br \/>\n        oShellLink.IconLocation = strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221; &#038; arrToolExes(i) &#038; &#8220;,0&#8221;<br \/>\n        oShellLink.Save<br \/>\n      End If<br \/>\n      If Ucase(arrToolExes(i)) = &#8220;DEFSET.EXE&#8221; AND blnAllUsersStartupFolder Then<br \/>\n        Set oShellLink = WshShell.CreateShortcut(strAUStartup &#038; &#8220;\\&#8221; &#038; strShortcutName &#038; &#8220;.lnk&#8221;)<br \/>\n        oShellLink.TargetPath = chr(34) &#038; strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221; &#038; arrToolExes(i) &#038; chr(34)<br \/>\n        oShellLink.WorkingDirectory= strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del&#8221;<br \/>\n        oShellLink.IconLocation = strProgramFiles &#038; &#8220;\\Ctrl-Alt-Del\\&#8221; &#038; arrToolExes(i) &#038; &#8220;,0&#8221;<br \/>\n        oShellLink.Save<br \/>\n      End If<br \/>\n    End If<br \/>\n  Next<br \/>\nEnd If<\/p>\n<p>Set WshShell = Nothing<br \/>\nSet objfso = Nothing<br \/>\nSet objFolder = Nothing<br \/>\nSet oShellLink = Nothing<\/p>\n<p>WScript.Quit(0)<br \/>\n<\/dirtycode><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;User Self-Help Tools&#8221;. The below script is what I use to deploy them. Simply add the tools you wish to deploy to an array. &#8230; <a title=\"Deployment Script for the Ctrl-Alt-Del IT Consultancy Tools\" class=\"read-more\" href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2009\/05\/10\/deployment-script-for-the-ctrl-alt-del-it-consultancy-tools-298\" aria-label=\"Read more about Deployment Script for the Ctrl-Alt-Del IT Consultancy Tools\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[5,97],"tags":[137,423,167,417],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-scripting","category-tools","tag-ctrl-alt-del","tag-tools","tag-user-self-help","tag-xenapp"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/comments?post=298"}],"version-history":[{"count":6,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/298\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/categories?post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/tags?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}