Hi @john john,
The script will get all the items first, then do the fileter. In your case the cmdlet is like following
$customerFolders= $var | Where {$_.FieldValues.FileDirRef -eq $mainfolderUrl -and $_.FileSystemObjectType -eq "Folder"}
$var
is the collection of items. The script get all the items in $var
then where clause start filter the data.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.