get-counter issue with -computer parameter (#15166)

* get-counter issue fixed

* Update src/Microsoft.PowerShell.Commands.Diagnostics/GetCounterCommand.cs

Co-authored-by: Krishna Yalavarthi <kryalava@microsoft.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
authored and GitHub committed 2021-04-12 14:16:31 -07:00
1 parent a6abf16941
commit 8a3e02dcf7
1 file changed
+3 -2
@@ -587,13 +587,14 @@ namespace Microsoft.PowerShell.Commands
{
foreach (string machine in ComputerName)
{
string slashBeforePath = path.Length > 0 && path[0] == '\\' ? string.Empty : "\\";
if (machine.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase))
{
retColl.Add(machine + "\\" + path);
retColl.Add(machine + slashBeforePath + path);
}
else
{
retColl.Add("\\\\" + machine + "\\" + path);
retColl.Add("\\\\" + machine + slashBeforePath + path);
}
}
}