Hi,
The error message indicates that the "Name" parameter is not vaild for the Remove-MailContact cmdlet. You can use the "Identity" parameter which accepts any value that uniquely identifies the mail contact. For example:
- Name
- Alias
- Distinguished name (DN)
- Canonical DN
- Email address
- GUID
Import-Csv C:\contacts.csv | ForEach-Object {Remove-MailContact -Identity $_.Name}
Please refer to below help file for more details.
Remove-MailContact (ExchangePowerShell) | Microsoft Learn
Best Regards,
Ian Xue