round2it Posted October 21, 2018 Posted October 21, 2018 hi all does anyone know how to to remove bulk users from the global address list in o365. need a quick fix until i can sort out address book policies. all our students have a job title of student but thinking now it would be better to add to a security group. what i could do with is a powershell guide for a newbie. just need a quick way to hide students if that is possable.
psumner1992 Posted October 22, 2018 Posted October 22, 2018 You’ll be looking at something similar to below: Get-Mailbox -ResultSize Unlimited | Where {$_.JobTitle -eq "Student"} | Set-Mailbox -HiddenFromAddressListsEnabled $true If you’re syncing your accounts from AD to office 365 via something like AAD connect then the above won’t work, instead you’ll need to edit users in AD to change the active directory property “msExchHideFromAddressLists” property needs to be set to “true”, this can be found in attribution editor. https://www.morgantechspace.com/2017/09/hide-and-un-hide-users-from-gal-powershell.html?m=1 1
ThomL Posted October 22, 2018 Posted October 22, 2018 Powershell to do this to onsite AD something like this, I think, might be helpful: Get-ADUser -SearchBase "OU=OU,DC=domain,DC=com" | Set-ADUser -Replace @{msExchHideFromAddressLists="TRUE"} 1
round2it Posted October 22, 2018 Author Posted October 22, 2018 You’ll be looking at something similar to below: Get-Mailbox -ResultSize Unlimited | Where {$_.JobTitle -eq "Student"} | Set-Mailbox -HiddenFromAddressListsEnabled $true If you’re syncing your accounts from AD to office 365 via something like AAD connect then the above won’t work, instead you’ll need to edit users in AD to change the active directory property “msExchHideFromAddressLists” property needs to be set to “true”, this can be found in attribution editor. https://www.morgantechspace.com/2017/09/hide-and-un-hide-users-from-gal-powershell.html?m=1 Sorry for being a bit thick but can I just copy and paste your PS command as is from the edugeek page. is it one command or 2? I have managed to login to o365 via powershell and I copied and pasted the command as it looks correct to me but was unsure if edugeek changes the code in anyway for display on a web page. I did not get any messages to say the command was executed or not is this correct behaviour (first time messing with o365 via powershell) I have given it 30 mins to update but the students are still showing as view in the GAL
round2it Posted October 22, 2018 Author Posted October 22, 2018 had ms support tell me that it can not be done so looks like i have do do it manually. then read some books.
round2it Posted October 22, 2018 Author Posted October 22, 2018 i think this might work going to test tomorrow export all students id [email protected] to csv eith a header of mailbox run this command Import-Csv C:\users.csv | ForEach {Set-Mailbox -Identity $_.mailbox -HiddenFromAddressListsEnabled $true} does this look correct i am always worried when you have import at the front of a ps command. gojng to test with a few students first.
psumner1992 Posted October 22, 2018 Posted October 22, 2018 Sorry, just tried this on our tenancy and you are right it doesn't work. Very odd though as the syntax of it is correct, it must be something to do with the field of Title. Sorry I couldn't be of help on this occasion. - - - Updated - - - i think this might work going to test tomorrow export all students id [email protected] to csv eith a header of mailbox run this command Import-Csv C:\users.csv | ForEach {Set-Mailbox -Identity $_.mailbox -HiddenFromAddressListsEnabled $true} does this look correct i am always worried when you have import at the front of a ps command. gojng to test with a few students first. This looks like it should work, test with a few first to be sure.
Cw2k Posted October 23, 2018 Posted October 23, 2018 Is the mailnickname attribute populated for students in ad? If blank then the hide from gal attribute doesn’t work on O365.
round2it Posted October 23, 2018 Author Posted October 23, 2018 For anyone else who needs this the above command worked with the csv 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now