So was I so I delved into the world of the Powershell Parser and the AST to develop the PoSHProfiler.
PoshProfiler is a proof of concept project demoing the use of the Powershell parser and its ability to break a script down into its sub-parts (Abstract Syntax Tree). In this demo I have used the parser to insert instrumentation code into the original script allowing me to measure statement execution time. The tool further allows me to launch the script in its own process which we can then obtain performance counter data to get a better big picture around what the impact of running the target script results in.
download to and start kicking the tires. Please subscribe to be sure you're alerted when updates are uploaded.