|Home||Back to Index|
First, I found Keith Hill’s Free PowerShell EBook that I’d previously mentioned quite valuable. Recommended.
Here’s another reference you’ll want: Bruce Payette’s Windows PowerShell Refcard.
And a few more links:
This is a relatively advanced topic, and is not required to use PowerShell. However, it’s something I’m interested in. I’d like to try creating DSLs (Domain-Specific Languages) in PowerShell.
Allegedly, the Windows PowerShell SDK is required. The installation instructions are unnecessarily complex. Why can’t Microsoft give us a “download just the PowerShell SDK and nothing else” link? Why do I have to install the Windows Server 2008 SDK?
Once you’ve installed the relevant portions (read the download instructions carefully), you’ll then need to locate the relevant DLL to reference. If you read way down on this article on the Windows PowerShell Blog, you’ll learn that “Reference assemnblies are installed as part of SDK installation under ‘Program Files\Reference Assemblies\Microsoft’". On my system, this is:
C:\Program Files\Reference Assemblies\Microsoft\ WindowsPowerShell\v1.0
and the assembly that your project must reference is:
Oddly, the folder timestamp showed that it was created on my PC long before I installed the SDK. I checked another PC that just had PowerShell and Visual Studio installed and found this assembly at the above location. In other words, I do not believe that you need to install the SDK.
To create a cmdlet in C# or VB.NET:
To install the new cmdlet in PowerShell:
When testing, you can use the /u switch with installutil to uninstall a snap-in.
Just a thought, but wouldn’t it have been simpler to have a PlugIn folder where you could drop DLLs that PowerShell would recognize and load on startup? The current process smacks of COM to me.
You can also write your own provider. Get-PSProvider lists the current providers, which allow PowerShell to treat various hierarchies like file systems on drives.