Cameras To Redirect Custom RDP Property Does not Work

Copper Contributor

In mstsc.exe, under Local Resources > More.. there is an option for Video capture devices.  Which lists my webcam and Devices that I plug in later.  I have determined that this option the an RDP file is the string camerastoredirect:s:*  So what I have done is ran the following command on my Connection Broker so that this line will be added to rdp file generated by the feed.

Set-RDSessionCollectionConfiguration -CollectionName $CollectionName -CustomRdpProperty "camerastoredirect:s:*"

When I run Get-RDSessionCollectionConfiguration I see the value has been added to CustomRdpProperty along with "use redirection server name:i:1" which seems to be a default on all collections.
What I am trying to solve is, why does my custom RDP property not apply to the RDP files that are downloaded.

11 Replies

We have exactly the same issue, is there already a solution for this?

I have found a solution for this:

Go to the following location
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms<Farm Name>\RemoteDesktops<Resource Name>\RDPFileContents

Export the registry file with the program O&O Regeditor.
Make a copy of your backup and edit the copy.
Add the following line to the config: camerastoredirect:s:* with notepad plus plus
Save the file
Import the reg file with O&O Regeditor  

 

@Ryan_Janssen  Thanks for the tip. 

I actually had to create a VBscript because notepad++ wasn't breaking the lines properly.

I'll put the script on my GitHub repo this weekend. 

https://github.com/roanp/RDS-SwissKnife

@Ryan_Janssen So editing this does not invalidate the signing of the rdp file when it is downloaded?  I suppose that this will need to be updated if the feed settings are ever updated by an admin

 

@RoanPaes I don't see a script in the github repository you mention.  But I believe using get-itemproperty and set-itemproperty with $value += "camerastoredirect:s:*`n" should be sufficient

I was able to run this powershell command on each connection broker and it was able to work.  I would also still run the Set-RDSessionCollectionConfiguration command for the custom value as well.

 

<collection alias> would be the value of CollectionAlias from Get-RDSessionCollection

 

 

$alias = <collection Alias>
$RDPFileContents = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms\$alias\RemoteDesktops\$alias\").RDPFileContents
$RDPFileContents += "camerastoredirect:s:*`n"
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms\$alias\RemoteDesktops\$alias\" -Name RDPFileContents -Value $RDPFileContents

 

 

Like I thought, editing the collection overwrites this value and it has to be updated again. The fact that the property does not get to the file property is a bug I believe. How can we escalate this with Microsoft's rdp team?

@Matt_OCC  I was unable to upload the VB because of clients info within the file.  But I feel your solution works way better. 


The one I used roughly looks like the below (it is missing lots of bits and pieces, but the idea is, once you have your registry exported, you create the VBS file with all you need plus the camera support).

 

 & "promptcredentialonce:i:1" & VbCrLf _
& "videoplaybackmode:i:1" & VbCrLf _
& "audiocapturemode:i:1" & VbCrLf _
& "gatewayusagemethod:i:2" & VbCrLf _
& "gatewayprofileusagemethod:i:1" & VbCrLf _
& "gatewaycredentialssource:i:0" & VbCrLf _
& "full address:s:REMOTE.yourdomain.com" & VbCrLf _
& "gatewayhostname:s:remote.yourdomain.com" & VbCrLf _
& "workspace id:s:REMOTE.yourdomain.com" & VbCrLf _
& "use redirection server name:i:1" & VbCrLf _
& "loadbalanceinfo:s:tsv://MS Terminal Services Plugin.1.RDS-Desktop" & VbCrLf _

Dim WSHShell
set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms\BCB-Desktop\RemoteDesktops\BCB-Desktop\RDPFileContent", myval, "REG_SZ"

@RoanPaes I found editing the registry directly through powershell the easies.  I've run into the issue with a HA collection continually gets written over any time any collection in the deployment changed.  It seems to be part of the sync process between the collection brokers.  I've written a small script to cycle through all of the collections and append the registry to deal with it, just haven't decided on when I should trigger this.

@Matt_OCC 
I just want to say that the PS code is brilliant and worked flawlessly for me. This is such an aggravating issue that I don't know why it is not in the GUI settings to begin with.

@Matt_OCC Thank you, you are a genius, 3 years on and it's still not an option in the gateway

@Matt_OCC 

 

Thank you, this helped me no end! I have used your original commands and created a more complete PowerShell script that checks to see if you already have the change applied before applying.

 

# Change the alias variable below, for a Remote Desktop resource type use the CollectionAlias from...  Get-RDVirtualDesktopCollection | Select-Object CollectionName, CollectionAlias
$alias = "ENTER_YOUR_ALIAS_HERE"

# Define the registry key path
$registry_key_path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\CentralPublishedResources\PublishedFarms\$alias\RemoteDesktops\$alias"

# Define the existing registry value name
$existing_value_name = "RDPFileContents"

# Define the value to add
$value_to_add = "camerastoredirect:s:*`n"

# Define the value to check
$value_to_check = "camerastoredirect:s:*"

# Get the current value of the registry key
try {
    $current_value = Get-ItemProperty -Path $registry_key_path -Name $existing_value_name -ErrorAction Stop | Select-Object -ExpandProperty $existing_value_name
} catch {
    $current_value = ""
}

# Check if the value_to_add is already present in the current value
if ($current_value -match $value_to_check) {
    Write-Host "'$value_to_check' is already present in the registry value '$existing_value_name' in the key '$registry_key_path'."
} else {
    # Construct the full value
    $full_value = "$value_to_add $current_value"

    # Use PowerShell to set the registry value
    try {
        Set-ItemProperty -Path $registry_key_path -Name $existing_value_name -Value $full_value
        Write-Host "Successfully added '$value_to_add' to the registry value '$existing_value_name' in the key '$registry_key_path'."
    } catch {
        Write-Host "Error: $_"
    }

}