Skip to content

Instantly share code, notes, and snippets.

#requires -modules "PnP.PowerShell"
function Test-ListItemPath
{
[CmdletBinding()]
param
(
[parameter(mandatory=$true)]
[string]
@joerodgers
joerodgers / Test-CodeSign.ps1
Created March 26, 2024 20:34
Testing PowerShell Script Signing using a self-signed cert
function Test-CodeSign
{
write-Host "HELLO WORLD"
}
<#
$params = @{
Subject = "CN=PowerShell Script Code Signing"
Type = "CodeSigningCert"
#requires -modules "PnP.PowerShell"
function Get-ItemAnalytics
{
[CmdletBinding()]
param
(
[parameter(mandatory=$true)]
[string]
$ItemDriveUrl,
@joerodgers
joerodgers / New-ConferenceRoomMailboxRunbook.ps1
Last active March 15, 2024 19:46
Automation Account Runbook POC for creating new conference room mailboxes based on submissions in a SPO list
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
Import-Module -Name "Microsoft.Graph.Authentication"
Import-Module -Name "Microsoft.Graph.Users"
Import-Module -Name "ExchangeOnlineManagement"
Import-Module -Name "PnP.PowerShell"
class MailboxRequest
{
[int]
@joerodgers
joerodgers / New-Password.ps1
Last active March 14, 2024 21:40
PowerShell 5+ cryptographically secure password generator. It's a port of the legacy System.Web.Security.Membership.GeneratePassword(Int32, Int32) function
function New-Password
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[ValidateRange(2,128)]
[int]
$Length,
function ConvertTo-Base64UrlEncodedString
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[byte[]]
$Bytes
)
#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
)