Building PowerShell Module - how to organise your source files and build with ease

Organising all files, scripts and functions required to build a module might give one a headache. PowerShell doesn’t come with native way of building the module, which doesn’t make our job easier. Hence, we’re going to use ModuleBuilder from PowerShell community so that the way we organise the code is predictable and used widely across other PowerShell projects. In this video I’ll walk you through the process of preparing, organising and finally building the module....

14 March 2022 · 1 min · 79 words · Kamil

PowerShell Module and Manifest- create and configure your tools

The more PowerShell code you write results in more and more scripts. Often you have multiple scripts managing one domain or application. What in situation when scripts start to use other scripts to work, creating so called dependency? PowerShell module is the answer - it’s the native way of bundling in multiple functions together as a single file. And the best comes with Module’s Manifest, a file that describes things like version of your module, requirements for it to run, author’s details etc....

23 February 2022 · 4 min · 828 words · Kamil

PowerShell Parameter Attributes - validate, group, require params and add pipeline to your function

Having properly configured parameters help your users to understand the use of your function. It also helps fellow developers to appreciate the intended use of the function. In addition, it gives you more control of how the code flows through your script. Parameter attributes is what takes parameters to the next level - you can specify that certain parameters are mandatory, group them together so that only certain combination of parameters is meant to work together, we can even add pipeline support so that function can be used as any other built-in function....

7 February 2022 · 5 min · 1034 words · Kamil

PowerShell function - converting script into function with parameters

So you’ve been writing your scripts for some time and wondering how to make them more PowerShell-like, so that they can be invoked from the console like all the other cmdlets? In this quick video I’ll show you how to convert a sample script into function, add parameters and indicated to your user how to use your function with mandatory parameters and types. # Sample script which asks user for basic information, then manipulates it and # display some information # There's no way (at least easy) to pass these parameters from prompt, nor validate $Name = Read-Host -Prompt "What's your name?...

21 January 2022 · 2 min · 371 words · Kamil

PowerShell PSCustomObject - Custom Object, the way it was meant to be

Everything is an object in PowerShell, and ability to create own object allows for one more way of controlling and handling data. In this video I’ll take you through the steps of creating PSCustomObject, working with its properties to doing more advanced topics - like adding methods and types to the object. <#PSScriptInfo .VERSION 1.0.0 .GUID f5228c81-d25c-4984-bb0c-e64576487b3e .AUTHOR Kamil Procyszyn .COPYRIGHT Kamil Procyszyn .PROJECTURI https://github.com/kprocyszyn/About-PowerShell .RELEASENOTES 2021 November .DESCRIPTION Link to the video: https://youtu....

2 November 2021 · 3 min · 620 words · Kamil