210 likes | 344 Views
WCL404. Turning PowerShell Commands into Reusable CLI and GUI Tools. Don Jones Senior Partner and Principal Technologist Concentrated Technology, LLC. Welcome!. PowerShell is great for running commands…
E N D
WCL404 Turning PowerShell Commands into Reusable CLI and GUI Tools Don Jones Senior Partner and Principal Technologist Concentrated Technology, LLC
Welcome! • PowerShell is great for running commands… • …But you’ll inevitably want to make those more complex, then “wrap” them in a way that makes them easier for others to consume and re-use • In other words… you’ll want to become a Toolmaker
A Bit About Me • Don Jones • Windows PowerShell MVP • Independent trainer (http://ITPro.ConcentratedTech.com) • Author Learn Windows PowerShell in a Month of Lunches • Windows PowerShell Scripting and Toolmaking (self-pub’d) • Columnist, http://TechNetMagazine.com and http://RedmondMag.com
A Bit About You • You should be very capable with whatever administrative task you’re trying to complete • You should have a strong familiarity with running command-line tools in PowerShell (including cmdlets) • You don’t specifically need a scripting or programming background… but it sure won’t hurt
A Bit About This Session • It’s about 99% demo. • There are “reminder slides” with key bits of syntax, so you don’t have to jot those down, but I won’t specifically cover those slides. • Everything you need for reference is in PowerShell – I’ll highlight key help file names when the time comes • I’ll save my scripts and offer them for download – watch my Twitter feed @concentrateddon for the URL
demo Turning a Command into a “Cmdlet”
Advanced Function Template • Function Do-Something { • [CmdletBinding()] • param( • [Parameter(Mandatory=$True)] • [Alias("whatever")] • [string]$something = 'Default' • ) • PROCESS {} • }
Help Files • About_functions_advanced • About_functions_advanced_parameters • About_modules
Now a GUI • The goal here will be to use Windows Forms to create a simple GUI utility that can be packaged into an EXE (PowerShell still needed to run) and distributed to end users • I will be using a third-party tool, SAPIEN PrimalForms, for this. It’s available in a free Community Edition as well as a paid commercial version.
demo Making a GUI Tool
Reminder! • Watch my Twitter feed @concentrateddon for the download URL for these scripts • The GUI builder I’ve been using is SAPIEN PrimalForms (www.sapien.com); they’re in the Expo hall if you’d like to talk to them. A free Community Edition is available.
Any Final Questions? • I will be in the TechEd Bookstore signing copies of Learn Windows PowerShell in a Month of Lunches • I’ll also be hanging at “The Scripting Guys” pod in the Expo Hall • Please drop by and let me know what you think, or ask follow-up questions! • You can post questions to me at http://bit.ly/AskDon • And again, that Twitter address is @ConcentratedDon • Thank you!
Related Content • WCL404: Building Reusable CLI and GUI Tools in PowerShell WSV07-TLC: Windows Server 2012 Server Manager and PowerShell DBI331: The Dirty Dozen: PowerShell Scripts for the Busy DBA SIA404: Deep Dive on Windows Server Active Directory Shell Find Me Later At “The Scripting Guys” pod in the Expo Hall!
Track Resources • Resources for Developers http://msdn.microsoft.com/en-us/windows/apps • Windows 8 is ready for Businesshttp://www.microsoft.com/en-us/windows/enterprise/products-and-technologies/windows-8/default.aspx • Microsoft Desktop Optimization Pack:www.microsoft.com/MDOP • Microsoft Desktop Virtualization: www.microsoft.com/dv
Track Resources Track Resources Springboard Series: www.microsoft.com/springboard Explore > Plan > Deliver > Operate > Support for • Windows 7 and Windows 8 • MDOP • Desktop Virtualization • Windows Intune • Internet Explorer 8, 9 and 10
Download Download the Windows 8 Release Preview Today http://windows.microsoft.com/en-US/windows-8/release-preview
Resources Learning TechNet • Connect. Share. Discuss. • Microsoft Certification & Training Resources http://northamerica.msteched.com www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet http://microsoft.com/msdn
Required Slide Complete an evaluation on CommNet and enter to win!
MS Tag Scan the Tag to evaluate this session now on myTechEd Mobile
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.