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