Scenario / Questions

I am running the following command from a PowerShell console on a Windows 8 machine, trying to configure a Server 2012 R2 RDS Connection Broker:

Import-Module RemoteDesktop
Set-RDSessionCollectionConfiguration -CollectionName "Example" -CustomRdpProperty "gatewayhostname:s:rdp.example.com" -ConnectionBroker "ep-ts01.ad.example.com"

However, even though I am specifying which Connection Broker to use, it always tries to connect to localhost:

New-PSSession : [localhost] Connecting to remote server localhost
failed with the following error message : The clie cannot connect to
the destination specified in the request. Verify that the service on
the destination is running an is accepting requests. Consult the logs
and documentation for the WS-Management service running on the
destination, most commonly IIS or WinRM. If the destination is the
WinRM service, run the following command on the destination to analyze
and configure the WinRM service: “winrm quickconfig”. For more
information, see the about_Remote_Troubleshooting Help topic.

enter image description here

However, Get-RDSessionCollection -ConnectionBroker ep-ts01.ad.example.com works just fine and returns the collections.

It’s the same story if I do Enter-PSSession ep-ts01.ad.example.com and run it from there. However if I run the command from the server itself (i.e. not remotely) it works just fine.

How can I fix this?

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

Mark, I had a lot of fun tracking this down for you. I can totally see where your line of thought is, but you’re asking the wrong question. The question should be “Why can’t I establish a ‘servermanagerworkflows’ session on my machine?”

If you look in the $enf:systemroot\system32\WindowsPowerShell\v1.0\Modules\RemoteDesktop and open the SessionCollectionProperties.psm1 module and jump to line 383 there’s an entry where Microsoft is intentionally trying to create a local session using the Microsoft.Windows.ServerManagerWorkflows configuration. After the session is instantiated the magic happens in the following Try/Catch/Finally blocks.

If you ran $session = New-PSSession -ConfigurationName microsoft.windows.servermanagerworkflow in a PS prompt on it’s own, I’m betting you’d get the same error. To reinforce this, run Get-PSSessionConfiguration | Select Name and I’ll bet you don’t see microsoft.windows.servermanagerworkflows as part of the list. So, next step is to get you the session config you need.

Run Register-PSSessionConfiguration -Name Microsoft.Windows.ServerManagerWorkflows cmdlet and agree to the prompts. If successful run Get-PSSessionConfiguration again and see if the workflows are listed. If they are, you should be good to go, or at least generate a new set of errors.

Cheers!