Skip to content

Instantly share code, notes, and snippets.

#requires -version 7
#requires -modules "Microsoft.Graph.Authentication", "Microsoft.Graph.Beta.Identity.DirectoryManagement"
$params = @{
Values = @(
@{
Name = "EnableMIPLabels"
Value = "True"
}
)
@joerodgers
joerodgers / OneDriveEEEU.ps1
Created March 8, 2024 18:51
Reports all EEEU instances on the root of OneDrive sites in a tenant.
#requires -modules "PnP.PowerShell"
# requires SharePoint > Application > Sites.FullControl.All
Connect-PnPOnline `
-Url "https://$env:O365_TENANT-admin.sharepoint.com" `
-ClientId $env:O365_CLIENTID `
-Thumbprint $env:O365_THUMBPRINT `
-Tenant $env:O365_TENANTID `
-ErrorAction Stop
@joerodgers
joerodgers / Get-LoopContainerInfo.ps1
Last active March 7, 2024 17:55
Temp workaround for an issue with SPO Mgmt. Shell issue
#requires -modules "PnP.PowerShell"
function ConvertTo-ContainerStatusString
{
param
(
[Parameter(Mandatory=$true)]
[int]
$ContainerStatus
)
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking -ErrorAction Stop
# tenant name
$tenant = $env:O365_TENANT
# define a list of users or groups to report. Use UPN for user objects and ObjectId for group objects
$identities = "jane.doe@contoso.com", "john.doe@contoso.com", "986b904f-0de9-416d-9fd9-7e5d8402e7c0"
if( -not $credential )
{
#requires -modules "pnp.powershell"
# required permissions:
# SharePoint > Sites.FullControl.All
Connect-PnPOnline `
-Url "https://$env:O365_TENANT-admin.sharepoint.com" `
-ClientId $env:O365_CLIENTID `
-Thumbprint $env:O365_THUMBPRINT `
-Tenant $env:O365_TENANTID
#requires -module "pnp.powershell"
Connect-PnPOnline `
-Url "https://$env:O365_TENANT-admin.sharepoint.com" `
-ClientId $env:O365_CLIENTID `
-Thumbprint $env:O365_THUMBPRINT `
-Tenant $env:O365_TENANTID `
-ErrorAction Stop
$rows = Import-Csv -Path "C:\_temp\AllowedRecordingList.csv"
@joerodgers
joerodgers / Add-M365GroupOwnersClaimToAssociatedOwnerGroup.ps1
Last active January 5, 2024 17:57
Adds the M365 Group Owners Claim (back) into the site's AssociatedOwnerGroup. Warning: the M365 Group Owners principal is not hidden in the UI like it is during native creation
Import-Module -Name "PnP.PowerShell" -ErrorAction Stop
Connect-PnPOnline `
-Url "https://contoso.sharepoint.com/sites/group-site" `
-ClientId $env:O365_CLIENTID `
-Thumbprint $env:O365_THUMBPRINT `
-Tenant $env:O365_TENANTID `
-ErrorActoin Stop
$web = Get-PnPWeb -Includes AssociatedOwnerGroup
@joerodgers
joerodgers / Disable-TeamifyDialog.ps1
Created January 2, 2024 16:44
Hides the "Add real-time chat" dialog on M365 Group connected sites.
#requires -modules "PnP.PowerShell"
# required app permissions: SharePoint > Application > Site.FullControl.All
$siteUrl = "https://contoso.sharepoint.com/sites/teamsite"
# OPTION 1 - Use the tenant admin site context
Connect-PnPOnline `
Add-PSSnapin Microsoft.SharePoint.PowerShell
function Get-NintexFormsEnabledList
{
[CmdletBinding()]
param
(
[parameter(Mandatory=$true)]
[Microsoft.SharePoint.SPWeb]
$Web
#requires -modules "PnP.PowerShell"
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
# requires SharePoint > Application > Sites.FullControl.All to query tenant site list
Connect-PnPOnline `
-Url "https://$env:O365_TENANT-admin.sharepoint.com" `
-ClientId $env:O365_CLIENTID `
-Thumbprint $env:O365_THUMBPRINT `
-Tenant $env:O365_TENANTID `