Friday, April 6, 2018

The Case of the Disappearing Philips Dictation Microphone in a XenApp-Delivered Application Running In A XenDesktop Virtual Desktop And How To Make It Work

A long title but with amazing results. What do you do when you are asked to fulfill these requirements?

  • User will be using Epic Hyperspace delivered via XenApp 7.x
  • User will be launching Hyperspace from their XenDesktop-delivered Windows 7 desktop
  • User will be launching their VDI desktop from a Dell Wyse Xenith endpoint with a Phillips SpeechMike III attached
  • User must be able to use their SpeechMike in Hyperspace for partial dictation with all buttons functioning
  1. First, make sure you are running a recent Dell/Wyse firmware (I tested on ThinOS Lite 2.4_112 and ThinOS 8.4_112).
  2. Next you will need to set a custom hardware string either in the .ini or your Dell Management Suite group policy->Advamced: Device=vusb ForceRedirect=0x0911,0x0c1c,0x01,0x01,0x00 Type=HDX
  3. After logging in to your published desktop, you will see the Speechmike in audio devices but notice that the default audio device is Citrix HDX Audio for both speakers and microphone. In order for the SpeechMike to work in a XenApp session, the Speechmike must be default.
    1. To accomplish this automatically, you can use Powershell and a 3rd-party utility, nircmdc, to make the change during login.
    2. For the script to work, you must change permissions on
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices by first taking ownership of the key and then giving write permissions for Authenticated Users and propagating them down.
    3. Nircmdc uses the Windows generic name (eg. Microphone) and not the device name (Philips Speechmike III). In many cases there will be multiple devices with the same name (eg. Microphone or Speakers) so we need to run a Powershell script to find the Philips microphone and rename it's generic name to DocMic so we can use Nircmdc to set it as default.
      $regcheck = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture"
      $soundcheck = Get-ChildItem -path Registry::$regcheck

      $enabledDevices = foreach($_ in $soundcheck)

          $path = $_.'name'
          Get-ItemProperty -path Registry::$path | ?{$_.DeviceState -eq "1"} | Select-Object pspath | Get-ChildItem | Get-ItemProperty | ?{$_ -match "SpeechMike III"}
      }
      if($enabledDevices)
      {
          $path =  $enabledDevices.pspath
          $key = ($enabledDevices.psobject.properties | ?{$_.Value -match "Microphone"}).name
          set-ItemProperty -path $path -name $key -value DocMic -type string -force
      }
    4. You can modify the Powershell script to also kick off Nircmdc but I've left it separate:
      Nircmdc.exe -setdefaultsounddevice "DocMic"
  4. Now just have these run at user logon. You may need to call a sleep function at the beginning of the script to allow time for Windows to complete the new hardware detection.
  5. If you want to also use the speaker on the dictation mic, you will also need to run a slightly modified version of the above PS script:
    $regcheck = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render"
    $soundcheck = Get-ChildItem -path Registry::$regcheck

    $enabledDevices = foreach($_ in $soundcheck)
    {  
        $path = $_.'name'
        Get-ItemProperty -path Registry::$path | ?{$_.DeviceState -eq "1"} | Select-Object pspath | Get-ChildItem | Get-ItemProperty | ?{$_ -match "SpeechMike III"}
    }
    if($enabledDevices)
    {
        $path =  $enabledDevices.pspath
        $key = ($enabledDevices.psobject.properties | ?{$_.Value -Match "Speakers"}).name
        set-ItemProperty -path $path -name $key -value DocSpeaker -type string -force
    }
    And then modify the nircmdc command to reference "DocSpeaker".
    You can obtain the nircmdc utility here.

No comments:

Post a Comment