Private/ConvertTo-NSPEntraWizardRun.ps1
|
function ConvertTo-NSPEntraWizardRun { [CmdletBinding()] param($Environment,$Inventory,$Queue,$Review,[object[]]$AddressPlan=@(),[object[]]$SuffixReview=@(),[switch]$ReadOnly) $blocked = @($AddressPlan | Where-Object Blocked).Count $result = [pscustomobject]@{ PSTypeName = 'NSP.M365.UserPairing.WizardRun' Environment=$Environment;Inventory=$Inventory;Queue=$Queue;Review=$Review AddressPlans=@($AddressPlan);SuffixReviews=@($SuffixReview) ReviewMode=if($ReadOnly){'Read-only'}else{'Standard'} ReviewCompleted=[bool]$Review.ReviewCompleted SelectedPairs=@($Queue.pairs | Where-Object decision -eq 'selected').Count AddressPreviews=('{0} total; {1} unblocked; {2} blocked' -f $AddressPlan.Count,($AddressPlan.Count-$blocked),$blocked) QueuePath=[string]$Review.Path } $display = [Management.Automation.PSPropertySet]::new('DefaultDisplayPropertySet',[string[]]@('ReviewMode','ReviewCompleted','SelectedPairs','AddressPreviews','QueuePath')) $result.PSObject.Members.Add([Management.Automation.PSMemberSet]::new('PSStandardMembers',[Management.Automation.PSMemberInfo[]]@($display))) $result } |