cannot execute PS command remotely

nav2567
nav2567 used Ask the Experts™
on
I need to run a PS command on a lot of remote computer but I am getting an error: The client cannot connect to the destination specified in the request..  

AFter some research, the "winrm quickconfig" needs to be run on each server in order for command like "winrs -r:server1 dir" to work.

I have a lot of servers.  Is there another way to run "winrm quickconfig" from remote?

Please advise.  

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
To be specific, I need to execute the "wmic csproduct get name" command on a lot of servers.  

Please advise.
You can do this via group policy if that option is available to you.

Here is a nice how-to:
http://www.briantist.com/how-to/powershell-remoting-group-policy/

Steps reprinted from link above:
Enabling WinRM

    Browse to:
    Policies > Administrative Templates > Windows Components > Windows Remote Management (WinRM) > WinRM Service

        Open the “Allow Remote Server management through WinRM” policy setting (Server 2008 R2 and later).
        Open the “Allow automatic configuration of listeners” policy setting (Server 2008 and earlier).
    Set the Policy to Enabled.
    Set the IPv4 and IPv6 filters to * unless you need something specific there (check out the help on the right).

Setting the Firewall Rules

    Browse to:
    Policies > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile
    Open the “Windows Firewall: Define inbound port exceptions” policy setting.
    Set it to Enabled if it isn’t already.
    Click the “Show…” button and add the port exception. We’re going to be opening TCP port 5985, so the exception string will look something like this:

    5985:TCP:*:enabled:WSMan

Author

Commented:
I do not see "Allow Remote Server management through WinRM" in WinRM Service inside the computer configuration.

Author

Commented:
From the local GPEDIT.MSC, I see "Allow Remote Server management through WinRM" on my Windows 2012 servers and see “Allow automatic configuration of listeners” on my Windwos 2008 servers.

When I created the GPO from my Windows 2008 DC, do I just enable “Allow automatic configuration of listeners” and expect an enable in "Allow Remote Server management through WinRM" on my Windows 2012 servers if I put them in the same OU that link to that GPO?

PLease advise.
When I created the GPO from my Windows 2008 DC, do I just enable “Allow automatic configuration of listeners” and expect an enable in "Allow Remote Server management through WinRM" on my Windows 2012 servers if I put them in the same OU that link to that GPO?

Yes that is correct you can use those settings and link to that OU.
That will get you up to where you need to be.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial