2

I had posted a question but it hasn't been answered and there has been no activity on it lately so I'm reposting. Sorry if thats the incorrect way of doing things but I have been struggling to get this going all week.

I am trying to run a script that installs a program remotely for a user in my domain. I can run the script fine on my own computer but when I run the script for a different computer in the domain I get the error of

Connecting to remote server (computername) failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic

I have configured winRM and the winRM GPO, I have turned off the firewall and yet I keep getting the same error. I feel that I have exhausted all options so would love some help.

Things I have tried:

  • Checked if Firewall was blocking port
  • Configured winRM through a GPO on the domain, ipv4 and ipv6 are listening on *
  • Ran Enable-PSRemoting -Force and winrm /quickconfig on both computers
  • Ran winrm id -r:(mymachine) which works on mine but not on the computer I'm trying to remote to as I get the error:
WSManFault
    Message = WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet.

Error number:  -2144108250 0x80338126
WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet.
  • Running telnet (TargetMachine) 5985 fails with error Connecting To (ComputerName)...Could not open connection to the host, on port 5985: Connect failed
  • When I run 'winrm get winrm/config' and 'winrm get wmicimv2/Win32_Service?Name=WinRM' I get output of:
Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false
        Auth
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts = ()ComputerName)
    Service
        RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 1500
        EnumerationTimeoutms = 240000
        MaxConnections = 300
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = false
        Auth
            Basic = false
            Kerberos = true
            Negotiate = true
            Certificate = false
            CredSSP = false
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = * [Source="GPO"]
        IPv6Filter = * [Source="GPO"]
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
        AllowRemoteAccess = true [Source="GPO"]
    Winrs
        AllowRemoteShellAccess = true
        IdleTimeout = 7200000
        MaxConcurrentUsers = 2147483647
        MaxShellRunTime = 2147483647
        MaxProcessesPerShell = 2147483647
        MaxMemoryPerShellMB = 2147483647
        MaxShellsPerUser = 2147483647

Win32_Service
    AcceptPause = false
    AcceptStop = true
    Caption = Windows Remote Management (WS-Management)
    CheckPoint = 0
    CreationClassName = Win32_Service
    DelayedAutoStart = null
    Description = Windows Remote Management (WinRM) service implements the WS-Management protocol for remote management. WS-Management is a standard web services protocol used for remote software and hardware management. The WinRM service listens on the network for WS-Management requests and processes them. The WinRM Service needs to be configured with a listener using winrm.cmd command line tool or through Group Policy in order for it to listen over the network. The WinRM service provides access to WMI data and enables event collection. Event collection and subscription to events require that the service is running. WinRM messages use HTTP and HTTPS as transports. The WinRM service does not depend on IIS but is preconfigured to share a port with IIS on the same machine.  The WinRM service reserves the /wsman URL prefix. To prevent conflicts with IIS, administrators should ensure that any websites hosted on IIS do not use the /wsman URL prefix.
    DesktopInteract = false
    DisplayName = Windows Remote Management (WS-Management)
    ErrorControl = Normal
    ExitCode = 0
    InstallDate = null
    Name = WinRM
    PathName = C:\WINDOWS\System32\svchost.exe -k NetworkService -p
    ProcessId = 15760
    ServiceSpecificExitCode = 0
    ServiceType = Share Process
    Started = true
    StartMode = Auto
    StartName = NT AUTHORITY\NetworkService
    State = Running
    Status = OK
    SystemCreationClassName = Win32_ComputerSystem
    SystemName = (ComputerName)
    TagId = 0
    WaitHint = 0
  • I can also do things like create a folder on the target computer. But performing an install of a program on the target computer fails.

I can't remember at the moment of every exact little thing I have tried but if you suggest something I can verify that I have tried it.

I have followed many suggestions online which includes Remote PowerShell, WinRM Failures: WinRM cannot complete the operation

but still.. nothing.

4
  • Is 'Windows remote management' service running on the target machine? Is someone listening port 5985 on the target machine (see e. g. netstat)?
    – Vadim
    Feb 10, 2020 at 20:09
  • @vadim Yes and Yes
    – josh
    Feb 10, 2020 at 20:51
  • It looks like firewall somewhere (on source, target, between). Check with nmap - port is 'closed' or 'filtered'. Check from another machine/network.
    – Vadim
    Feb 11, 2020 at 3:53
  • Try running a packet capture software (Wireshark, Microsoft Network monitor, etc) on the send/receive machines to see what happens. Additionally, try scanning the available ports on the machines with a tool like Nessus/nmap to confirm that they are open. Make sure the hostnames can be resolved in DNS. Feb 12, 2020 at 22:19

0

You must log in to answer this question.

Browse other questions tagged .