filmov
tv
Learn PowerShell: Episode 11 FINALE, Parametered Scripts + Scoping + Modules

Показать описание
After 2 years of making PowerShell videos, we have finally come to the very last episode! In this episode, I cover the final topics I wanted to get through in the series *and* follow that with where to go in the future of this series.
This episode starts with us making a brand-new script from scratch using a new concept we've never covered before - putting Param blocks on scripts. I cover why you'd want to put Param blocks on scripts and demonstrate it by actually making the script. I also take the development of this script as an opportunity to talk even more about developing scripts.
During this stage, I also cover a really annoying behaviour of PowerShell that I think is significant to talk about. I talk about how PowerShell does a very bad job of handling casting objects from the type "string" to the type "FileInfo", and why we should prefer "string" when setting up parameters on scripts or functions.
After this, I move onto a new concept: Scoping. How it impacts our scripts and how we can control it. I go through an example script comparing what we'd expect if there was no scoping to what actually happens due to scoping and covering the "dot-source operator" and code management. I covered this topic because I know it's something that can really trip you up without explanation if you start writing more complex scripts, and I wanted to make sure you had a name to put to the behaviour if you ever encounter it.
As I'm talking about the scoping system, I also explain a common technique the dot-source operator is used, for creating scripts that contain purely functions and using the functions from them. And finally, the scoping portion of the video brings me to explaining PowerShell Modules.
Right at the end of the video, I summarise where to go from this series onwards, and conclude the series there.
CHAPTERS
00:00 Param Blocks on Scripts
06:37 The Final Script
18:08 Caveat to taking in "FileInfo"
22:42 Scoping In-Depth
28:31 Controlling Scoping (Method 1)
30:26 Controlling Scoping (Method 2)
32:50 PowerShell Modules
40:40 From this series...
Thanks for watching my video, before are some general ABMedia links if you are interested:
The Discord server is a place to chat with the creator of this video, as well as anyone who contributed to its development and has helped support ABCo over the years.
A huge thank you goes to @ndumiphotos (on Instagram) for the graphics used in the intro.
#powershell #powershellscripting #learnpowershell
This episode starts with us making a brand-new script from scratch using a new concept we've never covered before - putting Param blocks on scripts. I cover why you'd want to put Param blocks on scripts and demonstrate it by actually making the script. I also take the development of this script as an opportunity to talk even more about developing scripts.
During this stage, I also cover a really annoying behaviour of PowerShell that I think is significant to talk about. I talk about how PowerShell does a very bad job of handling casting objects from the type "string" to the type "FileInfo", and why we should prefer "string" when setting up parameters on scripts or functions.
After this, I move onto a new concept: Scoping. How it impacts our scripts and how we can control it. I go through an example script comparing what we'd expect if there was no scoping to what actually happens due to scoping and covering the "dot-source operator" and code management. I covered this topic because I know it's something that can really trip you up without explanation if you start writing more complex scripts, and I wanted to make sure you had a name to put to the behaviour if you ever encounter it.
As I'm talking about the scoping system, I also explain a common technique the dot-source operator is used, for creating scripts that contain purely functions and using the functions from them. And finally, the scoping portion of the video brings me to explaining PowerShell Modules.
Right at the end of the video, I summarise where to go from this series onwards, and conclude the series there.
CHAPTERS
00:00 Param Blocks on Scripts
06:37 The Final Script
18:08 Caveat to taking in "FileInfo"
22:42 Scoping In-Depth
28:31 Controlling Scoping (Method 1)
30:26 Controlling Scoping (Method 2)
32:50 PowerShell Modules
40:40 From this series...
Thanks for watching my video, before are some general ABMedia links if you are interested:
The Discord server is a place to chat with the creator of this video, as well as anyone who contributed to its development and has helped support ABCo over the years.
A huge thank you goes to @ndumiphotos (on Instagram) for the graphics used in the intro.
#powershell #powershellscripting #learnpowershell
Комментарии