Avatar of nav2567
Flag 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.  

PowershellWindows Server 2012Windows Server 2008

Avatar of undefined
Last Comment

8/22/2022 - Mon

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:

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:


I do not see "Allow Remote Server management through WinRM" in WinRM Service inside the computer configuration.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

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.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question