Hi @Roger Roger,
From the error message Cannot bind argument to parameter 'Identity' because it is null, there is no value passed to the Set-RemoteMailbox cmdlet.
Since the data format in your csv file is:
users
user1@contoso.com
user2@contoso.com
You should modify this row from
foreach($user in $users){Set-RemoteMailbox $user.Name -HiddenFromAddressListsEnabled $true}
to
foreach($user in $users){Set-RemoteMailbox $user.users -HiddenFromAddressListsEnabled $true}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.