Deployment Script for the Repair Clipboard Chain utility

by Jeremy on November 29, 2009

Here is a deployment script for the Citrix Repair Clipboard Chain (RepairCBDChain.exe) utility as per Citrix KB article CTX106226.

This utility does not have a nice default icon, so I have used one that looks like this: clipboard Deployment Script for the Repair Clipboard Chain utility

I have zipped up the actual ico file here: clipboard

Enjoy!

InstallRepairClipboardChain


' Installation script for the Repair Clipboard Chain utility as per Citrix KB article CTX106226
'
' Notes:
' 1) Even though this a a 32-bit application...
'    i) It will still run 100% correctly in a 64-bit environment.
'    ii) In a 64-bit environment we deploy it 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.0
' Written by Jeremy@jhouseconsulting.com on 10th November 2009.

Option Explicit

Dim objfso, objFolder, wshShell, oShellLink, strAUPrograms, strAUDesktop
Dim strProgramFiles, strScriptPath, blnStartMenuShortcut, blnDesktopShortcut
Dim strStartMenuSubFolder, strStartMenuFolder

blnStartMenuShortcut = True
blnDesktopShortcut = False
strStartMenuSubFolder = "User Self-Help Tools"

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

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

If objFSO.FileExists(strScriptPath & "RepairCBDChain.exe") AND objFSO.FileExists(strScriptPath & "clipboard.ico") Then
  If NOT objFSO.FolderExists(strProgramFiles & "\Citrix") Then
    Set objFolder = objFSO.CreateFolder(strProgramFiles & "\Citrix")
  End If
  objFSO.CopyFile strScriptPath & "RepairCBDChain.exe", strProgramFiles & "\Citrix\", True
  objFSO.CopyFile strScriptPath & "clipboard.ico", strProgramFiles & "\Citrix\", True
  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
    Set oShellLink = WshShell.CreateShortcut(strStartMenuFolder & "\Repair Clipboard Chain.lnk")
    oShellLink.TargetPath = chr(34) & strProgramFiles & "\Citrix\RepairCBDChain.exe" & chr(34)
    oShellLink.WorkingDirectory= strProgramFiles & "\Citrix"
    oShellLink.IconLocation = strProgramFiles & "\Citrix\clipboard.ico" & ",0"
    oShellLink.Save
  End If
  If blnDesktopShortcut Then
    Set oShellLink = WshShell.CreateShortcut(strAUDesktop & "\Repair Clipboard Chain.lnk")
    oShellLink.TargetPath = chr(34) & strProgramFiles & "\Citrix\RepairCBDChain.exe" & chr(34)
    oShellLink.WorkingDirectory= strProgramFiles & "\Citrix"
    oShellLink.IconLocation = strProgramFiles & "\Citrix\clipboard.ico" & ",0"
    oShellLink.Save
  End If
End If

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

WScript.Quit(0)

Related posts:

  1. Deployment Script for the Ctrl-Alt-Del IT Consultancy Tools
  2. The Challenges of Using VBScript to Create Shortcuts
  3. Script to Fix the Delivery Services Console Shortcut

Leave a Comment

 

Previous post:

Next post: