PowerShell Master Class - Advanced Scripting Techniques

preview_player
Показать описание
The advanced scripting module that introduces functions, creating your own modules and signing scripts.

00:00 Introduction
00:25 Lazy parameters
02:37 Types of parameter
03:25 Using multiple parameters
05:43 Explicitly define parameter position
07:08 Using different parameter names
08:59 Switches
11:13 Accepting pipeline input
13:40 Enabling help
16:33 Troubleshooting
22:53 Try and catch
27:05 Creating your own modules
30:52 PSModulePath
33:15 More on functions
35:16 Making it a function
37:55 Importing your module
40:00 Signing your script
45:30 Coming up next
Рекомендации по теме
Комментарии
Автор

Thanks John. You have been an Amazing teacher. I have just started my powershell journey and it has started to appear very easy.

amitdubey
Автор

Good video John, nice pace, good bite-sized examples. I’ll be watching more of your lectures now!👍🏼

RDSBL
Автор

Good stuff John, Legend! Loved the gradual progression from script to Modules. It helped me fill in some gaps in my knowledge!
Just back from reading the docs about PSModulePath - Powershell 7 is honouring the PSModulePath changes. Great news!

Modules, parameter binding, here I come!

iamdedlok
Автор

Top presenting style. Basically, musical voice. Reeeeally easy to understand, and makes it very watchable. I rarely read or watch powershell for fun, I'm usually googling in anger when it comes to PS :) Thanks!

MatSmithLondon
Автор

( ) <-- In the U.S. we call those parentheses.
[ ] <-- We call these either Brackets or Square Brackets (I hear Square Brackets more).
{ } <-- These we call Curly Braces most often. Sometimes you hear Curly Brackets. And quite frequently you hear "Those stupid squiggly things" accompanied with a finger drawing in the air.


You guys were first though, so I suppose we should all switch to English English lol.

kurchak
Автор

Real useful. Thank you, this content is helping me a lot at work.

ardenercelik
Автор

Very useful and enlightening bundle of lectures . I see it more and more how power shell is a graceful and effective language to resolve all different kinds of problems.
Problem is that it is still not such popular as it should be .
At my work nor one actually knows how to use it . In a best case the people know that it is exist, sometimes even this knowledge is absent.
My boss thought we need install it on Windows. Windows 10, I mean.
Today everyone use Python. Some folks still use Batch in Windows, I feel a very strong urge to puke whence i am looking at Batch.
I personally don't understand how is it possible that people prefer Python above Powershell especially in WIndows environment ?
I ready to bet, almost every issue you can resolve quicker in Powershell. Pipes are great for it .
You even don't need to read a pile of documentation to receive something, it is enough to receive an excel object and if you know how to
use all this truck as Select and Where and so on... you can very quickly to extract what you are looking for.
May be it will be not an elegant way but it will be a quick way.
Sometimes it is a preferable way, above other ways when you need to spend an hour to investigate this library for to find a function that fits.
This truck shall be much more popular and familiar to everyone.
It is astonishing how this language makes your life easier.
In this lecture I revealed many very useful things, i did it by using another ways, simply because it is difficult to imagine that life may be even more easier .
As says my friend in shortly we will go to crap without coming out from bad.
But in my opinion it is Great!!

deserve_it
Автор

It's really important to have a debugger. I used to use VBS Edit years ago, just because I could step through the code even I was coding in PowerShell or Python. I did this so I look at the windows objects more completely.


Yes, Python has a debugger, but it wasn't as good when working with Windows objects. Now with a proper debugger in Microsoft Code, I don't have to do this anymore. It was a bit of a pain to convert code back and forth but not really that difficult since I have done it for so many years on small projects and frameworks I needed for making my Windows and Linux code work on both platforms.

shinigamilee
Автор

John, this was useful and well presented. This refreshed my memory on how to write scripts with parameters, enable Help and also create functions that would be available on the command line. Many years ago I found that info on the MS site, but this time I couldn't find it. Thank you.
For what it's worth, this is my understanding as an American:
( ) Parentheses
[ ] Square brackets
{ } Braces (or curly braces)
< > Angle brackets
Mind you, I'm not saying the way you said it was wrong...it's language differences. >chuckle<, but I did in the past wonder if ( ) were braces, what would you call { }? I must have obtained the name of square brackets from the Apple ][ days :)
Full stop.

seanvogel
Автор

You mention wmi had been replaced by cim how would you find out which is the newer/preferred command when there are various options

PabloTBrave
Автор

I still debug manually using a separate powershell console - just do not understand how to configure the VSCode debugger or its options.
I gave VSCode a fresh try today, but after prompting that it wanted to create a launch.json, triggering a source control change, my script completely failed because the debugger claimed a module was not installed.
That module is installed, and the script runs fine in production.
I never faced this degree of complexity when debugging Pascal way back in the day!

geroffmilan
Автор

Just to confirm: its either Brackets or Square Brackets :-)

markadam
Автор

I got the compinfo ps1 script from your GitHub and tried to run it but it literally does nothing. Pretty frustrating.

calebjoyner