Skip to content

get-counter -ComputerName localhost returns error #15165

Closed

Description

@krishnayalavarthi

Steps to reproduce

PS C:\Users> get-counter -ComputerName localhost

Expected behavior

It should show the counters on local machine as this.
PS C:\Users> get-counter -ComputerName localhost

Timestamp                 CounterSamples
---------                 --------------
4/5/2021 10:40:56 PM      \\machine-name\network interface(intel[r] ethernet connection [2] i219-lm)\bytes total/sec :
                          40043.808440110326

                          \\machine-name\network interface(teredo tunneling pseudo-interface)\bytes total/sec :
                          0

                          \\machine-name\processor(_total)\% processor time :
                          3.4426578082911163

                          \\machine-name\memory\% committed bytes in use :
                          84.483113508784

                          \\machine-name\memory\cache faults/sec :
                          201.8730016946339

                          \\machine-name\physicaldisk(_total)\% disk time :
                          0.12240490075025934

                          \\machine-name\physicaldisk(_total)\current disk queue length :
                          0



PS C:\Users>

Actual behavior

PS C:\Users> get-counter -ComputerName localhost
Get-Counter: The default values for this command failed. Error: 800007d0.
Get-Counter: Unable to connect to the specified computer or the computer is offline.
Get-Counter: The default values for this command failed. Error: 800007d0.
Get-Counter: Unable to connect to the specified computer or the computer is offline.
Get-Counter: The default values for this command failed. Error: 800007d0.
Get-Counter: Unable to connect to the specified computer or the computer is offline.
Get-Counter: The default values for this command failed. Error: 800007d0.
Get-Counter: Unable to connect to the specified computer or the computer is offline.
Get-Counter: The default values for this command failed. Error: 800007d0.
Get-Counter: Unable to connect to the specified computer or the computer is offline.
Get-Counter: The default values for this command failed. Error: 800007d0.
Get-Counter: Unable to connect to the specified computer or the computer is offline.
PS C:\Users>

Environment data


PS C:\Users> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\Users>

Activity

  1. changed the title [-]My bug report[/-] [+]get-counter -ComputerName localhost returns error[/+] on Apr 6, 2021
  2. jdhitsolutions commented on Jun 14, 2021

    @jdhitsolutions
    Collaborator

    I can't duplicate this in PowerShell 7.1.3 on Windows 10. According to your version table, you are a bit behind so this may not really be an issue.

  3. iSazonov commented on Jun 15, 2021

    @iSazonov
    Collaborator

    I guess it is local network issue. I can not repro on 7.2 (preview) release build.

    But I wonder there is an assert

    Debug.Assert(machineNameMassaged == System.Environment.MachineName.ToLowerInvariant());
    which throw if localhost name is used.

  4. SteveL-MSFT commented on Oct 4, 2022

    @SteveL-MSFT
    Member

    The cmdlet is just passing the computername to the underlying PDH API which, I believe, uses RPC for remoting. So this doesn't appear to be a PS7 specific issue.

  5. added
    Resolution-ExternalThe issue is caused by external component(s).
    and removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Oct 4, 2022
  6. ghost closed this as completedon Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-ExternalThe issue is caused by external component(s).WG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions