Skip to content

[Issue] SimplePerf fails on workstations due to localhost #1075

@bill-long

Description

@bill-long

Describe the issue
Attempting to use SimplePerf on a workstation fails. The logman stop command fails, and the collector collects no data anyway:

PS C:\Users\Administrator.lab1\Downloads> .\SimplePerf.ps1 -Start -Verbose

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust
this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run
C:\Users\Administrator.lab1\Downloads\SimplePerf.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
LAB1WK1: Removing existing SimplePerf collector.
LAB1WK1: Getting list of counters.
LAB1WK1: Applying filters.
LAB1WK1: The following counters matched the specified filters:
LAB1WK1: \\localhost\.NET CLR Exceptions(*)\*
LAB1WK1: \\localhost\.NET CLR Loading(*)\*
LAB1WK1: \\localhost\.NET CLR LocksAndThreads(*)\Contention Rate / sec
LAB1WK1: \\localhost\.NET CLR Memory(*)\*
LAB1WK1: \\localhost\HTTP Service Request Queues\*
LAB1WK1: \\localhost\LogicalDisk(*)\*
LAB1WK1: \\localhost\Memory\*
LAB1WK1: \\localhost\Netlogon(*)\*
LAB1WK1: \\localhost\Network Interface\*
LAB1WK1: \\localhost\Paging File(*)\*
LAB1WK1: \\localhost\PhysicalDisk(*)\*
LAB1WK1: \\localhost\Process(*)\*
LAB1WK1: \\localhost\Processor(*)\*
LAB1WK1: \\localhost\Processor Information(*)\*
LAB1WK1: \\localhost\Server\*
LAB1WK1: \\localhost\System\Context Switches/sec
LAB1WK1: \\localhost\System\Processor Queue Length
LAB1WK1: \\localhost\TCPv4\*
LAB1WK1: \\localhost\TCPv6\*
LAB1WK1: Creating SimplePerf collector, writing to C:\SimplePerf\220523112350.
The command completed successfully.
LAB1WK1: Starting SimplePerf collector.
The command completed successfully.
PS C:\Users\Administrator.lab1\Downloads> .\SimplePerf.ps1 -Stop

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust
this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run
C:\Users\Administrator.lab1\Downloads\SimplePerf.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
LAB1WK1: Stopping SimplePerf.

Error:
Unable to connect to the specified computer or the computer is offline.

It appears that the use of localhost is blocked on workstations. If I change it to use $env:COMPUTERNAME it works:

PS C:\> C:\Users\Administrator.lab1\Downloads\SimplePerf.ps1 -Start -Verbose
LAB1WK1: Removing existing SimplePerf collector.
LAB1WK1: Getting list of counters.
LAB1WK1: Applying filters.
LAB1WK1: The following counters matched the specified filters:
LAB1WK1: \\LAB1WK1\.NET CLR Exceptions(*)\*
LAB1WK1: \\LAB1WK1\.NET CLR Loading(*)\*
LAB1WK1: \\LAB1WK1\.NET CLR LocksAndThreads(*)\Contention Rate / sec
LAB1WK1: \\LAB1WK1\.NET CLR Memory(*)\*
LAB1WK1: \\LAB1WK1\HTTP Service Request Queues\*
LAB1WK1: \\LAB1WK1\LogicalDisk(*)\*
LAB1WK1: \\LAB1WK1\Memory\*
LAB1WK1: \\LAB1WK1\Netlogon(*)\*
LAB1WK1: \\LAB1WK1\Network Interface\*
LAB1WK1: \\LAB1WK1\Paging File(*)\*
LAB1WK1: \\LAB1WK1\PhysicalDisk(*)\*
LAB1WK1: \\LAB1WK1\Process(*)\*
LAB1WK1: \\LAB1WK1\Processor(*)\*
LAB1WK1: \\LAB1WK1\Processor Information(*)\*
LAB1WK1: \\LAB1WK1\Server\*
LAB1WK1: \\LAB1WK1\System\Context Switches/sec
LAB1WK1: \\LAB1WK1\System\Processor Queue Length
LAB1WK1: \\LAB1WK1\TCPv4\*
LAB1WK1: \\LAB1WK1\TCPv6\*
LAB1WK1: Creating SimplePerf collector, writing to C:\SimplePerf\220523114936.
The command completed successfully.
LAB1WK1: Starting SimplePerf collector.
The command completed successfully.
PS C:\> C:\Users\Administrator.lab1\Downloads\SimplePerf.ps1 -Stop
LAB1WK1: Stopping SimplePerf.
The command completed successfully.

I'm unsure if we should default to $env:COMPUTERNAME. Is there any downside? We need a switch at the very least. The goal is to let SimplePerf run everywhere.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions