Running Get-Counter remotely on to a Windows 7 client

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of James Booth James Booth 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34834
    Profile photo of James Booth
    James Booth
    Participant

    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

    However...

    • 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?

    Cheers.

    #34852
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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
    Profile photo of James Booth
    James Booth
    Participant

    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!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.