Link to home
Start Free TrialLog in
Avatar of nav2567
nav2567Flag for United States of America

asked on

cannot execute PS command remotely

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.
Avatar of nav2567
nav2567
Flag of United States of America image

ASKER

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

Please advise.
Avatar of becraig
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
Avatar of nav2567

ASKER

I do not see "Allow Remote Server management through WinRM" in WinRM Service inside the computer configuration.
Avatar of nav2567

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of becraig
becraig
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial