Here’s a neat trick to make it easier to launch CMTrace (and smscfgrc.cpl) from the Run box and command line: Add the ConfigMgr client path to the PATH variable! Let’s do it via a configuration item:
Detection Script: To detect if it is already present, we get the existing contents of the PATH variable via the GetEnvironmentVariable method (more on this later), break it down into an array, and then loop through all of the entries, looking for a match.
Remediation Script: To remediate the configuration, we combine the contents of the current PATH variable, add the CCM directory to it, and use the SetEnvironmentVariable method to save the changes.
The reason we need to use SetEnvironmentVariable and not just setting
$env:Path directly is so the changes are persisted beyond the current session. Because of this, I chose to also use GetEnvironmentVariable to remain consistent.
Now you can do stuff like this without having to fully qualify the path or browsing to it!