Hide all users:

1, Connect PowerShell to Exchange.
2, Run the following command:
Get-Mailbox Alias | Set-Mailbox -HiddenFromAddressListsEnabled $True
Change Alias to your user’s information.

Hide users in a spesific OU

1, Connect PowerShell to Exchange.
2, Run the following command:
get-mailcontact -OrganizationalUnit “contoso.com/path/to/ou” | Set-mailContact -HiddenFromAddressListsEnabled $true -whatif