Simply output the data from the ForEach-Object
block and assign to a variable that will collect all outputs, as showcased by example 12.
$storageHolder = $groupList | ForEach-Object -Parallel {
Import-Module -Name "C:UsersusernameDesktopGet-ADUserMembers.psm1"
Get-ADUserMembers -GroupName $_ | Select-Object ParentGroup, Name, EmployeeNumber, Enabled, LastLogonDate, PasswordLastSet
}
PowerShell will automatically create and expand an array, if there are multiple objects output from the ForEach-Object
loop.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…