Skip to content

Instantly share code, notes, and snippets.

#requires -modules "AzureAD"
Connect-AzureAD
$clientId = 'aa326a3b-706a-4a7c-a96f-1a7e371e967x'
$endDate = [DateTime]::Today.AddYears(2)
$startDate = [Datetime]::Today
$app = Get-AzureADServicePrincipal -Filter "AppId eq '$clientId'"
@joerodgers
joerodgers / Get-FolderChildCount.ps1
Created May 17, 2024 19:23
Gets the file and folder count for the provided list folder and, optionally, all sub folders.
#requies -modules "PnP.PowerShell"
function Get-FolderChildCount
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[Microsoft.SharePoint.Client.List]
$List,
#requires -modules "PnP.PowerShell"
# permissions required 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_TENANT `
-ErrorAction Stop
@joerodgers
joerodgers / Install-MicrosoftGraphPowerShell-v1-28-0.ps1
Last active May 6, 2024 21:29
Example how to forcefully uninstall all versions of the Microsoft.Graph PowerShell module
#requires -runasadministrator
Install-Module -Name "Microsoft.Graph" -Scope AllUsers -RequiredVersion "1.28.0"
@joerodgers
joerodgers / Get-PowerAutomateActionRepetitionsResponse.ps1
Last active May 6, 2024 17:09
PoC script to pull all response page data for an HTTP action from a power automate flow
function Get-PowerAutomateActionRepetitionsUrl
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[Uri]
$Url,
[Parameter(Mandatory=$true)]
@joerodgers
joerodgers / Get-EffectiveSiteCollectionAdministrator.ps1
Last active May 29, 2024 18:59
Scans all SPO sites in the farm and reports all sites having site admins from a predefined list
#requires -modules "PnP.PowerShell"
class SiteCollectionModel
{
[string]
$SiteUrl
[System.Guid]
$SiteId
}
@joerodgers
joerodgers / Get-ListRenderType.ps1
Created May 3, 2024 16:46
Supplements the Microsoft365 InfoPath Assessment Tool by adding 3 new columns to the classicinfopath.csv to track if the list has already been converted to use a PowerApps form
#requires -modules "PnP.PowerShell"
enum RenderType
{
Classic = 1
Modern = 2
PowerApps = 3
Customized = 4
Unknown = 5
}
@joerodgers
joerodgers / Get-TranscriptFile.ps1
Last active April 25, 2024 20:30
Rough proof of concept on locating transcript files stored in OD4B.
#requires -modules "PnP.PowerShell"
function Get-TranscriptFile
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[DateTime]
$CreatedOnOrBefore
#requires -modules "PnP.PowerShell"
function Test-ListItemPath
{
[CmdletBinding()]
param
(
[parameter(mandatory=$true)]
[string]