Skip to content

Instantly share code, notes, and snippets.

View exactmike's full-sized avatar

Mike Campbell exactmike

View GitHub Profile
@exactmike
exactmike / Identify Orphaned Azure AD Users.md
Last active August 14, 2023 15:52
Find Orphaned Azure AD Users

Requirements

Have the following powershell modules installed, functions loaded, and permissions granted to the connection you are going to make to Microsoft Graph and ActiveDirectory

Modules

Install these modules in the environment where you will run your powershell session

  • Microsoft.Graph
  • OGraph
@exactmike
exactmike / StaleUserManagement.md
Last active July 13, 2022 15:07
StaleUserManagement

Initial Tenant Setup

Register an Enterprise App

Attribute Value
Name Stale Account Management
Supported Account Types Accounts in this organizational directory only

Note the application (client) ID and the Directory (tenant) ID

@exactmike
exactmike / Export-ExchangeConfiguration.ps1
Created February 10, 2022 17:35
Scripts to Export Exchange Configuration
[cmdletbinding()]
param(
[parameter(Mandatory)]
[ValidateScript( { Test-Path -type Container -path $_ })]
[string]$OutputFolderPath
,
[switch]$ExchangeOnline
)
$ErrorActionPreference = 'Continue'
@exactmike
exactmike / EdgeBrowserProfileShortcuts.ps1
Last active September 4, 2020 13:11
Powershell Function Development
#From https://www.joseespitia.com/2020/02/07/automatically-create-microsoft-edge-profile-shortcuts/
$EdgeProfiles = Get-ChildItem "$env:LOCALAPPDATA\Microsoft\Edge\User Data" | Where-Object { $_.Name -like "Profile *" }
ForEach ($EdgeProfile in $EdgeProfiles.Name)
{
# Get Profile Name
$Preferences = "$env:LOCALAPPDATA\Microsoft\Edge\User Data\$EdgeProfile\Preferences"
$Data = (ConvertFrom-Json (Get-Content $Preferences -Raw))
$ProfileName = $Data.Profile.Name
@exactmike
exactmike / Send-OutlookMail.ps1
Last active January 22, 2021 14:46
Functions for Outlook Automation with PowerShell
Function Send-OutlookMail
{
[cmdletbinding()]
param(
[parameter()]
[string]$Subject
,
[parameter()]
$Body
,
@exactmike
exactmike / GetAzureADUserByAnAttribute.ps1
Last active August 21, 2020 18:43
Getting Azure AD Users by a Filterable Attribute
function Get-AzureADUserByAttribute
{
<#
.SYNOPSIS
Get Azure AD users by an arbitrary filterable attribute, such as MailNickName.
.DESCRIPTION
Get Azure AD users by an arbitrary filterable attribute, such as MailNickName.
.EXAMPLE
$list = Import-CSV .\TempTestUsers.csv
@exactmike
exactmike / CustomRBACForDGs.md
Last active June 23, 2023 21:12
Exchange 2013 End User Distribution Group Management

Distribution Group Management for End Users

Overview

When end users mailboxes are migrated to Exchange Online from Exchange on premises the users' ability to manage email enabled on premises directory distribution groups in Microsoft Outlook is impacted. The users' Outlook is no longer connecting to the on premises directory service. While Outlook will have visibility to the synchronized representation of the on premises email enabled distribution groups those synchronized groups are not directly editable in the online directory.

As an alternative to using Outlook to manage Distribution Groups users have access to the Exchange Control Panel (ECP), a web interface that is a native part of Microsoft Exchange for end user and administrative access to Exchange features. However, access to the ECP for end users is typically tied to having a Mailbox in the same Exchange environment. Because of this dependency for typical ECP access by end users, when a user mailbox is migrated to Exchange Online, the user's

@exactmike
exactmike / Export-ExchangeConfiguration.ps1
Last active November 11, 2020 22:29
Export an Exchange Org's Configuration
[cmdletbinding()]
param(
[parameter(Mandatory)]
[ValidateScript( { Test-Path -type Container -Path $_ })]
[string]$OutputFolderPath
,
[parameter(Mandatory)]
[ValidateSet('Online', 'Exchange2013+')]
[string]$OrganizationType
)
@exactmike
exactmike / AADDocumentationRunner.ps1
Last active August 5, 2020 15:27
AAD Documentation Runner
Start-Process -NoNewWindow -FilePath .\AzureADConnectSyncDocumenterCmd.exe -ArgumentList 'org\Production org\Production'
@exactmike
exactmike / ExportOffice365Configuration.ps1
Last active February 18, 2020 15:59
A script to install and use the Office365DSC PowerShell Module to export an Office 365 Tenant's Configuration
[cmdletbinding()]
param(
#Specify the username to use for extracting Office 365 Configuration. Should be Global Admin or Equivalent Read access. The script will prompt for password.
[parameter()]
[string]$UserName
,
#Path to a directory for the output of the script. Any existing output may be overwritten. If the directory does not exist, it will be created if possible.
[string]$Path
)