Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, December 10, 2019 9:26 PM
I am using this:
Get-ADUser -filter * -searchbase "ou=you,ou=OU..." | Set-ADUser -replace @{msExchHideFromAddressLists=$true}
I can do it for 1 person, but can do it for all users in the OU. Any ideas?
Thank you
All replies (4)
Tuesday, December 10, 2019 10:40 PM
The code without a line break would work.
Get-ADUser -filter * -searchbase 'ou=you,ou=OU...' | Set-ADUser -replace @{msExchHideFromAddressLists=$true}
You cannot have a double line break after a "pipe". It will cause an error. YOU can have one line break but you have two.
Get-ADUser -filter * -searchbase 'ou=you,ou=OU...' |
Set-ADUser -replace @{msExchHideFromAddressLists=$true}
\(ツ)_/
Wednesday, December 11, 2019 11:40 AM
Who do people tend to use set-aduser and replace command, instead of using cmdlet which has the parameter to do the job? (Set-Mailbox -hiddenFromAddressListsEnabled:$False, which will also correctly clear showinaddressbook attribute)
Wednesday, December 11, 2019 6:54 PM
Who do people tend to use set-aduser and replace command, instead of using cmdlet which has the parameter to do the job? (Set-Mailbox -hiddenFromAddressListsEnabled:$False, which will also correctly clear showinaddressbook attribute)
Exchange CmdLets are not necessarily available in all deployments.
\(ツ)_/
Friday, December 13, 2019 7:14 PM
What would be the most efficient way to ensure the flag is set only on disabled account. Is it to modify get-aduser to only return disabled, or put it in the loop?