Add-RDSessionHost printer group policy error

I was trying to add a Windows Server 2012 Remote Desktop Session Host to a collection using Add-RDSessionHost. The command was working in so far as it was adding the server to the session collection, but it was then throwing an exception:

The property RedirectClientPrinter is configured by using Group Policy 
settings. Use the Group Policy Management Console to configure this property.
At C:\windows\system32\windowspowershell\v1.0\Modules\RemoteDesktop\SessionDesk
topCollection.psm1:389 char:70
+             Invoke-Command -Session $workflowSession -ArgumentList 
@($Connection ...
+                                                                      
~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Add-RDSHServer], RDManageme 
   ntException
    + FullyQualifiedErrorId : GPSettingfailed,Microsoft.RemoteDesktopServices. 
   Management.Cmdlets.AddRDSessionHostServerCommand

which was causing my script to stop.

After some investigation, it turns out that this is because the following group policy item was set in a GPO linked to an OU above where the server object lived in Active Directory:

  • Computer Configuration
    • Policies
      • Administrative Templates
        • Windows Components
          • Remote Desktop Services
            • Remote Desktop Session Host
              • Printer Redirection
                • Do not allow client printer redirection = Enabled

I tried setting this to Disabled, but got the same error. I temporarily blocked group policy inheritance to the OU that the RDSH server lived in and that fixed it, so it seems that the only setting that’s allowed for this policy (at least in order for the Add-RDSessionCollection cmdlet to work correctly) is Not configured.

Whilst diagnosing the above I also inadvertently ended up changing the error slightly to:

The property UseRDEasyPrintDriver is configured by using Group Policy 
settings. Use the Group Policy Management Console to configure this property.
At C:\windows\system32\windowspowershell\v1.0\Modules\RemoteDesktop\SessionDesk
topCollection.psm1:389 char:70
+             Invoke-Command -Session $workflowSession -ArgumentList 
@($Connection ...
+                                                                      
~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Add-RDSHServer], RDManageme 
   ntException
    + FullyQualifiedErrorId : GPSettingfailed,Microsoft.RemoteDesktopServices. 
   Management.Cmdlets.AddRDSessionHostServerCommand

which was caused by me setting the Use Remote Desktop Easy Print printer driver policy setting to something other than Not configured (i.e. Enabled or Disabled).

This error seems, as it states, to only care if these settings are set via Group Policy. The state of the tick box in the Session Collection configuration Client Settings, Printers section, namely Allow client printer redirection, seems irrelevant.

As to why the Add-RDSessionCollection PowerShell cmdlet cares about these (on the face of it perfectly legitimate) group policy settings, I have no idea.

This entry was posted in PowerShell, Remote Desktop and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s