Some very useful O365 powershell scripts


You may have seen my previous blog on how to connect to O365 with powershell.  Now there are some scripts which have been released that will help you, administrators, to deploy, troubleshoot and maintain your tenant userbase.

Check out this download: Office 365 Helper Scripts

It contains a load of great scripts, from assigning licenses to users by distribution group, all the way through to generating and then importing random passwords based on an exported CSV of user principle names.

One of the scripts I use a lot is GetMsolUserReport:

GetMsolUserReport generates a CSV report containing both general and mailbox-related information about users in Office 365.

General User Information

  • UserPrincipalName
  • UpnSuffix
  • RecipientType
  • PrimarySmtpAddress
  • AdditionalSmtpAddresses
  • DisplayName
  • FirstName
  • LastName
  • BlockCredential
  • WhenCreatedUTC
  • WhenChangedUTC
  • LastDirSyncTime
  • UsageLocation
  • Company
  • Department
  • Manager
  • Title
  • StreetAddress
  • City
  • State
  • ZipCode
  • Office
  • TelephoneNumber

 

Licensing information

  • IsLicensed
  • LicenseReconciliationNeeded
  • AssignedLicenses

 

Mail-enabled User Information

  • EmailAddresses
  • PrimarySmtpAddress
  • UseMapiRichTextFormat
  • ExternalEmailAddress
  • HiddenFromAddressListsEnabled

 

Mailbox-Enabled Users

  • General information
  • EmailAddresses
  • HiddenFromAddressListsEnabled
  • MaxSendSize
  • MaxReceiveSize
  • RetentionPolicy
  • RetentionHoldEnabled
  • StartDateForRetentionHold
  • EndDateForRetentionHold
  • RetainDeletedItemsFor
  • SingleItemRecoveryEnabled
  • LitigationHoldEnabled
  • LitigationHoldDate
  • ManagedFolderMailboxPolicy
  • DeliverToMailboxAndForward
  • ForwardingAddress
  • ForwardingSmtpAddress

 

  • Access type(s) enabled:
  • ActiveSync
  • OWA
  • POP
  • IMAP
  • MAPI
    • Mailbox statistics:
    • TotalItemSize
    • ItemCount
    • TotalDeletedItemSize
    • DeletedItemCount
      • ActiveSync devices:
      • MobileDeviceFriendlyName
      • MobileDeviceID
      • MobileDeviceModel
      • MobileDeviceOS
      • MobileDeviceOSLanguage
      • MobileDeviceLastSuccessSync
      • MobileDevicePolicyApplied

I’ve bolded out the attributes I usually check when there seems to be an issue with Lync log in or issues around outlook contact merge.  Optionally the output file can be specified in this script.  This script is good for ADFS environments where the data that has arrived on your tenant can be checked against your on-premise AD (more on ADFS on a later blog).

 Another script that has been useful for administrators deploying and after deployment is GetMsolTenantSkuUsage:

GetMsolTenantSkuUsage establishes a connection with the Office 365 provision web service API and collects information about the number of licenses owned, consumed, and available. The results are displayed in the PowerShell console and saved to a comma-separated values (CSV) file.

If a credential is specified, it will be used to establish a connection with the provisioning web service API. If a credential is not specified, an attempt is made to identify an existing connection to the provisioning web service API.  If an existing connection
is identified, the existing connection is used. If an existing connection is not identified, the user is prompted for credentials so that a new connection can be established.

This quick script gives administrators data around licenses at their fingertips.

So a set of scripts that are useful during deployment AND after deployment.  Download and have a look.

 


Comments (0)

Skip to main content