Mate, instead of posting a dozen of such questions every week, try using the -WhatIf switch for once :)
And no, it will not work, as you do not have a column "Name" in your CSV file, thus $user.name will be empty. Use $user instead.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Experts
i have a csv file in the below format, i want to import this csv file and provide full access to the shared mailbox, will the below syntax work for me.
Users
user1
user2
user3
$UserList = import-CSV C:\list.csv
ForEach ($User in $UserList){Set-Mailbox -Identity SharedMailbox@Company portal .com -User $user.name -AccessRights FullAccess -InheritanceType All -AutoMapping $True }
Mate, instead of posting a dozen of such questions every week, try using the -WhatIf switch for once :)
And no, it will not work, as you do not have a column "Name" in your CSV file, thus $user.name will be empty. Use $user instead.
You need to use "$user.Users".
As michev said, I also suggest you try run script with a little users first, if there exist any issue, it will show in the result directly. You could modify your script with the error message, you can also post script and error message on this forum, it will could help other users to correct your script.