how can i open a machine for remote management in order to pass commands with powershell ?


I have two machines in the lan and i'd like to manage services on both of them.


on powershellISE i pass the following command :

  Get-Service -ComputerName  host01.tata.toto.local   -> OK
  Get-Service -ComputerName  host02.tata.toto.local   -> KO , not enough privileges.

now both machines have the service WinRM running.
on the host02.tata.toto.local  i also pass the commands :  enable-PSRemoting.  and Set-WSManQuickConfig

the second command should be opening the port and add exception to FW.

What can i check in order to compare ? both machines have lots of open ports.
How to know what's avoiding Powershell to pass the command ?

thank you in advance for your help.

Erwin PombettAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Benjamin VoglarIT ProCommented:
try to run the command with domain admin account.

You can try this way:

Invoke-Command -ComputerName host02.tata.toto.local -ScriptBlock { Get-Service  }
Benjamin VoglarIT ProCommented:
Oh, and you do not have to do enable-PSRemoting on every machine in the domain. You can set this up with Group Policy:

And you have to open port 5985 on your clients
Erwin PombettAuthor Commented:
Hello Benjamin,

thank you for your reply

1st post
- invoke command doesn't do job either.

2nd post
- sure, once this is going to be stable i will change setting with GPO.
- the port 5985 is listening

actually i'm trying to diagnostique what 's the difference. i can make changes on both machines. The host01 is ok, i dont know what to change on host02. to have same config as host01 and be able to pass my commands remotely.

thanks for further help.

The remoting used by the Get-Service cmdlet (and most cmdlets that have the -computername parameter) is different from PowerShell Remoting.  Rather going into the details, this post has some good explanation.

So, running Enable-PSRemoting has no effect on the communication used by Get-Service.  Instead you need to have WMI (DCOM) allowed through the firewall.  Appropriate permissions are also required.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.