I am trying to filter only the email with dot ([email protected]). But all email would be displayed to me. Is this somehow possible to get only "[email protected]" this?
PS C:\Users\Rayman> Get-AzureADUser -SearchString "Sam".AlternateEmailAddresses
PS C:\Users\Rayman> (Get-AzureADUser -SearchString "Sam Smith").UserPrincipalName
PS C:\Users\Rayman> Get-AzureADUser -SearchString "Sam Smith" | Select Mail
[email protected]
[email protected]
I have tried many variants without success.
CodePudding user response:
Use Select-Object -First 1 to discard everything but the first output item:
$samSmith = Get-AzureADUser -SearchString "Sam Smith" |Select-Object -First 1
CodePudding user response:
Thank You Abraham Zinala for your suggestion posting this as solution to help other community member if they encounter for same requirement.
Note : Use PowerShell Version 7 Version.
PowerShell Script :
(Get-AzureADUser -SearchString "Sam Smith"| Select Mail)[0]


