More XML with PowerShell
Posted on 8 Mar 2007 at 11:36
With help from shiny power, Thomas Lee gets serious with PowerShell, updating the XML order document and using the xml reader class.
Then you add a <command> element for each of the cmdlets that are registered by your snap-in. Within each <command> element, you include:
a Command-Details node to provide meta-information, such as the cmdlet name and a short cmdlet description.
a Description node that contains a detailed cmdlet description.
a Command-Syntax node that describes the syntax. You can specify multiple Command-Syntax item nodes if you have multiple property sets.
a Command-Parameters node describing the cmdlet's parameters.
Command-InputTypes node describing input parameters.
a Command-ReturnValue node that identifies the object type passed back to the command line.
If you're developing your own cmdlets, the Community Extensions project I mentioned earlier provides a Get-CmdletMaml cmdlet that will assist in creating your MAML help file. Get-CmdletMaml uses the .NET reflection capability to look inside your cmdlet's DLL file, find all types with the CmdletAttribute and generate a skeleton MAML Help file. And if you've documented your cmdlet in your code, Get-CmdletMaml can retrieve this documentation text and automatically produce a Help file for your cmdlet.
ShinyPower
I've been using PowerShell for a while now, but I can't always remember all the switches and syntax of every cmdlet. When I was first getting started, I spent a lot of time using the Get-Help cmdlet (still do occasionally!), but you'll quickly find that the PowerShell console window isn't the best or easiest way to browse PowerShell's Help documentation. One neat PowerShell add-on is ShinyPower, shown in the screenshot below, a small application that helps you browse the built-in Help that comes with PowerShell. ShinyPower is a free tool, published under the Microsoft Shared Source Permissive Licence. For more information on ShinyPower or to download it, see www.codeplex.com/ShinyPower.
If you know the structure of an XML document, you can easily manipulate that document with PowerShell; if you don't know its structure, you can still use PowerShell to discover and exploit the structure of the document. The DOM model is simpler to code, but can be less efficient in operation, particularly in memory usage. If you have any comments on this column or can provide suggestions for future columns, feel free to email me at Thomas.Lee@GlobalKnowledge.Net.
advertisement
- Getting to grips with Microsoft's IT Health Environment Scanner
- Virtualise your servers
- The changing face of travel gadgets
- Build your own distributed file system
- The bulletproof Dell that costs an arm and a leg
- Microsoft Office 2010 Technical Preview: Q&A
- Lawnmowers, the TyTN II and one odd insurance request
- There'll never be a bulletproof OS
- How far can we trust apps?
- Five nice touches in Outlook 2010
- Why Britain's watchdogs have fewer teeth than goldfish
- Tabbed documents: how to make Office 2010 great
- Outlook 2010 People Pane – does it spell death to Xobni
- Microsoft Outlook 2010 screenshots
- Co-Authoring in Word 2010 and SharePoint Foundation 2010
- Microsoft Outlook 2010 screenshots: Backstage view
- Flash 10.1: Developing for Desktop and Device
- Microsoft Office 2010 screenshots: Recover unsaved items
- Microsoft Word 2010 screenshots: Text Effects
- Microsoft Word 2010: inserting screenshots
- Q&A: Why Conficker was a victim of its own success
- App developers losing faith in Android
- Biz Stone: Murdoch's Google veto will "fail fast"
- Google adds automatic captions to YouTube
- China ramps up cyber spying
- Mozilla maintains dependence on Google
- Windows 7 flying off the shelves
- Google Chrome OS: full details unveiled
- AOL slashes 2,500 jobs
- YouTube begins streaming full-length shows
advertisement
Printed from www.pcpro.co.uk

