Running Get-Counter remotely on to a Windows 7 client

Welcome Forums General PowerShell Q&A Running Get-Counter remotely on to a Windows 7 client

This topic contains 2 replies, has 2 voices, and was last updated by

3 years, 1 month ago.

  • Author
  • #34834

    Points: 0
    Rank: Member

    Hi again guys,

    I'm playing around with Get-Counter, but I've got really odd issue. If I try to run Get-Counter -ComputerName XXX to a Windows 7 client, i get

    Get-Counter : Unable to connect to the specified computer or the computer is offline.
    At line:1 char:1
    + Get-Counter -ComputerName 'MY-WIN7-CLIENT -Counter "\Memory\Available M ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidResult: (:) [Get-Counter], Exception
        + FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

    The command I'm using is Get-Counter -ComputerName 'MY-WIN7-CIENT' -Counter "\Memory\Available MBytes" -Continuous | Out-GridView.

    • I've made sure the machine is online & DNS resolves
    • I've tried it from Windows Server 2012 R2 and from another Windows 7 client
    • I can Enter-PSSession and run the command locally
    • I can actually connect via the perfmon gui
    • I have disabled firewalls on both my server and client to test
    • I've upgraded the Windows 7 clients to WMF 4/Powershell 4.0
    • I've tried using different counters and also removing -ComputerName parameter and directly entering it into -Counter "\\MY-WIN7-CLIENT\..."
    • I've tried multiple Windows 7 clients and Server 2012 R2 servers


    • If I run the command on the Windows 7 client including the -ComputerName and use the computer's name, it still fails (Although, it seems a lot of people get this issue)
    • I can successfully run the command from Server 2012 R2 to Server 2012 R2
    • I can successfully run the command from Windows 7 to Server 2012 R2
    • It fails if I run the command from Server 2012 R2 or Windows 7 to Windows 7

    Anyone had any joy with this? Is this just a limitation of Windows 7?


  • #34852

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    It may just be a bug in how the command is dealing with it's internal remote connectivity. I'm not even sure what protocol it's trying to use – I'd have to either decompile the command or sniff the traffic.

    Using Invoke-Command would be the best workaround I could offer.

  • #34874

    Points: 0
    Rank: Member

    Heh, all the time I spent trying to troubleshoot it and I never thought of using Invoke-Command. Sometimes the best answers are the simplest ones. I was worried at first that Out-Grid would't work, but I cane pipe Invoke-Command { Yada yada } to it!

    Thanks for the metaphorical slap around the head!

The topic ‘Running Get-Counter remotely on to a Windows 7 client’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort