Thursday, September 19, 2013

Use Processmonitor to debug command line syntax passed through PowerShell

If you are trying to find out why a certain formatted command within PowerShell is not working then I strongly recommend using ProcessMonitor tool from SysInternals suite of tools.  When you initially fire up the ProcessMonitor then it will show you lots of information and it can be overwhelming. 
So there is a powerful filtering functionality built into the utility.  Click on the filter tab and click on filter.
Then on the filter section add two filters as shown in the figure below.
The first filter is Path is “C:\Program Files\7-zip\7z.exe” and second one is Operation is “Load Image”.  After applying the filter and running my PowerShell script I can narrow down my desired line.
So if next time any command line utility is behaving weird then debug using ProcessMonitor.

No comments:

Post a Comment