Over the last week, I decided to create a test cmdlet. That is, an actual cmdlet, written in C# and imported into PowerShell.
I've wanted to write a cmdlet since I found out what they are. The are only two reason not to:
- It does involve a few extra steps between the code and being able to run it in PowerShell.
- There isn't any reason for individual scripters to write cmdlets.
The point is well taken, though. You can write all kinds of functionality in a function. You can also create cmdlet-looking scripts that you can export as modules. Doing it in C# in a separately compiled file doesn't add much unless you want to re-use some existing code or you need to optimize code or have some other good reason.
But I went ahead and did it anyway -- at least well enough to compile and to get PowerShell to read the contents of the module.
No comments:
Post a Comment