Jul 12, 2011 at 5:01 AM

When I try to enumerate the Terminal Servers in my Environment Powershell gives me "The format of the specified domain name is invalid".

Has anyone else encountered this?

Jan 31, 2012 at 3:00 PM

Hi, I'm also encountering this.  Have you been able to get around it at all?  Thanks. 

Feb 23, 2012 at 11:47 AM

This looks like a great tool as Import-ServerManager does not seem to be an option for Window 7 clients, there no RDS mod.  Though the discussion board seems to indicate some issues. 

Mar 30, 2012 at 2:20 AM

I have exactly the same error.
Moreover, it appears and disappears.

The error links to:

PSTerminalServices.psm1:1376 symbol:24
+         $TSManager.GetServers <<<< ($DomainName)
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DotNetMethodException

Everything works after restarting the computer.

Sep 27, 2012 at 7:05 PM

Has anyone figured out how to get around this? Is there a fix? I am using this command:


Get-Content .\Servers.txt | Foreach-Object{Get-TSSession -State Disconnected -ComputerName $_}


And it hits the first server in the list and then gives me the message below:

Exception calling "GetSessions" with "0" argument(s): "The RPC server is unavailable"At C:\Users\jcouch1\Documents\WindowsPowerShell\Modules\PSTerminalServices\PSTerminalServices.psm1:219 char:44+                     $session = $TSRemoteServer.GetSessions <<<< ()    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException    + FullyQualifiedErrorId : DotNetMethodException

After the first run, I continue to get the same message on repeated runs immediately without hitting the first server.

Jun 28, 2013 at 8:42 PM
Edited Jun 28, 2013 at 8:46 PM

Are you using Windows Server 2008 R2 ?

Be sure Netbios is enabled and try starting the "Computer Browser" services and wait for a while.....

Then try again...
Oct 1, 2013 at 12:29 AM
Edited Oct 1, 2013 at 12:29 AM
I am using Windows 7 professional edition and encountered this same error.

Shall I also enable Netbios and start computer browser service?
Nov 11, 2014 at 2:21 PM
This just bit me, it had been working great for well over a year and now no matter what computer we run it on anywhere in the domain we get the following error:

Exception calling "GetServers" with "1" argument(s): "The format of the specified domain name is invalid"
At C:\Users\<myuser>\Documents\WindowsPowerShell\Modules\psterminalservices\PSTerminalServices.psm1:1376 char:3
  • $TSManager.GetServers($DomainName)
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : Win32Exception
I have tried to specify both computername and domainname as part of my command line:
Get-TSServers -DomainName MyDomain.Local

Same result...

Stepping through the function inside of a debugger, I've found the trouble is where/when it gets to the following:
$TSManager = New-Object Cassia.TerminalServicesManager

In this instance, I've verified $Domainname is a string containing the simple NetBios name of my domain. Still, upon execution it throws the aforementioned error.

Like I said, this seems to have hit us all at once. The Get-TSSession commandlet still works, it's only the Get-TSServers comandlet that doesn't.

Many thanks for any suggestions or advice.