November 2018
Intermediate to advanced
566 pages
17h 15m
English
First, you 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 (this is necessary so that it works regardless of 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 (that is, $_) automatic variable, since the object has been passed through the pipeline.
Read now
Unlock full access