PowerShell

Latest Articles

Using Filters with the Get-ExoMailbox Cmdlet

It's a good idea to replace older calls to the Get-Mailbox cmdlet with Get-ExoMailbox. However, it's not just a matter of cut and paste updates. In some cases, the nature of the new REST-based cmdlets mean that some additional care is necessary to ensure that the updated code works as expected. As we examine in this article, filters are just one example where some attention to detail is needed to make sure Exchange Online delivers the right set of mailbox data.

June 21, 2021

Creating Personal Contacts in User Mailboxes with PowerShell and the Graph

An earlier article explained how to create organizational contacts in user mailboxes with Graph API calls. This article builds on that idea with three improvements. First, we select target mailboxes for update by looking for those added in the last month. Second, we allow any mail-enabled recipient to be added as an organizational contact. Third, we incorporate some code to check if a contact already exists in a mailbox. Like anything with PowerShell, this code can be improved..

June 15, 2021
Moving on from Send-MailMessage: Sending Email from PowerShell using the Graph API 36 Comments
PowerShell Microsoft Graph

Moving on from Send-MailMessage: Sending Email from PowerShell using the Graph API

Many PowerShell scripts use the Send-MailMessage cmdlet to send mail. That's fine, but if you want to remove basic authentication to improve tenant security, you need to stop using Send-MailMessage. One solution is to move to use the Graph API SendMail call. This works fine, but it creates some new security issues that need to be thought through. In this article, we explain how to use the Graph to send email and some of those security considerations to ponder.

June 8, 2021
Getting Exchange Online Distribution List Membership Counts with PowerShell 15 Comments
Exchange Online Powershell

Getting Exchange Online Distribution List Membership Counts with PowerShell

It's important to know if a tenant has any very large distribution lists as these might be the source of reply-all mail storms. An old article explains how to report the membership counts for distribution lists on an on-premises Exchange server. Life is different in the cloud, and we need to take a different approach. This article explains how to use different calls in a PowerShell script to create a nice report about distribution list memberships.

June 7, 2021
Creating Custom B2B Guest User Invitations with Graph API 14 Comments
Azure AD Microsoft Graph API PowerShell

Creating Custom B2B Guest User Invitations with Graph API

Azure AD business-to-business guest user accounts are a terrific way to securely grant access to apps and services for external users and partner organizations. In this article, a script is introduced that can be used to automate the guest user invitation process, integrating it more seamlessly with any custom applications.

June 2, 2021

Upgrade Your Exchange Online Scripts to Use the Get-EXOMailbox Cmdlet

Many Exchange Online scripts use the old Get-Mailbox cmdlet to fetch mailbox data. It's time to change these calls out and replace them with Get-ExoMailbox. The new cmdlet is faster than the old and more resilient in its ability to handle server glitches. There's no reason to continue using the old Remote PowerShell cmdlets unless you like slowness and errors.

May 26, 2021
Prepopulating Outlook Contacts with the Graph API 55 Comments
Microsoft Graph

Prepopulating Outlook Contacts with the Graph API

When contacts are added to an organizations Global Address List (GAL), they do not always populate in the users personal device contacts depending on what app, device, etc. is being used. This becomes problematic when users working from outside the office are unable to contact the IT Service Desk, HR, or other internal services. To solve the problem, this article introduces a PowerShell script that will read a set of standard contacts from a CSV file and write them as personal contacts to user mailboxes. Mobile devices can then synchronize these contacts along with others created by the user.

May 20, 2021
New-DistributionGroup: A PowerShell Cmdlet Which Gets No Respect 9 Comments
Powershell New-DistributionGroup

New-DistributionGroup: A PowerShell Cmdlet Which Gets No Respect

The New-DistributionGroup cmdlet has been in Exchange since 2006. It creates a new distribution list that is easily populated with a few commands. Although Microsoft might like everyone to use the new-fangled Microsoft 365 Groups, the fact remains that distribution lists are very useful. So much so that many millions are still in active use. In this article, we explore how to create new standard and dynamic distribution lists with PowerShell.

May 12, 2021
How to Use PowerShell to Remove OneDrive Files Found by a Content Search One comment
How to Use PowerShell to Remove OneDrive Files Found by a Content Search

How to Use PowerShell to Remove OneDrive Files Found by a Content Search

Ever wondered how to perform selective deletion of OneDrive documents found in Content Searches? While you can remove email using a content search action, Office 365 doesn’t include a method to cleanup OneDrive documents found by content searches. This article demonstrates how to use PowerShell to view the set of files, and then select files to remove.

May 5, 2021

Switch between Office update channels and enable Teams Preview features

Two recent updates for Microsoft Teams and Office (Microsoft 365 Apps for Enterprise) allow you to self-select whether you want to use Beta (Insider), Current, Monthly and Bi-Annual features within the client, and toggle Teams Preview features. Find out how to switch this on for your copy of Office and Teams, and how as an admin you can enable this for your users.

March 5, 2021