Hi All,
Many thanks in advance and I am in need of to change the existing primary SMTP address and remove alias email addresses of few users/groups which are associated with a particular domain. So, I am using the script which is as shown below:
$NewDomain = domain
$MBX= import-csv filepath
foreach($MB in $MBX){
$Users = get-remotemailbox -identity $_.MB}
$Users | foreach-object{
$user=$_
$UserName =($user.PrimarySmtpAddress -split "@")[0]
$SMTP ="SMTP:"+ $UserName +"@"+$NewDomain
$Emailaddress=$UserName+"@"+$NewDomain
$user | Set-RemoteMailbox -EmailAddresses $SMTP -primarysmtpaddress $Emailaddress}
The script is picking the New domain details and merging it with $username, but after that I am getting an error message that no Parameter is found for the argument to be assigned. Requesting to kindly help on this issue.
A brief of how or infrastructure is setup. The on-prem domain is in Hybrid with Office365 and few domains are getting moved from office365. Now to remove these domains there are dependancies showing up for which I have to remove email addresses of that domain
for users/groups. So, requesting to kindly let me know where I am faulting out.
Many Thanks,
Niri
Niranjan