This project is read-only.

Error occurs executing PAL.ps1 from different working directory in PowerShell


In a project I'm working on, I have a consolidated performance testing script that runs through a few utilities to execute a performance test then runs PAL to analyze the performance counters. PAL resides in a subfolder below the consolidated script:

  • PerfTest.ps1
  • /Tools
    • /PAL_2.7.7
      • PAL.ps1
      • ...
PerfTest.ps1 invokes PAL as follows:
& "${PSScriptRoot}\Tools\PAL_2.7.7\PAL.ps1" <Args Here>

If executing PerfTest.ps1 from its root directory, when PAL.ps1 is invoked it immediately fails with an error of being unable to find PalGenerateCounterStats.ps1, due to the fact that the relative path is simply .\PalGenerateCounterStats.ps1.

This same issue affects PalGenerateMultiCounterStats.ps1 and any XML inheritance for the threshold files. I will be attaching a patch momentarily, but wanted to have a bug to reference.