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

Hello.

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

machines:
  host01.tata.toto.local
  host02.tata.toto.local

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.

toshi
Erwin PombettAsked:
Who is Participating?
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  }
0
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:

http://www.grouppolicy.biz/2014/05/enable-winrm-via-group-policy/

And you have to open port 5985 on your clients
0
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.

toshi
0
footechCommented:
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.
http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/23/an-introduction-to-powershell-remoting-part-one.aspx

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.
0

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
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.