Productivity Tools

Tools written by an IT business manager, a passionate developer.

PSCmdlet

It is base class for Powershell Cmdlets. It provides structure of the commands and helps to write modular and clean.

After adding reference to ProductivityTools.PSCmdlet new class should be crated which will deliver from PSCmdlet.PSCmdletPT.

Next step is creating commands. The best way to have it organized is to create new Commands directory and put all command there. Each command should deliver from PSCmdlet.PSCommandPT<T>. Generic T should be type of Cmdlet so in described case: GetDownloadExamination. Additionally command should implement abstract PSCmdletPT abstract methods.

 

For further purpose lets add some code to Invoke method

Next commands should be used in PSCmdlet and use it:

Debugging

To debug fast module in the project properties in the Start external program put:

And for the command line parameters something similar to:

Then after running project using F5 new powershell window will show up and you will be able to use the command:

Help

Module by default adds Help parameter which writes content of the Parameter and Cmdlet attribute.