### FILE: scripts/Get-CopilotPagesUsageBaseline.ps1 <# .SYNOPSIS Baselines Microsoft 365 Copilot Pages activity from the Unified Audit Log before the MC1466760 UX cutover. .DESCRIPTION Connects to Exchange Online and queries the Unified Audit Log for CopilotInteraction records with PageCreated and PageEdited operations over the last 30 days. Results are paginated using session-based ReturnLargeSet retrieval to handle large tenants, then exported to CSV for use as a pre-cutover usage baseline. This baseline helps identify which users are actively creating/editing Copilot Pages so that proactive change-management communications can be targeted ahead of the September 2026 GA rollout (Message Center post MC1466760), which removes the 'browse existing Pages' capability from the 'Edit in Pages' menu and moves it to the Library tab and the '/' slash-command menu. .EXAMPLE .\Get-CopilotPagesUsageBaseline.ps1 Connects to Exchange Online (interactive), pulls the last 30 days of Copilot Pages activity, and exports the results to .\CopilotPagesActivity_Baseline.csv .NOTES Author: Souhaiel Morhag Company: MSEndpoint.com Blog: https://msendpoint.com Academy: https://app.msendpoint.com/academy LinkedIn: https://linkedin.com/in/souhaiel-morhag GitHub: https://github.com/Msendpoint License: MIT Required Scopes / Roles: - AuditLog.Read.All (Microsoft Graph, if used elsewhere) - View-Only Audit Logs (Exchange Online RBAC role) Requires: - ExchangeOnlineManagement module (Install-Module ExchangeOnlineManagement) Run this BEFORE the September 2026 cutover date referenced in MC1466760 to capture a clean baseline. #> [CmdletBinding()] param( [Parameter(Mandatory = $false)] [int]$LookbackDays = 30, [Parameter(Mandatory = $false)] [string]$OutputPath = ".\CopilotPagesActivity_Baseline.csv" ) #region Connect try { Write-Verbose "Connecting to Exchange Online..." Connect-ExchangeOnline -ErrorAction Stop } catch { Write-Error "Failed to connect to Exchange Online: $($_.Exception.Message)" exit 1 } #endregion #region Baseline audit pull - last N days of Page activity $startDate = (Get-Date).AddDays(-$LookbackDays) $endDate = Get-Date $results = @() $sessionId = "CopilotPagesAudit-$(Get-Date -Format yyyyMMddHHmm)" try { Write-Output "Querying Unified Audit Log for CopilotInteraction (PageCreated / PageEdited) from $startDate to $endDate..." do { $batch = Search-UnifiedAuditLog ` -StartDate $startDate ` -EndDate $endDate ` -RecordType CopilotInteraction ` -Operations "PageCreated", "PageEdited" ` -SessionId $sessionId ` -SessionCommand ReturnLargeSet ` -ResultSize 5000 ` -ErrorAction Stop if ($batch) { $results += $batch } } while ($batch.Count -eq 5000) if ($results.Count -eq 0) { Write-Warning "No CopilotInteraction PageCreated/PageEdited events found in the specified date range." } $results | Select-Object CreationDate, UserIds, Operations, AuditData | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8 Write-Output "Exported $($results.Count) Copilot Pages events to $OutputPath" exit 0 } catch { Write-Error "Audit pull failed: $($_.Exception.Message)" exit 1 } finally { Disconnect-ExchangeOnline -Confirm:$false -ErrorAction SilentlyContinue } #endregion ### FILE: scripts/Get-CopilotLicensedUsersForComms.ps1 <# .SYNOPSIS Enumerates Microsoft 365 users licensed for Copilot to scope a targeted change-management comms list. .DESCRIPTION Connects to Microsoft Graph (v2 SDK) and retrieves all users, filtering to those assigned a Microsoft 365 Copilot or Copilot Chat license SKU. Produces a CSV of DisplayName / UserPrincipalName suitable for driving a targeted email or Teams announcement ahead of the MC1466760 'Edit in Pages' UX change rolling out GA worldwide in September 2026. This script performs read-only enumeration; no licenses, policies, or configuration are modified. .EXAMPLE .\Get-CopilotLicensedUsersForComms.ps1 Connects to Microsoft Graph interactively and exports Copilot-licensed users to .\CopilotLicensedUsers_ForComms.csv .NOTES Author: Souhaiel Morhag Company: MSEndpoint.com Blog: https://msendpoint.com Academy: https://app.msendpoint.com/academy LinkedIn: https://linkedin.com/in/souhaiel-morhag GitHub: https://github.com/Msendpoint License: MIT Required Scopes: - User.Read.All - Organization.Read.All Requires: - Microsoft.Graph PowerShell SDK v2 (Install-Module Microsoft.Graph) - Do NOT use the deprecated AzureAD / MSOnline modules. #> [CmdletBinding()] param( [Parameter(Mandatory = $false)] [string[]]$CopilotSkuNames = @("Microsoft_365_Copilot", "Copilot_Chat"), [Parameter(Mandatory = $false)] [string]$OutputPath = ".\CopilotLicensedUsers_ForComms.csv" ) #region Connect via Microsoft.Graph v2 try { Write-Verbose "Connecting to Microsoft Graph..." Connect-MgGraph -Scopes "User.Read.All", "Organization.Read.All" -NoWelcome -ErrorAction Stop } catch { Write-Error "Failed to connect to Microsoft Graph: $($_.Exception.Message)" exit 1 }