Script to Fix the Delivery Services Console Shortcut

by Jeremy on November 29, 2009

This script will update any shortcuts to the Delievery Services Console (DSC) and Access Management Console (AMC).

Launching the DSC or AMC on 64-bit system is a bit of a challenge. The CmiLaunch.exe does not work correctly on a 64-bit system. It does not start and we receive the following three errors in the System Event Logs:

Event Source: SideBySide
Event ID: 59
Description: Generate Activation Context failed for C:\WINDOWS\SysWOW64\mmc.exe. Reference error message: The referenced assembly is not installed on your system.

Event Source: SideBySide
Event ID: 59
Description: Resolve Partial Assembly failed for Microsoft.Windows.Common-Controls. Reference error message: The referenced assembly is not installed on your system.

Event Source: SideBySide
Event ID: 32
Description: Dependent Assembly Microsoft.Windows.Common-Controls could not be found and Last Error was The referenced assembly is not installed on your system.

The issue is actually caused by the MS hotfix KB942589 we apply on the 64-bit builds. But this is an important hotfix, so we can’t remove or exclude it. This is further explained by Microsoft in a Technet article titled “Controlling your MMC Snap-ins on 64-bit Operating Systems“. So we need to run the cmi20.msc instead from the “%CommonProgramFiles(x86)%\Citrix\Access Management Console – Framework” folder.

It’s important to note that the cmi20.msc is a 32-bit MMC, and should therefore be launched with the 32-bit MMC by using the following command line:

“%SystemRoot%\system32\mmc.exe” /32 “%CommonProgramFiles(x86)\Citrix\Access Management Console – Framework\cmi20.msc”

FixDSCShortcut.vbs


' This script will update any shortcuts to the Delievery Services Console (DSC) and Access Management Console (AMC).
' Launching the DSC or AMC on 64-bit system is a bit of a challenge. The CmiLaunch.exe does not work correctly on a 64-bit
' system. It does not start and we receive the following three errors in the System Event Logs:
'   Event Source: SideBySide
'   Event ID: 59
'   Description: Generate Activation Context failed for C:\WINDOWS\SysWOW64\mmc.exe. Reference error message: The referenced
'                assembly is not installed on your system.
'   Event Source: SideBySide
'   Event ID: 59
'   Description: Resolve Partial Assembly failed for Microsoft.Windows.Common-Controls. Reference error message: The
'                referenced assembly is not installed on your system.
'   Event Source: SideBySide
'   Event ID: 32
'   Description: Dependent Assembly Microsoft.Windows.Common-Controls could not be found and Last Error was The referenced
'                assembly is not installed on your system.
' The issue is actually caused by the MS hotfix (KB942589) we apply on the 64-bit builds. But this is an important hotfix,
' so we can't remove or exclude it. This is further explained in the following Microsoft Technet article:
' http://blogs.technet.com/askperf/archive/2008/04/25/controlling-your-mmc-snap-ins-on-64-bit-operating-systems.aspx
' So we need to run the cmi20.msc instead from the "%CommonProgramFiles(x86)%\Citrix\Access Management Console – Framework"
' folder.
' It's important to note that the cmi20.msc is a 32-bit MMC, and should therefore be launched with the 32-bit MMC by using
' the following command line:
' "%SystemRoot%\system32\mmc.exe" /32 "%CommonProgramFiles(x86)\Citrix\Access Management Console - Framework\cmi20.msc"
'
' Release 1.0
' Written by Jeremy@jhouseconsulting.com on 22nd November 2009.
'
Option Explicit</dirtycode:fixdscshortcut.vbs>

Dim WshShell, strAUPrograms, strProcessorArchitecture, strShortcut

Set WshShell = WScript.CreateObject("WScript.Shell")

strAUPrograms = WshShell.SpecialFolders("AllUsersPrograms")
strProcessorArchitecture = WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")

If lcase(strProcessorArchitecture) <> "x86" Then

  strShortcut = strAUPrograms & "\Citrix\Management Consoles\Access Management Console.lnk"
  Call CreateShortcut(strShortcut)

  strShortcut = strAUPrograms & "\IT Tools\Citrix\Management Consoles\Access Management Console.lnk"
  Call CreateShortcut(strShortcut)

  strShortcut = strAUPrograms & "\Citrix\Management Consoles\Delivery Services Console.lnk"
  Call CreateShortcut(strShortcut)

  strShortcut = strAUPrograms & "\IT Tools\Citrix\Management Consoles\Delivery Services Console.lnk"
  Call CreateShortcut(strShortcut)

End If

Set WshShell = Nothing

wscript.quit(0)

Sub CreateShortcut(strShortcut)
  Dim objFSO, objShortcut, strSystemRoot, strCommonProgramFilesx86
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  strSystemRoot = WshShell.ExpandEnvironmentStrings("%SystemRoot%")
  strCommonProgramFilesx86 = WshShell.ExpandEnvironmentStrings("%CommonProgramFiles(x86)%")
  If objFSO.FileExists(strShortcut) Then
    objFSO.DeleteFile(strShortcut)
    Set objShortcut = WshShell.CreateShortcut(strShortcut)
    objShortcut.TargetPath = chr(34) & strSystemRoot & "\system32\mmc.exe" & chr(34)
    objShortcut.Arguments = "/32 " & chr(34) & strCommonProgramFilesx86 & "\Citrix\Access Management Console - Framework\cmi20.msc" & chr(34)
    objShortcut.WorkingDirectory= strCommonProgramFilesx86 & "\Citrix\Access Management Console - Framework\"
    objShortcut.IconLocation = strCommonProgramFilesx86 & "\Citrix\Access Management Console - Framework\CmiLaunch.exe,0"
    objShortcut.Description = "Manage XenApp"
    objShortcut.Save
    Set objShortcut = Nothing
  End If
  set objFSO = Nothing
End Sub
Jeremy Professional Shot Sept 2010 white Script to Fix the Delivery Services Console Shortcut

Jeremy

Independent Consultant | Contractor | Microsoft & Citrix Specialist | Desktop Virtualization Specialist at J House Consulting
Jeremy is a highly respected, IT geek, with over 28 years’ experience in the industry. He is an independent IT consultant providing expertise to enterprise, corporate, higher education and government clients. His skillset, high ethical standards, integrity, morals and attention to detail, coupled with his friendly nature and exceptional design and problem solving skills, makes him one of the most highly respected and sought after Microsoft and Citrix technical resources in Australia. His alignment with industry and vendor best practices puts him amongst the leaders of his field.
Jeremy Professional Shot Sept 2010 white Script to Fix the Delivery Services Console Shortcut
Jeremy Professional Shot Sept 2010 white Script to Fix the Delivery Services Console Shortcut
Jeremy Professional Shot Sept 2010 white Script to Fix the Delivery Services Console Shortcut

Previous post:

Next post: