Configuring User Account Property Values


Summary: Use Windows PowerShell to Manage Office 365 using Windows PowerShell cmdlets, scripts, and batch processes.

So far we’ve seen how you can use Windows PowerShell to return information. Perhaps even better is the fact that you can also use the Azure Active Directory cmdlets to configure information. You say Belinda Newman has moved to France and needs to have her usage location set to FR, the ISO (International Organization for Standardization) code for France? OK:

Set-MsolUser -UserPrincipalName "" -UsageLocation "FR"

You can see how easy this easy. We already know that the Get-MsolUser cmdlet can return a property named UsageLocation. So do we set that property value? We simply use the corresponding Set-MsolUser cmdlet and, yes, the UsageLocation parameter:

Set-MsolUser -UserPrincipalName "" -UsageLocation "FR"

There’s really nothing hard about that at all.

And here’s something cool. You say that all your users have moved to France? No problem:

Get-MsolUser | Set-MsolUser -UsageLocation "FR"

In this case, we’ve used the Get-MsolUser cmdlet to return all of our user accounts. We’ve then “piped” that information to the Set-MsolUser cmdlet. See the little pipe separator character in the command, the character that looks like this:


When you see the pipe character in a Windows PowerShell command that means you’re going to take whatever information was retrieved using the first cmdlet (Get-MsolUser) and then hand all of that information to the second cmdlet (Set-MsolUser). In this case, that means we’re going to have Set-MsolUser take all our user accounts and set the UsageLocation property to FR.

Not bad, if we do say so ourselves.


OK, maybe that is easy for us to say. But no need to fret: here’s a good introduction to using piping and pipelines with Windows PowerShell.

Next: Working with Office 365 User Licenses

See Also

Using Windows Azure Active Directory to Manage Office 365