Repository navigation
get-counter -ComputerName localhost returns error #15165
Copy link
Copy link
Closed
Labels
Resolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Description
Steps to reproduce
PS C:\Users> get-counter -ComputerName localhostExpected 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>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Resolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Activity
[-]My bug report[/-][+]get-counter -ComputerName localhost returns error[/+]jdhitsolutions commentedon Jun 14, 2021
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.
iSazonov commentedon Jun 15, 2021
I guess it is local network issue. I can not repro on 7.2 (preview) release build.
But I wonder there is an assert
PowerShell/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
Line 944 in a70f915
localhostname is used.SteveL-MSFT commentedon Oct 4, 2022
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.