Powershell to set or retrieve additional attributes

I recently worked on a project where the customer had an immense amount of AD objects but only actually had a small smaller subset of users they wanted to license but did not fully want to expose AD dumps to create a list of users to license and trawling though these users in a web console would be laborious  So wanted to populate one of the fields mentioned in this KB article http://support.microsoft.com/kb/2256198 to identify who should be licensed on mass.

Once the DirSync had completed we were left with the task to export this information out of the portal which would be PowerShell now the interesting piece is the following:

If you use the MOP with the Get-MSOLuser commands even though you can run the command to get attributes it always returned blank. It turned out that the get-msoluser command’s ONLY show what you can see in the web portal not the underlying Active Directory.

So to get around this if you log on to the Exchange PowerShell commands you can get to all the information in the underlying Office 365 AD using the get-user command and can run an export with all the information.

3 thoughts on “Powershell to set or retrieve additional attributes

    1. By opening up a PS window and running the following commands where $cred is your O365 admin account:

      import-module msonline
      $Sess = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
      Import-PSSession $Sess -AllowClobber

      1. Extremely helpful, and now searchable by others!! Thanks!!

        (I actually had these commands, but I didn’t realize that the Exchange commands were needed to get to the AD attributes.)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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