Scripts - Office 365 Administration

The vast majority of these scripts are from the Microsoft TechNet Gallery and neither myself or Microsoft guarantee the validity of these scripts and you use them at your own risk.

=================================================================

 Office 365 Administration

=================================================================

Z-Hire Active Directory, Exchange, Lync, Office 365 User Creation Tool
Author - Denny415
Download - Link

Info -
Automates the IT account creation process for Exchange mailbox, Active Directory, Lync accounts, Office 365 cloud and SalesForce cloud deployments. With just a click of the button, your Exchange mailbox, and Active Directory user and Lync accounts will be created simultaneously.

=================================================================

Z-Term Active Directory, Exchange, Lync, Office 365 User Termination Tool
Author - Denny415
Download - Link

Info -
This application allows IT administrators to automate common tasks when an employee leaves the company. Usually, IT administrators use multiple consoles and perform a variety of tasks to terminate user accounts.

=================================================================

Office 365 Distribution list and Office 365 Groups Management Tool 
Author - Perumal - (JiJi Technologies)
Download - Link
Website - Link

Info - 
This is a simple reporting and management tool for
- Distribution list
- Office365 Groups

=================================================================

Bulk Add SMTP Addresses to Office 365 Mailboxes
Author - Paul Cunningham
Blog - Link
Download - Link

Info -
This PowerShell script will add new SMTP addresses to existing Office 365 mailbox users for a new domain. This script fills the need to make bulk email address changes in Exchange Online when Email Address Policies are not available.

=================================================================

Export mailbox permissions from Office 365 to CSV file
Author - Alan Byrne
Download - Link
Article Link - Link
Blog - Link

Info -
This Powershell script will connect to Office 365 and export all mailbox permissions to a CSV file. This script forms the basis of the Mailbox Permission reports available in our Office 365 reporting package.

The script only collects permissions that are non-standard, and won't collect permissions set by Built In groups like Administrators making for a cleaner and more relevant report.

=================================================================

Assign Licenses Office 365 PowerShell GUI
Author - Alex Cuba
Download - Link

Info -
Assigning a license for a lot of users is a challenge for many customers. With this script, you will be able to assign licenses to your users based on a csv file or an Azure AD Group.

=================================================================

Find where an email address is assigned on an Office 365 tenant
Author - Nathan Bressett
Download - Link
Website - Link

Info -
This simple script runs through the various objects in your Office 365 tenant and tracks down the owner of a specified email address, even if it belongs to a deleted item. When / if the address is found it will perform a brain dump of all the information related to the owner.

=================================================================

Script to Modify Office 365 Mailbox Permissions
Author - OneScript Team
Download - Link

Info -
This script could be used to modify Office 365 mailbox permissions.  You can use this script to add or remove mailbox permissions.

=================================================================

Set Calendar Permission in Office 365 Exchange Online
Author - OneScript Team (Microsoft)
Download - Link

Info -
This script can set calendar permission in Office 365 Exchange Online. You can set permission, grant permission and revoke permission on one or multiple calendar folders by using this script.

=================================================================

Set Email Signatures in Office 365 Exchange Online
Author - OneScript Team (Microsoft)
Download - Link

Info -
This script can set text and HTML email signatures to your outgoing email messages in Office 365 Exchange Online.

=================================================================

Export Zimbra to Outlook PST
Author - Sandyy247
Download - Link

Info -
Zimbra Converter is an expert tool that provides quick, accurate and faultless conversion of .tgz mailboxes of Zimbra Desktop/Collaboration Suite to .pst file.

=================================================================

Clearing AutoComplete and other Recipient Caches
Author - Michel de Rooij
Download - Link
Website - Link

Info -
This script allows you to clear one or more locations where recipient information is cached which might influence end user experience after migrating mailboxes. You have the option to clear the AutoComplete stream (Name Cache) for Outlook and OWA, the Suggested Contacts or the Recipient Cache (Exchange 2013 only).

=================================================================

Microsoft Office 365: Add Exchange Online routing SMTP address
Author - I Lantz
Download - Link
Website - Link

Info -
This script will find mailboxes that are configured with EmailAddressPolicyEnabled:$false and have no "@tenant.mail.onmicrosoft.com" address and will add the SMTP routing address required for an Exchange Online Hybrid deployment.It will try to add the proxy address prefix@tenant.

=================================================================

Fix-ProxyAddress.ps1 - Missing .onmicrosoft proxy address
Author - Chris Goosen
Download - Link
Website - Link
Article - Link


Info -
A small script with a GUI that simplifies the process of adding an SMTP proxy address to mailboxes that are not being updated by Exchange email address policies.

Once launched, the script will prompt for your tenant routing domain in the format 'company.mail.onmicrosoft.com' and will search for all mailboxes in the organization that do not have an email address policy applied.

=================================================================

Guide to set-up an Out of Office auto-reply on a distribution group
Author - Aditya Mediratta
Download - Link

Info -
The benefit of creating a rule instead of using out of office (OoO) is mailbox sends response for every mail received not just once for particular address.

=================================================================

Export Mailbox Rules for Bulk Users
Author - Aditya Mediratta
Download - Link

Info -
The Script allows us to export mailbox / inbox rules for bulk users in CSV files.

=================================================================

Convert an Exchange distribution group to an Office 365 Group
Author - Tony Redmond MVP
Download - Link
Website - Link

Info -
This script is intended to demonstrate how an Exchange Online distribution group can be converted to an Office 365 Group. Only mailboxes are supported in Office 365 Groups, so these are the only recipients moved across. The settings of the distribution group are moved as is its email address (you might not like to do this).

=================================================================

Script to Create Cloud Contacts for Dynamic Groups in Exchange Hybrid
Author - Joseph Palarchio
Download - Link
Website - Link

Info -
When configured in an Exchange Hybrid configuration, Dynamic Distribution Groups are not synchronized by DirSync.  For cloud users to see these objects in their GAL, a contact object must be created in the cloud with the SMTP address of the on-premises Dynamic Distribution Group.
This script creates the necessary contact objects in the cloud and restricts them to authenticated users.

=================================================================

Migration Prep - Identify Email Addresses Non-Compliant with Their Policy
Author - Joseph Palarchio
Download - Link
Website - Link

Info -
This script helps identify users that have primary SMTP addresses that are not compliant with the email address policy that is assigned to them.

=================================================================

Manage your O365 Licenses
Author - Matt Byrd
Download - Link (TechNet) - no longer updated
Download - Link (PowerShell Gallery)

Info -
Helps automate common license management tasks by providing a simpler set of switches on existing PowerShell Cmdlets.

=================================================================

Simple UI based Office 365 License Management powershell script
Author - Santhosh Sethumadhavan
Download - Link

Info -
This script launches a GUI and provides users with options either to run Online Query or process users from a CSV list. Using a License picker window, users can Add and/or Remove licenses and apply it on all users or selected users from the list, all at once. This script will only append to or remove the existing user licenses and plans.

=================================================================

Wipe Exchange Online Mailbox Content
Author - Aaron Guilmette
Download - Link
Blog Article - Link
Website - Link

Info -
Use this script to delete content in a mailbox for whtaever the reason may be.  Log into an Office 365 session first, and away you go.

=================================================================

Find Objects with Duplicate UPN or SMTP values in Active Directory
Author - Aaron Guilmette
Download - Link
Blog Article - Link
Website - Link

Info -
Using the duplicate value referenced from the AADSync or DirSync Connector (or from running csexport), run this script to locate the errant objects.  Depending on your search parameters, this will query the default AD attributes, Exchange attributes, or SIP attributes that can cause sync to report a conflict.

=================================================================

Office 365 Distribution Group Management
Author - Aaron Guilmette
Download - Link
Blog Article - Link
Website - Link

Info -
Experimental project--use this to upload a CSV or XLS spreadsheet to manage a group.  XLS/CSV must contain the header EmailAddress.  The application will enumerate groups for which the logged-in account is granted permission via the ManagedBy property to allow end-users to manage distribution groups via spreadsheet.

=================================================================

Assign Office 365 Admin Roles in Bulk via Text File Input
Author - Sukhija Vikas
Download - Link
Blog Article - Link
Website - Link

Info -
Script that can bulk add users to Office 365 Administrator Roles.

=================================================================

Malicious Employee: Restore all files/items/lists in SharePoint Online deleted by a single employee
Author - Arleta Wanat
Download - Link

Info -
The scenario is: You fired an employee and he wreaked havoc in all the SPO sites he had access to, randomly deleting files, items, lists. Now you can restore them via this script
The script loops across all site collections in the tenant and finds all items one user deleted and restores them all.

=================================================================

Getting all Licensed Office 365 users with PowerShell
Author - Noble K Varghese
Download - Link

Info -
This script will help admins to exract licenses assigned to users. The script generates a CSV file as Output.

PowerShell Scipt which can be used in O365 to fetch the licenses assigned to users. Currently the script can be used to get details of E1, E3, K1 and EMS Licenses Assigned. Also, the script can handle cases in which users are assigned with multiple flavours of licenses like E1 clubbed with EMS, E3 clubbed with EMS etc.

=================================================================

How to assign License to unlicensed users automatically
Author - OneScript Team
Download - Link

Info -
This script will auto assign License to unlicensed users if there's only one type of SKU in an organization. If an organization has multi-type SKUs, an excel sheet will be popped out for editing after you run the script. Then the script will assign license based on the excel file.

=================================================================

Bulk provisioning Office 365 licenses and services script
Author - Michael LaMontagne
Download - Link
Blog Article - Link
Website - Link

Info -
PowerShell script that bulk provisions user licensing for specific Office 365 services.

=================================================================

Transfer all OneDrive files to another user via PowerShell 
Author - Elliott Munro
Download - Link (copy text from the page and save)
Blog Article - Link
Website - Link

Info -
During the offboarding of an Office 365 user that is being deprovisioned, you may be required to make a copy of their OneDrive files or transfer ownership of the files to someone else. This can be a laborious process, requiring you to log into the departing users OneDrive and downloading, transferring or sharing their data manually. You can utilise this script to make it easier.

=================================================================

Using Powershell to match up AD and 365 accounts for AD Connect
Author - Carlos McCray
Download - Link
Blog Article - Link
Website - Link

Info -
This script sets user info in local AD from mailboxes in Office 365 and syncs display name, UPN etc.
Please read the full article for clarity.

=================================================================