Are you use a high-availabilty setup?
(Get-RDConnectionBrokerHighAvailability -ConnectionBroker).ActiveManagementServer
Does this work? And, if it does, do you get the name of the server you expect?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a script which I can run locally on our ConnectionBroker, though the session has to be elevated, which manages our RDRemoteApp collections. We're trying to automate processes and remote the requirement of having someone actually log onto the ConnectionBroker to run scripts manually. To do so, we are trying to use Invoke-Command to run the script remotely.
Even though we pass credentials for a user that is in domain administrator group, the following script gives us an error when run remotely:
$server = "ConnectionBrokerName"
$collectionName ="OurCollection"
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("DOMAIN\domain_admin", $password)
$sb =
{
Import-Module RemoteDesktop
Import-Module RemoteDesktopServices
Get-RDRemoteApp -CollectionName $Using:$collectionName
}
Invoke-Command -Credential $cred -ComputerName $server -ScriptBlock $sb
This will return an error like:
A Remote Desktop Services deployment does not exist on ConnectionBrokerName.DOMAIN.COM. This operation can be performed after creating a deployment. For information about creating a
deployment, run "Get-Help New-RDVirtualDesktopDeployment" or "Get-Help New-RDSessionDeployment".
Are you use a high-availabilty setup?
(Get-RDConnectionBrokerHighAvailability -ConnectionBroker).ActiveManagementServer
Does this work? And, if it does, do you get the name of the server you expect?
The value of $collectionName needs to be passed as a parameter to the script block.
Try using (no pun intended) something like this:
$sb =
{
Import-Module RemoteDesktop
Import-Module RemoteDesktopServices
Get-RDRemoteApp -CollectionName $USING:collectionName
}