Newsgator PowerShell Provider is almost ready!
I worked for about 4-5 hours tonight on my Newsgator PowerShell provider. I just need to code up the right way to read a post, and I’m good to go (for an initial “release”). Eventually I’d like to support every operation the Newsgator API does (including adding/deleting/moving/etc. folders and feeds), but for now it’ s purely a read-only view.
Here are two resources I found helpful tonight as I did some research:
- The PowerShell Programmer’s Guide is up at microsoft.com, although they did a lot of teasing (more below).
- Bart De Smet’s Blog — specifically a post about creating a PowerShell SnapIn. The new documentation put up by MS had about 95% of the information about creating a SnapIn, but Bart supplied that last always-critical 5%. Thanks!
The MS PowerShell documentation will be nice… when it’s done. For now, it was mildly helpful (some decent info) but I kept getting mad at sections like this that were all over the place: (notice the missing code sample!!!)
Creating Drive State Information
All PowerShell providers are considered stateless, which means that your drive provider needs to create any state information that is needed by the PowerShell runtime when it calls your provider.
For this drive provider, state information includes the connection to the database that is kept as part of the drive information. Here is code that shows how this information is stored in the PSDriveInfo object that describes the drive.
[Aaron’s note: Ahem, code? Anyone seen code? Code?]
Creating a Drive
To allow the PowerShell runtime to create a drive, the drive provider must implement the NewDrive method. The following code shows the implementation of the NewDrive method for this drive provider.
[Aaron’s note: Again, where’s the code?]
I was fine without the code—I was able to figure it out in a reasonable amount of time—but I felt so teased. Mocked even. Oh well.
August 22nd, 2007 at 11:29 pm
Thanks Jeffrey!
I’ve submitted a CodePlex project request that was accepted, I’m just waiting in the queue to have the project created. Once it’s created, I’ll upload everything I’ve got and it will all be available. I’m a big fan of making personal projects available with full source and no strings attached.
August 22nd, 2007 at 11:29 pm
I hear you on the PowerShell documentation for providers. We’ll see about getting that improved for the V1 release.
I can’t wait to get your provider. Are you going to provide the sourcecode or just the binaries?
Jeffrey Snover [MSFT]
Windows PowerShell/Aspen Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx