Greetings,
I am trying the following PS but it is not working. In other words, it is not returning any value to list
$Offices = @(‘India’,‘Guatemala’)
$List = Get-MsolUser -All | Where-Object {$.Office -Contains $Offices} | Select UserPrincipalName
But if I try with just one value, it works
$Offices = @(‘India’)
$List = Get-MsolUser -All | Where-Object {$.Office -Contains $Offices} | Select UserPrincipalName
So, what am I doing wrong on the $Offices array? Is there another way to do this?
Thanks in advance
If you read that as if it were english.
Where this instance of $Office contains an array called $Offices. It in fact contains a single value, so you need to flip that Where-Object statement around
... | Where-Object { $Offices -Contains $_.Office }
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.