This is a quick one. I saw some questions posted in the forum on this and I thought I should give a short blog on this.
For those has been playing with Exchange Server 2010 SP1 beta hosting deployment, I am quite sure by now you realize that you always need to be in the right tenant Organization context to get things done. In order to facilitate quick tenant organization context selection, Microsoft added a -Organization switch in a number of cmdlets. When you put that switch it, Exchange will know which tenant or configuration unit it is dealing with. For example, to create a new mailbox,
New-Mailbox -OrganizationAlpineSkiHouse -Name "John Doe" -UserPrincipalName email@example.com
Or to get all mailbox in a tenant organization,
However, you will very quickly realize that not all the cmdlets have that -Organization switch built-in. For example, Enable-Mailbox, Update-OfflineAddressBook, Remove-Mailbox, Update-GlobalAddressList or even Set-Mailbox and the list goes on. So, how do we use those cmdlets in the context of that tenant organization?
Well, you have 2 options,
Option 1: You use the full path like the following
Set-Mailbox -Identity "fabrikam.com/Microsoft Exchange Hosted Organizations/AlpineSkiHouse/Johnc"-CustomAttribute1 "MyText"
Or Option 2: You can use Powershell piping (which is what I like to use) like the following,
Get-Mailbox -Organization AlpineSkiHouse -Identity johnc | Set-Mailbox -CustomAttribute1 "MyText"
Straightforward enough? You can do the same for (disabling and ) enabling mailbox, like the following,
Get-User -Organization AlpineSkiHouse -Identity Lisa | Enable-Mailbox
Or perform a Offline Address Book update,
Get-OfflineAddressBook -Organization AlpineSkiHouse "Default Offline Address Book" | Update-OfflineAddressBook
I am not sure if this will change when SP1 goes RTM, but in beta, it seems that, in SP1 beta, only cmdlets with New- and Get- will have the -Organization switch.