Home Blog Discovering CommandAnalysis Tool
 

Discovering CommandAnalysis Tool

The yellow label “CommandAnalysis” in the center of the horizontal console scrollbar is not just a label. It is a thumb. You can drag it upwards to slide in a pretty sophisticated tool! Here is a quick intro video:

 

Discover Parameter Binding!

If you ever wondered just how PowerShell binds arguments to cmdlet and function parameters, click the button “Cmdlet”. Next, enter an interactive command in the console. The CommandAnalysis shows you exactly what PowerShell does to bind arguments. This becomes essential when you use positional parameters, or when you pipe data into a cmdlet.

When you pipe data, the CommandAnalysis shows you which parameter actually receives the pipeline data, and why. Hover over the command inside the CommandAnalysis pane to discover even more details.

Or click the button “Binding”: now you can see the binding process in a treeview. Each parameter affected by the previous command can be expanded, and you can read the rationale behind PowerShells decision to bind a value to a particular parameter – or why it did not bind.

See Object Types On The Fly!

PowerShell is object-orientied, but you can’t see this sophisticated nature easily. Except if you open CommandAnalysis, then click on “Member”. When you now enter a command, the pane will always run a Get-Member for you on the last command, and display the object type and object members. This even works for primitive data, so when you enter numbers or strings in the console, you can discover these as well.

Or click on the “Data” tab: now you see a piece of sample data from the results of the last command, and you can dive into the actual object nature of this sample object.

Beware: Use Only As Directed!

CommandAnalysis is a tool to discover PowerShell intrinsics, so please expand it  only when needed. It will *significantly* slow down execution of code. Make sure you slide CommandAnalysis down completely when done, to turn off the real-time command analysis.

 

Facebooktwittergoogle_pluspinterestlinkedinFacebooktwittergoogle_pluspinterestlinkedin  rssrss
The following two tabs change content below.

Tobias

PowerShell Wizard at scriptinternals
I love to create things and master challlenges. That's why I love PowerShell so much. I am a 10+ year Microsoft MVP, have written more than a 100 IT-related books with Microsoft Press and others, and like to expain complex things in a simple and understandable way. I am giving PowerShell trainings throughout Europe and organize the annual German PS Community Conference.