際際滷

際際滷Share a Scribd company logo
An Introduction to PowerShell  ModulesJonathan Medd
How can you distribute additional PowerShell functionality?Snapin  PowerShell v1Provider or CmdletsNot for your average IT Pro to createModule  PowerShell v2 (Snapins still available)Provider, Cmdlets, Functions, Variables and AliasesAny IT Pro can make a module
What is a module?Simple as a collection of files containing functions, scripts etc and possibly other files such as the manifest to make it more professionalStored within a folder as a subfolder of the Modules location. Can be found via $env:PSModulePathContents made accessible to the user via the Import-Module cmdlet
Why bother?Makes sharing of groups of functions and scripts easySimple XCOPY style deployment of the module folder either internally or publishing to an external websiteMake your commonly used functions available to yourself without Profile Bloat  they are available as and when you need them from a module
Modules can transform you from this:
To Superstars with Groupies:
More on the module that made that transformation happen later........
Buy This Book
Making Your First ModuleCreate two functionsSave them into a *.psm1 file to the module folderImport them for use into your sessionGo!Yes it is as easy as that
Demo  Create a Module
Making Your Module More ProfessionalCreate a Module Manifest using New-ModuleManifestInclude Authoring or Version infoSpecify minimum versions of PowerShell or .NET required for the moduleNest other modulesRun scripts prior to loading the module, e.g. check for third-party snapin dependenciesCan be created manually Use Test-ModuleManifest to check for issues
Demo  Create The Manifest
Modules Make Distributing Your Code EasierVS
Demo  PowerCLIBook Module
Other ModulesWindows Server2008 R2  ->Community ModulesPowerShell Community ExtensionsBSonPOSH ModuleSQLPSXSearch on http://www.codeplex.com  currently 50+
Demo  TroubleShootingPack Module
Wrap UpGet-Help about_Moduleshttp://www.simple-talk.com/sysadmin/powershell/an-introduction-to-powershell-modules/http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/18/hey-scripting-guy-january-18-2010.aspx

More Related Content

An Introduction to PowerShell Modules