Download presentation
Presentation is loading. Please wait.
1
Neil Iversen Inetium justaddcode.com
2
The Plan PowerShell Sales Pitch Creating Scripts Type Extensions Rolling your own Cmdlets Other Extensionibility Providers Hosting PowerShell
3
PowerShell Sales Pitch Looks like DOS No Mouse Support No Intellisense Additional Download Capable of Spreading Malware Maybe there’s a reason I’m not in Sales
4
Revised PowerShell Sales Pitch Still Looks like DOS But much more powerful Now with Extra Tab Support! 3 rd Party Support Bundled with Win2k8 Built in security measures Code Signing is Possible 9 out of 10 Dentists agree: “PowerShell makes teeth whiter!”
5
Still Not Sold? It doesn’t have to look ugly Full.NET Access Loosely typed language The Pipeline Pass as full.NET objects PowerShell: Command1 | Command2 | Command3 C# Equivalent: Command3(Command2(Command1()));
6
Sales Demo
7
Functional Programming Familiar Constructs Function If/then For/while Store in PS1 files Run with & ‘path\file.ps1’ Include with. ‘path\file.ps1’ Accepts Arguments Function name ($val1, $val2) Or $args array
8
Filters Similar to Functions Can still take arguments Runtime Difference Functions: Run Once In Pipeline Filters: Run for Each Pipeline object Biggest disadvantage: No ‘initialize’ stage filter filesonly { if(-not $_.PSIsContainer) { $_ } }
9
Scripting Demo
10
Type Extensions Take advantage of loose typing Extend existing types Or Create your Own Using Add-Member Fields Properties Methods Make Permanent with ps1xml Update-TypeData –prepend MyNewTypes.ps1xml
11
Type Extension Demo
12
Creating a Cmdlet Compiled and Portable Bundled together in a Snapin Inherit from CmdLet WriteObject() Sends data back to the Pipeline [ Cmdlet(VerbsCommon.Get, “CmdletName“]
13
Demo: Cmdlet Building
14
Providers Act like a ‘Drive’ Implement actions like Get/Set/Delete Item Some Available Providers Active Directory SharePoint (v2) SQL Server Access
15
Demo: OOB Providers
16
Hosting PowerShell Two Levels of Difficulty Execute Commands Host the UI
17
Hosting PowerShell Execute Commands The easiest option RunspaceInvoke.Invoke(“dir”) Returns PSObject(s)
18
Hosting PowerShell Host the UI Very difficult Can provide immense amounts of power Examples: PowerShellPlus PoshConsole
19
Demo: Hosting PowerShell
20
References PowerShell Community Extensions http://www.codeplex.com/PowerShellCX CmdLet Visual Studio Template http://blogs.msdn.com/daiken/archive/2007/02/07/cr eating-a-windows-powershell-cmdlet-using-the- visual-studio-windows-powershell-templates.aspx http://blogs.msdn.com/daiken/archive/2007/02/07/cr eating-a-windows-powershell-cmdlet-using-the- visual-studio-windows-powershell-templates.aspx Debugging Techniques http://blogs.msdn.com/jmstall/archive/2007/03/04/de bugging-cmdlets.aspx http://blogs.msdn.com/jmstall/archive/2007/03/04/de bugging-cmdlets.aspx Windows PowerShell Programmers Guide http://msdn2.microsoft.com/en- us/library/ms714674(VS.85).aspx http://msdn2.microsoft.com/en- us/library/ms714674(VS.85).aspx
21
Vendors ShellTools (PowerShellPlus, PowerShell Analyzer) http://www.shelltools.net/ Quest Software http://www.quest.com/powershell/ NetCmdlets http://www.nsoftware.com/powershell/
22
Questions?
23
SharePoint Developer? Minneapolis Office Developer Interest Group (MODIG) http://www.sharepointmn.com/modig http://www.sharepointmn.com/modig Next Meeting: April 22, 5:30pm @Microsoft Web Part Development Personalization, Connections, AJAX.net, ToolPane
24
Thanks! Neil Iversen Inetium JustAddCode.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.