On 2/2/2010 Microsoft released an updated version of the migration tools. One of the highlights of the release is the new information you can get with Get-MSOnlineUser command. Examples of the type of information you can now query are Activation Status, Allocated Mailbox Size, and Last Signed In Date. Unfortunately, it does not appear that you can query mailbox size or item count at the time of this writing.

The Get-MSOnlineUser command also supports the use of switches to control what users are returned. The switches correspond to the different views you have of users in the Administration Console. The available switches are:

  • Administrators
  • Disabled
  • Enabled
  • Identity
  • InvalidLicense
  • NeverSignedIn

So if you wanted to get a list of all the users with Admin rights in Microsoft Online, you could simply run:

get-msonlineuser -Administrators

To highlight some of the new features, we put together this little PowerShell script, which will dump information for all your enabled users to a CSV file. A common request that people have is they want to see the mailbox size of their Microsoft Online users, so we went ahead and included that information in the report by using the get-xshostedExchangeMailbox command.

The only thing you should have to modify before running the script is $owaserver variable, and you’ll only have to do that if you are hosted on the EMEA or APAC servers. Also make sure you’ve installed the new version of the migration tools.

You can download a properly formatted version of the script here. If you need help, please contact us.


$AdminCredential = get-Credential

 

#Get all the enabled users
$enabledusers = get-msonlineuser -Credential $AdminCredential -Enabled -ResultSize 10000

[email protected]()

#Go through the users one by one. This is to prevent a timeout issue if you try and do everything in one step.
Foreach($user in $enabledusers){

$colUsers += get-msonlineuser -identity $user.identity -Credential $AdminCredential -SourceDetail Full `
| Select-Object @{name=’DisplayName’;Expression={$_.displayname}}, `
@{name=’Identity’;Expression={$_.identity}}, `
@{name=’MailboxSize’;Expression={$_.mailboxsize}}, `
@{name=’UsedMailboxSize’;Expression={$_.usedmailboxsize}}, `
@{name=’IsActive’;Expression={$_.isactive}}, `
@{name=’PasswordExpirationDate’;Expression={$_.passwordexpirationdate}},`
@{name=’LastSignedInDate’;Expression={$_.lastsignedindate}},`
@{name=’SubscriptionIDs’;Expression={$_.subscriptionids}}, `
@{name=’ProxyAddresses’;Expression={$_.proxyaddresses}},`
@{name=’CreatedDate’;Expression={$_.createddate}},`
@{name=’FirstName’;Expression={$_.FirstName}}, `
@{name=’Lastname’;Expression={$_.LastName}}, `
@{name=’Department’;Expression={$_.department}}, `
@{name=’JobTitle’;Expression={$_.jobtitle}},`
@{name=’StreetAddress’;Expression={$_.streetaddress}},`
@{name=’City’;Expression={$_.city}},`
@{name=’StateOrProvince’;Expression={$_.stateorprovince}},`
@{name=’ZipOrPostalCode’;Expression={$_.ziporpostalcode}},`
@{name=’CountryOrRegion’;Expression={$_.countryorregion}},`
@{name=’OfficeNumber’;Expression={$_.officenumber}},`
@{name=’OfficePhone’;Expression={$_.officephone}}

 

}
$colusers | Export-Csv "UserReport-$((Get-Date -uformat %Y%m%d%H%M%S).ToString()).csv" -NoTypeInformation

Was this article helpful?
YesNo