Mail enabling users based on ou and sec group membership

Hello, E2013CU5 here.

i have several OUs in AD and inside them there are "generic users" which i don't want to mail enable when bulk enabling mailboxes for the first time.

How do i mass enable users filtering by OU AND group membership or some other kind of easily set atttribute?.

To test i already made a security group in the OU "laboral" and added the users

researching hasn't shown a clear way to do this.

I tried different permutations of get-user with filters based on OU and group membership, it comes out empty every time:

[PS] C:\Windows\system32>Get-User -RecipientTypeDetails User -OrganizationalUnit "Laboral" -Filter { MemberOfGroup -eq "
Con correo laboral" }
[PS] C:\Windows\system32>Get-User -OrganizationalUnit "Laboral" -Filter { MemberOfGroup -eq "Con correo laboral" }
[PS] C:\Windows\system32>Get-User -RecipientTypeDetails User -Filter { MemberOfGroup -eq "Con correo laboral" }
[PS] C:\Windows\system32>Get-User -Filter { MemberOfGroup -eq "Con correo laboral" }
[PS] C:\Windows\system32>Get-User -RecipientTypeDetails User -Filter { MemberOfGroup -eq "Con correo laboral" }
[PS] C:\Windows\system32>Get-User -OrganizationalUnit "Laboral" -Filter { MemberOfGroup -eq "Con correo laboral" }

Also tried adding the $ sign to the end of the string, same results.

if i try with -ne "string"$ then it's as if nothing exists because it shows the smae output with or without that statement

I then tried to filter by adding a description text(which is easy to do in ADUC as it's one of the values that can be mass edited) but "description" is not a valid -filter type!, and custom attributes cannot(AFAIK) be mass added by selecting and then right clicking-properties

So how can i do this?

July 15th, 2014 1:17pm

I hope the group you have created is mail enabled, if so you can bulk edit any user attribute of all the members using below...

Get-DistributionGroupMember "Con correo laboral" | Set-User -Office SVCAccount

Then you are free to use Office or any other filterable attribute with other filter while doing mass ena

Free Windows Admin Tool Kit Click here and download it now
July 15th, 2014 9:29pm

Amit,

it's not mail enabled, i dont want it to be a distribution group nor for it to have an email address at all, why sould i want it to be mail enabled?.

From what i've understand you're using that piped commands *JUST* to mass set a user attribute so then i can use the filters i've tried before?

Also, shouldn't something like this be better?:

get-adgroupmember -identity "Con correo laboral" | set-adobject -add CustomProperty1=nomail

With this i'm back to the first problem, why does the memberofgroup filter is not resolving in the first examples i've used?

July 15th, 2014 9:47pm

Absolutely you can use AD cmdlets to do that easily, I am just used to with Exchange cmdlets ;)

BTW about your first example or any other, you have to use DistinguisedName of the Group, not the displayname in the Filter parameter...

Something like this...

Get-User -RecipientTypeDetails User -OrganizationalUnit "Laboral" -Filter { MemberOfGroup -eq "CN=Con correo laboral,OU=OUNAME,DC=Domain,DC=com" }

Free Windows Admin Tool Kit Click here and download it now
July 15th, 2014 10:05pm

sorry for the delay couldn't test it until today.

outstanding!.

used the DN for the filter and it resolved perfectly, now i don't need to set custom attributes or anything of the sort.

In fact i went a little further and simplify the filter by making a group for the generic users instead of the mailboxes(which should be much shorter) and changed the filter to "-ne {group of no mail}"

worked like a charm!

July 22nd, 2014 11:47am

sorry for the delay couldn't test it until today.

outstanding!.

used the DN for the filter and it resolved perfectly, now i don't need to set custom attributes or anything of the sort.

In fact i went a little further and simplify the filter by making a group for the generic users instead of the mailboxes(which should be much shorter) and changed the filter to "-ne {group of no mail}"

worked like a charm!

Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2014 11:47am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics