guest account
1 TopicExclude test guest users from a script listing all guest users
Dear All, I am trying to find a quick way to exclude all our "test" guest users from a powershell script which lists all the guest users in our tenant. The script is quite simple: $GuestUsers = Get-AzureADUser -Filter "UserType eq 'Guest'" -All $true | Sort-Object DisplayName | Select-Object DisplayName,JobTitle,Mail,UserType,AccountEnabled $GuestUsers | Export-Excel -path "C:\Temp\Guest2022.xlsx" -AutoSize -TableName GuestAccounts -WorksheetName GuestAccounts The problem is that we have 15 test guest users that always appear in the list. It's not a big number so I can remove them manually afterward but it would be great if I can exclude them directly in the script. Any help would be much appreciated! Many thanks in advance! Francesco The problemSolved3.4KViews1like5Comments