Hello everybody

Last few days  I was having too much troubles with the rain, and the situation was not good at all in Jeddah, I even had to spend 1 night out of home… 🙁 because the water has blocked almost all the roads in the city… actually you can see a bit of what happened from my Facebook profile: http://www.facebook.com/salehram, well, it is in Arabic so you better know some Arabic if you are not Arabic 😛

OK, I almost forgot the main reason of this topic 😀 , it is about managing the Exchange users using the Groups in Active Directory…

There are many ways to manage the users in the Exchange, the easiest at all is using the EMC (Exchange Management Console), and there are many methods to do that, for example you can:

  • Just go for the user you want and right click him
  • Multi-select a group of users and manage them
  • Distribute the users on OUs and manage each OU’s users alone
  • Use the EMS (Exchange Management Shell) and select a group of users depending on a certain condition and then manage them

Honestly, for me the last method is the most recommended for me (I don’t know about the rest of you anyway 😀 ), but there is also another way which is very nice also, but I guess it does not come always as the best way… Here is why:

Imagine if you have multiple OUs in your AD, and each OU is a department in your company, you want to enable a certain feature in Exchange for some users in 1 OU, well, this is easy, select the OU in EMS, or filter the users in the EMC, then apply whatever you want to do…

This is nice, but what if you want to make changes for users across the OUs?

Either you can do it on each OU by selecting the users manually with EMS, or you can just look for them in EMC and apply that… well, the second option is the easiest one this time…

But still there is a way to do that also in a different way

Today I had to configure the OWA to be disabled to all users in the AD, except for some of them, so what I’ve done is I created security group named it “OWAEnabledUsers” then I put all the users I want to enable OWA for them in that group…

I had got a script some time before to display the users in a certain group, so that came handy in that time, so I combined this with the nice feature of commands in PowerShell (Pip lining commands) what I mean is, you can execute a command then pip-line (pass) its result to another command like follows:

Get-Mailbox -Identity user1 | Set-CASMailbox -OWAEnabled $True

In the above command I selected the mailbox with the ID of user1, then I set the OWAEnabled feature on that mailbox to True…

Well, basically, what I’ve done is similar to that,

First I used the script I had to get the OWAEnabledUsers group members, then I passed that to the Set-CASMailbox command…

First the script is:

[PS] C:\>$group =[ADSI]"WinNT://./OWAEnabledUsers"
[PS] C:\>$members = @($group.psbase.Invoke("Members"))
[PS] C:\>$members | foreach {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}

The last line of the script will show the members, each member per 1 line, so simple I pipe-lined the last line to the Set-CASMailbox command, and it gave me the exact result I wanted, so the total command was:

[PS] C:\>$group =[ADSI]"WinNT://./OWAEnabledUsers"
[PS] C:\>$members = @($group.psbase.Invoke("Members"))
[PS] C:\>$members | foreach {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} | Set-CASMailbox  -OWAEnabled $true

So as you can see, even with the OU management, still we can make another nice way of managing the exchange users

Hope that was useful for you…

No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.