Presentation is loading. Please wait.

Presentation is loading. Please wait.

Grow Your Script From Simple to Module

Similar presentations


Presentation on theme: "Grow Your Script From Simple to Module"— Presentation transcript:

1 Grow Your Script From Simple to Module
Sander Stad Grow Your Script From Simple to Module

2 Sponsors

3 Presentation Rules Always ask questions Interrupt me
This is a two-way conversation, lets learn from each other’s experiences

4 About me Sander Stad SQL Server DBA, MCSE Data Platform
Blog: Slack:

5 Agenda Parameters Functions Modules Lots of demos

6 Parameters

7 Parameter Is a special kind of variable Used in a function as input

8 Functions

9 Function A function in PowerShell is a way of collecting up a bunch of code to perform one or many different times

10 Types of functions “Normal” functions Advanced functions
But those are “normal” functions. Within PowerShell you can also create advanced functions. You get an advanced function as soon as you add CmdLetBinding() attribute to your function. As soon as that attribute is added to your function you immediately Verbose Debug ErrorAction WarningAction ErrorVariable WarningVariable OutVariable OutBuffer PipeLineVariable WhatIf Confirm

11 Modules

12 Module A module is a set of functions, grouped together as a convenient unit

13 Different kinds of modules
Script Modules Binary Modules Manifest Modules Dynamic Modules Script Modules It’s a single script to create modules whose members include functions, variables, and more. At heart, a script module is simply a Windows PowerShell script with a different extension Binary Modules A binary module is a .NET Framework assembly (.dll) that contains compiled code, such as C#. Cmdlet developers can use this type of module to share cmdlets, providers Manifest Modules A manifest module is a module that uses a manifest file to describe all of its components, but doesn’t have any sort of core assembly or script.  It can have assemblies loaded but that only extends the functionality This is the one you’re most frankly are going to develop Dynamic Modules These are short lived modules that are created by the New-Module commandlet. This type of module enables a script to create a module on demand that does not need to be loaded or saved to persistent storage. Because it’s short lived it’s not available in the Get-Module cmdlet

14


Download ppt "Grow Your Script From Simple to Module"

Similar presentations


Ads by Google