Jump to content

Recommended Posts

Posted

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.

Posted

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

  • Thanks 1
Posted

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"}

  • Thanks 1
Posted
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

Posted

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.

Posted

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.

Posted
Is the mailnickname attribute populated for students in ad? If blank then the hide from gal attribute doesn’t work on O365.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...