February 2019
Intermediate to advanced
626 pages
15h 51m
English
Enumerating, or listing, the objects in a collection in PowerShell does not need a specialized command. For example, if the results of Get-PSDrive were assigned to a variable, enumerating the content of the variable is as simple as writing the variable name and pressing Enter:
PS> $drives = Get-PSDrivePS> $drivesName Used (GB) Free (GB) Provider Root---- --------- --------- -------- ----Alias Alias C 319.37 611.60 FileSystem C:\Cert Certificate \ Env Environment ...
ForEach-Object may be used where something complex needs to be done to each object.
Where-Object may be used to filter results.
Read now
Unlock full access