I got a script Invoke-Command {net localgroup administrators} which only work in server 2012 & not in server 2008R2, getting error as mentioned below, even though "WinRM already is set up to receive requests on this machine."

Connecting to remote server failed with the following error message : The client cannot connect to th e destination specified in the request. Verify that the service on the destination is running and is accepting requests . Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or Win RM. 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. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken

Can you pls suggest any other way to get that script working...


The Windows RM issue is coming up because you're using Invoke-Command to run a CMD against your AD system/repository. That command may or may not be running with the appropriate privs to query AD for the admin listing.

Try using the Powershell equivalent: Get-ADGroupMember


You will still need to have the appropriate permissions, but I also suspect Powershell's error message from Get-ADGroupMember will give you much more insight than the one from Invoke-Command.

| improve this answer | |
  • I am still not able to use the Get-AdGroupMember in Server 2008 R2, but only in 2012...Pls let me know if you have any other suggestions... – V T Mar 23 '17 at 18:38
  • What error did you get? – George Erhard Mar 23 '17 at 18:44
  • The term 'get-adgroupmember' is not recognized as the name of a cmdlet, function, script file, or operable program. Che ck the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:18 + get-adgroupmember <<<< -Identity administrators + CategoryInfo : ObjectNotFound: (get-adgroupmember:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException – V T Mar 23 '17 at 18:48
  • facepalm I know why you're getting that. What version of Powershell are you running on your 2008 R2 system? It's likely PS 3.0, whereas PS 4.0 is installed by default on 2012 R2. (You can install later versions on earlier server releases, but it must be done manually.) I haven't found any indication that the cmdlet is part of an AD role installation, however. 4sysops.com/archives/… – George Erhard Mar 24 '17 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.