How it works...

You first take in the input through a prompt from the host. The raw guest list is taken in. PowerShell then splits the input string based on the commas and a regular expression match (necessary so it would work whether the input contains a space after the comma or not: not all users are alike). We use the -split and cast operators for the operation.

The loop part comes in at Foreach-Object. You pass the array object into the pipeline. The Foreach-Object cmdlet picks up the array, and processes one element at a time. When referring to the element within the loop, you use the $PSItem (a.k.a. $_) automatic variable, since the object has been passed through the pipeline.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.252.201