A collection of scripts and files that I use as part of my role as a Copilot Solution Engineer.
Many scripts in this toolbox use environment variables for configuration. These variables can be set using a .env file in the root directory of the repository.
-
Copy the
.env-examplefile to create your own.envfile:Copy-Item .env-example .env
-
Edit the
.envfile and replace the placeholder values with your actual configuration:# Multiple Scripts TENANT_ID=your-tenant-id-guid # Compliance scripts UPN=admin@yourtenant.onmicrosoft.com # Blob storage scripts STORAGE_ACCOUNT_NAME=yourstorageaccount RESOURCE_GROUP_NAME=your-resource-group CONTAINER_NAME=yourcontainer # And so on... -
The
Menu.ps1script will automatically load these variables when executed.
The .env-example file includes configuration for:
- Multiple Scripts:
TENANT_ID - Compliance Scripts:
UPN - Blob Storage Scripts:
STORAGE_ACCOUNT_NAME,RESOURCE_GROUP_NAME,CONTAINER_NAME - Database Scripts:
SQL_SERVER_NAME,SQL_RESOURCE_GROUP_NAME - Fabric Scripts:
FABRIC_RESOURCE_GROUP_NAME,FABRIC_NAME - Power Platform Scripts:
POWER_PLAT_CLIENT_ID,POWER_PLAT_CLIENT_SECRET,POWER_PLAT_TENANT_DOMAIN,POWER_PLAT_ORG_URL - Azure VM Scripts:
AZURE_SUBSCRIPTION_ID,AZURE_VM_RESOURCE_GROUP_NAME - SharePoint Online Scripts:
SHAREPOINT_ONLINE_CLIENT_ID,SHAREPOINT_ONLINE_CERTIFICATE_PATH,SHAREPOINT_ONLINE_SITE_ID,SHAREPOINT_ONLINE_DRIVE_ID,SHAREPOINT_ONLINE_FOLDER_PATH
Note: The
.envfile is included in.gitignoreto prevent accidentally committing sensitive credentials to version control.
Central configuration file that sets up environment variables and common configuration used by multiple scripts. Includes functionality to load settings from a .env file.
# Load the configuration file
. .\Menu.ps1
# Environment variables will be loaded from .env file if present
# Variables include: UPN, TENANT_ID, STORAGE_ACCOUNT_NAME, etc.Retrieves all Azure App Registrations and displays their names and App IDs.
# Run the script directly - it handles authentication and retrieval
.\Azure\Get-AzureAppRegistrations.ps1Retrieves information about files stored in Azure Blob Storage containers.
# Set your Azure storage parameters
$storageAccountName = "yourstorageaccount"
$containerName = "yourcontainer"
# Run the script
.\Azure\Get-AzureBlobFiles.ps1Retrieves cost reports for Azure resource groups for a specified date range using Azure Cost Management API. Allows selection of resource groups and provides detailed cost breakdown by resource type.
# Get cost reports for the last 7 days with resource group selection prompt
Get-AzureCostReportsByResourceGroups
# Get cost reports for a specific date range
Get-AzureCostReportsByResourceGroups -StartDate "2025-12-01" -EndDate "2025-12-17"
# Specify subscription and output directory
Get-AzureCostReportsByResourceGroups -SubscriptionId "your-subscription-id" `
-OutputDirectory "C:\temp\CostReports"Retrieves members of an Entra ID (Azure AD) group by name or email. Displays users, groups, and service principals with categorized output.
# Get members of a group by display name
.\Azure\Get-EntraGroupMembers.ps1 -GroupNameOrEmail "Marketing Team"
# Get members of a group by email
.\Azure\Get-EntraGroupMembers.ps1 -GroupNameOrEmail "marketing@contoso.com"Configures network access rules for Azure Blob Storage accounts. Enables or disables public access and manages IP firewall rules.
# Enable network restrictions and add current IP
Set-AzureBlobStorageAccess -ResourceGroupName "myResourceGroup" `
-StorageAccountName "mystorageaccount" `
-Enable
# Disable network restrictions
Set-AzureBlobStorageAccess -ResourceGroupName "myResourceGroup" `
-StorageAccountName "mystorageaccount"Configures Azure SQL Server access settings and firewall rules.
# Configure SQL Server access
Set-AzureSQLServerAccess -ServerName "yoursqlserver" `
-ResourceGroupName "your-resource-group"Manages the state (start/stop) of Microsoft Fabric capacities in Azure.
# Set your Fabric capacity parameters
$subscriptionId = "your-subscription-id"
$resourceGroupName = "your-resource-group"
$capacityName = "your-fabric-capacity"
$state = "Active" # or "Paused"
# Run the script
.\Azure\Set-FabricCapacityState.ps1
Set-FabricCapacityState -ResourceGroupName $resourceGroupName `
-FabricName $fabricName `
-State "Active"Starts Azure Virtual Machines across resource groups.
# Run the script
.\Azure\Start-AzureVMs.ps1
Start-AzureVMs -ResourceGroupName "<your resource group>" `
-SubscriptionId "<your subscription id>"
Stops Azure Virtual Machines across resource groups.
# Stop VMs in a resource group
Stop-AzureVMs -ResourceGroupName "<your resource group>" `
-SubscriptionId "<your subscription id>"A Swagger 2.0/OpenAPI definition file for the Azure Maps Render API. This file describes the API endpoints for generating static map images with customizable pins, paths, and styling. Can be used to create a custom Power Platform connector to the Azure Maps API.
Import this file into Power Platform to create a custom connector, or use a Swagger UI viewer to visualize and interact with the API.
Performs a compliance content search and exports the results.
# Set your search parameters
$upn="admin@domain.com"
$complianceSearchName = "MyContentSearch"
$mailbox = "<mailbox email address>"
$startDate="2025-02-20"
$endDate="2025-02-22"
$kql="Subject:`"`" AND sent>=$startDate AND sent<=$endDate"
# Run the script
.\Compliance\ContentSearch.ps1Retrieves all retention policies and their associated rules from Microsoft 365 Compliance Center.
# Set your parameters
$upn = "admin@yourdomain.com"
# Run the script
.\Compliance\Get-AllRetentionPoliciesAndRules.ps1Searches the unified audit log and retrieves results for specified date ranges.
# Set your parameters
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\Compliance\Get-AuditLogResults.ps1Retrieves audit log entries for Copilot bot creation events.
# Set your parameters
$upn = "admin@yourdomain.com"
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\Copilot\Get-CopilotCreationAuditLogItems.ps1Retrieves audit log entries for Copilot interaction events.
# Run the script with parameters
.\Copilot\Get-CopilotInteractionAuditLogItems.ps1 -StartDate '2025-06-01' `
-EndDate '2025-06-30' `
-UserPrincipalName 'admin@yourdomain.com' `
-OutputFile 'c:\temp\copilotinteractionauditlog.csv' `
-AppendA Jupyter Notebook for interacting with a Copilot retrieval API.
Open the notebook in a compatible environment like VS Code to see the documented steps for API interaction.
A Swagger/OpenAPI definition file for a Copilot retrieval API. This file describes the API endpoints, parameters, and responses & can be used to create a custom Power Platform connector to this API.
Use a Swagger UI viewer to visualize and interact with the API defined in this file.
A Jupyter Notebook for retrieving Microsoft 365 Copilot usage reports via Microsoft Graph API using application permissions. Demonstrates authentication with client credentials and accessing Reports.Read.All API endpoints.
Open the notebook in VS Code or Jupyter. Ensure your .env file contains:
CopilotReportAPIPythonClient_IdCopilotReportAPIPythonClient_SecretCopilotAPIPythonClient_Tenant
Grant Reports.Read.All application permission in your Entra App Registration.
A Jupyter Notebook for retrieving Microsoft Teams meeting insights and transcripts using Microsoft Graph API with delegated user permissions. Demonstrates how to access meeting transcripts and AI-generated insights.
Open the notebook in VS Code or Jupyter. Configure your Entra App Registration with delegated permissions:
User.ReadCalendars.ReadOnlineMeetings.ReadOnlineMeetingTranscript.Read.AllOnlineMeetingAiInsight.Read.All
Enable public client flow in your App Registration authentication settings.
Retrieves audit log entries for Copilot sharing events and activities.
# Set your parameters
$upn = "admin@yourdomain.com"
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\Copilot\Get-CopilotSharingAuditLogItems.ps1 -StartDate $startDate `
-EndDate $endDate `
-UserPrincipalName $upn `
-OutputFile 'c:\temp\copilotsharingauditlog.csv'Retrieves detailed information about an Entra ID user.
# Set the user UPN
$upn = "user@yourdomain.com"
# Run the script
.\Entra\Get-EntraUserInfo.ps1Gets license information for Entra ID users.
# Set the user UPN
$upn = "user@yourdomain.com"
# Run the script
.\Entra\Get-EntraUserLicenseInfo.ps1Creates a self-signed certificate for Entra (Azure AD) app registration authentication. Generates both PFX (with private key) and CER (public key) files with configurable validity period. Optionally installs the certificate to CurrentUser or LocalMachine certificate store.
# Create certificate with default settings (exports to C:\temp)
.\Entra\New-EntraAppCertificate.ps1
# Create certificate for specific app and install to CurrentUser store
.\Entra\New-EntraAppCertificate.ps1 -SubjectName "CN=SharePoint Scripts" -InstallToStore
# Create certificate with custom validity and install to LocalMachine (requires admin)
.\Entra\New-EntraAppCertificate.ps1 -SubjectName "CN=MyApp" `
-ValidityYears 3 `
-InstallToStore `
-StoreLocation LocalMachine
# Specify custom export location and certificate name
.\Entra\New-EntraAppCertificate.ps1 -SubjectName "CN=MyApp" `
-ExportPath "C:\Certificates" `
-CertificateName "MyAppCert"Updates the User Principal Name (UPN) for Azure AD users.
# Set the old and new UPN values
Update-AADUserUPN -originalUpn "user@olddomain.com" `
-newUpn "user@newdomain.com" `
-applyChanges `
-logFolder 'c:\temp\upnupdatelog.csv'Analyzes system performance metrics and provides detailed performance insights.
# Run the script to analyze system performance
.\Misc\Get-SystemPerformanceAnalysis.ps1Retrieves online meeting recordings for a specific user within a date range using Microsoft Graph.
# Set your parameters
$clientId = "your-app-registration-id"
$tenantId = "your-tenant-id"
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object {$_.Subject -like "*YourCertName*"}
$meetingOrganizerUserId = "user@yourdomain.com"
# Run the script
.\MsGraph\Get-OnlineMeetingRecordings.ps1Generates comprehensive Microsoft 365 usage and activity reports using Microsoft Graph.
# Set your reporting parameters
$tenantId = "your-tenant-id"
$clientId = "your-app-registration-id"
# Run the script
.\MsGraph\M365Reporting.ps1Adds an application user to Power Platform environment(s) using the Power Platform CLI. Supports adding to a single environment or all environments in a tenant with a specified security role. Requires Power Platform CLI (pac) to be installed.
# Add app user to a specific environment
.\Power-Platform\Add-AppUserViaCLI.ps1 -AppId "12345678-1234-1234-1234-123456789012" `
-OrgUrl "https://org.crm.dynamics.com"
# Add app user to ALL environments in the tenant
.\Power-Platform\Add-AppUserViaCLI.ps1 -AppId "12345678-1234-1234-1234-123456789012" `
-AllEnvironments
# Use custom role and skip authentication
.\Power-Platform\Add-AppUserViaCLI.ps1 -AppId "12345678-1234-1234-1234-123456789012" `
-OrgUrl "https://org.crm.dynamics.com" `
-Role "Basic User" `
-SkipAuthConverts conversation transcript data from Power Platform to human-readable format, reconstructing chronological conversations between users and bots.
# Convert transcript data to readable format
.\Power-Platform\ConvertFrom-AgentTranscript.ps1 -InputFile "C:\temp\conversationtranscripts.txt" `
-OutputFile "C:\temp\readable_transcripts.txt"Retrieves information about all data policy connectors in the Power Platform tenant.
# Run the script directly - it handles authentication and data retrieval
Get-AllDataPolicyConnectorInfo | Export-Csv -Path "C:\temp\PowerPlatformDataPolicyConnectors.csv" -NoTypeInformation -ForceGets bot components information using Power Platform APIs.
# Set your environment parameters
$clientId="<your client id>"
$clientSecret="<your client secret>"
$orgUrl="<your org>.crm.dynamics.com"
$tenantDomain="<your tenant domain>.onmicrosoft.com"
# Run the script
Get-BotComponentsViaAPI -ClientId $clientId `
-ClientSecret $clientSecret `
-OrgUrl $orgUrl `
-TenantDomain $tenantDomain `
-FieldList $fieldListRetrieves conversation transcripts from Power Platform bots via API within a specified date range.
# Set your environment parameters
$clientId = "<your client id>"
$clientSecret = "<your client secret>"
$orgUrl = "<your org>.crm.dynamics.com"
$tenantDomain = "<your tenant domain>.onmicrosoft.com"
$endDate = (Get-Date).ToString("yyyy-MM-dd")
$startDate = (Get-Date).AddDays(-30).ToString("yyyy-MM-dd")
# Run the script
Get-ConversationTranscriptsViaAPI -ClientId $clientId `
-ClientSecret $clientSecret `
-OrgUrl $orgUrl `
-TenantDomain $tenantDomain `
-StartDate $startDate `
-EndDate $endDate `
-FieldList "content,createdon,conversationtranscriptid,_bot_conversationtranscriptid_value,metadata" `
| Export-Csv -Path "C:\temp\conversation-transcripts.csv" -NoTypeInformationRetrieves Copilot agents information via Power Platform APIs.
# Run the script
Get-CopilotAgentsViaAPI -ClientId "<your client id>" `
-ClientSecret "<your client secret>" `
-OrgUrl "<your org>.crm.dynamics.com" `
-TenantDomain "<your domain>.onmicrosoft.com" `
-FieldList "botid,componentidunique,applicationmanifestinformation,name,configuration,createdon,publishedon,_ownerid_value,_createdby_value,solutionid,modifiedon,_owninguser_value,schemaname,_modifiedby_value,_publishedby_value,authenticationmode,synchronizationstatus,ismanaged" `
| Out-File "c:\temp\bots.txt"Retrieves a comprehensive list of all Copilot agents and their components from all Power Platform environments.
# Run the script to get all copilots and components
.\Power-Platform\Get-CopilotsAndComponentsFromAllEnvironments.ps1 | Export-Csv -Path "C:\temp\AllCopilotsAndComponents.csv" -NoTypeInformationRetrieves all Power Apps and their connections within the tenant.
# Run the script to get all Power Apps and their connections
.\Power-Platform\Get-PowerAppsAndConnections.ps1 | Export-Csv -Path "C:\temp\PowerAppsAndConnections.csv" -NoTypeInformationRetrieves detailed information about all Power Platform environments.
# Run the script to get environment information
.\Power-Platform\Get-PowerPlatformEnvironmentInfo.ps1 | Export-Csv -Path "C:\temp\PowerPlatformEnvironments.csv" -NoTypeInformationGenerates usage reports for Power Platform services.
# Run the script to generate usage reports
.\Power-Platform\Get-PowerPlatformUsageReports.ps1 -ReportType "ActiveUsers" -OutputDirectory "C:\temp\UsageReports"Retrieves tenant-level settings for Power Platform via API.
# Set your environment parameters
$clientId = "<your client id>"
$clientSecret = "<your client secret>"
$tenantDomain = "<your tenant domain>.onmicrosoft.com"
# Run the script
.\Power-Platform\Get-PowerPlatTenantSettingsViaAPI.ps1 -ClientId $clientId -ClientSecret $clientSecret -TenantDomain $tenantDomainRetrieves users from a Power Platform environment via API.
# Set your environment parameters
$clientId = "<your client id>"
$clientSecret = "<your client secret>"
$orgUrl = "<your org>.crm.dynamics.com"
$tenantDomain = "<your tenant domain>.onmicrosoft.com"
# Run the script
.\Power-Platform\Get-UsersViaAPI.ps1 -ClientId $clientId -ClientSecret $clientSecret -OrgUrl $orgUrl -TenantDomain $tenantDomainPerforms an inventory of a SharePoint farm. This is for on-premises SharePoint environments.
# Run the script to start the inventory process
.\SharePoint\Inventory-SPFarm.ps1 -FarmConfigDatabase "SP_Config"Adds owners to a SharePoint Online site.
# Set your parameters
$siteUrl = "https://yourtenant.sharepoint.com/sites/YourSite"
$ownerEmails = "user1@yourdomain.com", "user2@yourdomain.com"
# Run the script
.\SharePoint-Online\Add-OwnersToSharePointSite.ps1 -SiteUrl $siteUrl -OwnerEmails $ownerEmailsConverts SharePoint site information to Drive IDs for Microsoft Graph API usage.
# Set the SharePoint site URL
ConvertTo-SharePointDriveId -siteId "<site GUID>" `
-webId "<web GUID>" `
-listId "<list GUID>"Generates a report on Copilot agents in SharePoint Online.
# Run the script to generate the report
.\SharePoint-Online\Get-CopilotAgentReport.ps1 -OutputDirectory "C:\temp\Reports"Retrieves results from a Microsoft Graph delta query, which can be used to track changes to SharePoint Online resources.
# Run the script with your delta query parameters
.\SharePoint-Online\Get-GraphDeltaQueryResults.ps1 -DeltaLink "your_delta_link"Retrieves audit log items related to the creation of SharePoint agents.
# Set your parameters
$upn = "admin@yourdomain.com"
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\SharePoint-Online\Get-SharePointAgentCreationAuditLogItems.ps1 -StartDate $startDate -EndDate $endDate -UserPrincipalName $upnRetrieves audit log items for SharePoint agent interactions.
# Set your parameters
$upn = "admin@yourdomain.com"
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\SharePoint-Online\Get-SharePointAgentInteractionAuditLogItems.ps1 -StartDate $startDate -EndDate $endDate -UserPrincipalName $upnRetrieves properties of files in a SharePoint Online document library.
# Set your parameters
$siteUrl = "https://yourtenant.sharepoint.com/sites/YourSite"
$libraryName = "Documents"
# Run the script
.\SharePoint-Online\Get-SharePointFileProperties.ps1 -SiteUrl $siteUrl -LibraryName $libraryNameCreates new hub sites for a demo project in SharePoint Online.
# Run the script to create the demo hub sites
.\SharePoint-Online\New-DemoProjectHubSites.ps1Creates new project plan documents for a demo in SharePoint Online.
# Run the script to create the demo documents
.\SharePoint-Online\New-DemoProjectPlanDocs.ps1Creates new hub sites in SharePoint Online.
# Run the script to create new hub sites
.\SharePoint-Online\New-HubSites.ps1 -HubSiteNames "HR", "IT", "Finance"Provisions new OneDrive for Business sites for users.
# Set the user emails
$userEmails = "user1@yourdomain.com", "user2@yourdomain.com"
# Run the script
.\SharePoint-Online\New-OneDriveSites.ps1 -UserEmails $userEmailsDesignates a SharePoint Online document library as an organization assets library.
# Set your parameters
$libraryUrl = "https://yourtenant.sharepoint.com/sites/branding/logos"
# Run the script
.\SharePoint-Online\Set-SPOOrgAssetLibrary.ps1 -LibraryUrl $libraryUrlUploads documents to a SharePoint Online document library.
# Set your parameters
$siteUrl = "https://yourtenant.sharepoint.com/sites/YourSite"
$libraryName = "Documents"
$sourceFolder = "C:\temp\Upload"
# Run the script
.\SharePoint-Online\Upload-Documents.ps1 -SiteUrl $siteUrl -LibraryName $libraryName -SourceFolder $sourceFolderA SQL script that converts a table schema to a JSON format.
-- Execute this script in your SQL management tool against your database.
-- It will output the schema of a specified table as JSON.Retrieves all Microsoft Teams meeting policies.
# Run the script to get all meeting policies
.\Teams\Get-AllTeamsMeetingPolicies.ps1 | Export-Csv -Path "C:\temp\TeamsMeetingPolicies.csv" -NoTypeInformationRetrieves a list of all teams in the organization using Microsoft Graph.
# Run the script to get all teams
.\Teams\Get-AllTeamsViaGraph.ps1Retrieves messages from a specific Microsoft Teams channel.
# Set your parameters
$teamId = "your-team-id"
$channelId = "your-channel-id"
# Run the script
.\Teams\Get-ChannelMessages.ps1 -TeamId $teamId -ChannelId $channelIdRetrieves all teams and their members.
# Run the script to get teams and members
.\Teams\Get-TeamsAndMembers.ps1 | Export-Csv -Path "C:\temp\TeamsAndMembers.csv" -NoTypeInformationRetrieves the teams that a specific user is a member of.
# Set the user UPN
$upn = "user@yourdomain.com"
# Run the script
.\Teams\Get-UserTeams.ps1 -UserPrincipalName $upnCreates new channels in a Microsoft Team.
# Set your parameters
$teamId = "your-team-id"
$channelNames = "General", "Announcements", "Project-X"
# Run the script
.\Teams\New-Channels.ps1 -TeamId $teamId -ChannelNames $channelNamesCreates new teams in Microsoft Teams.
# Run the script to create new teams
.\Teams\New-Teams.ps1 -TeamNames "Marketing Team", "Sales Team"Configures moderation settings for a Microsoft Teams channel.
# Set your parameters
$teamId = "your-team-id"
$channelId = "your-channel-id"
# Run the script
.\Teams\Set-ChannelModerationSettings.ps1 -TeamId $teamId -ChannelId $channelId -EnableModeration $trueRetrieves information about Power Platform Environments.
#Modify the following variables with your own values
$clientId="<your client id>"
$clientSecret="<your client secret>"
$tenantDomain="<your tenant>.onmicrosoft.com>"
.\Power-Platform\Get-PowerPlatTenantSettingsViaAPI.ps1Retrieves user information via Power Platform APIs.
# Set your environment parameters
$clientId = "<your client id>"
$clientSecret = "<your client secret>"
$orgUrl = "<your org>.crm.dynamics.com"
$tenantDomain = "<your tenant domain>.onmicrosoft.com"
# Run the script
Get-UsersViaAPI -ClientId $clientId `
-ClientSecret $clientSecret `
-OrgUrl $orgUrl `
-TenantDomain $tenantDomain `
-FieldList "systemuserid,fullname,internalemailaddress,domainname,isdisabled,accessmode,createdon" `
| Export-Csv -Path "C:\temp\users.csv" -NoTypeInformationChanges the owner of a Power App in a Power Platform environment. Automatically installs required Power Apps administration modules if not present.
# Set the Power App ownership
.\Power-Platform\Set-NewPowerAppOwner.ps1 -AppName "cd304785-1a9b-44c3-91a8-c4174b59d835" `
-EnvironmentName "de6b35af-dd3f-e14d-80ff-7a702c009100" `
-AppOwner "7eda74de-bd8b-ef11-ac21-000d3a5a9ee8"Creates an inventory of SharePoint on-premises farm components and configuration.
# Set your SharePoint farm parameters
Inventory-SPFarm `
-LogFilePrefix "Test_" `
-DestinationFolder "d:\temp" `
-InventoryFarmSolutions `
-InventoryFarmFeatures `
-InventoryWebTemplates `
-InventoryTimerJobs `
-InventoryWebApplications `
-InventorySiteCollections `
-InventorySiteCollectionAdmins `
-InventorySiteCollectionFeatures `
-InventoryWebPermissions `
-InventoryWebs `
-InventorySiteContentTypes `
-InventoryWebFeatures `
-InventoryLists `
-InventoryWebWorkflowAssociations `
-InventoryListContentTypes `
-InventoryListWorkflowAssociations `
-InventoryContentTypeWorkflowAssociations `
-InventoryContentDatabases `
-InventoryListFields `
-InventoryListViews `
-InventoryWebParts
SQL query that converts a table schema to JSON format, useful for documentation and schema analysis. Can be used in agent instructions to tell the agent how the tables are structured.
OpenAPI/Swagger specification for the Copilot Retrieval API, for use when building custom connectors for Power Platform.
Adds users as owners to a SharePoint site using certificate-based authentication.
# Set your parameters
$siteUrl = "https://contoso.sharepoint.com/sites/yoursite"
$ownerEmails = @("user1@contoso.com", "user2@contoso.com")
$clientId = "your-app-registration-id"
$tenant = "contoso.onmicrosoft.com"
$certificatePath = "C:\path\to\certificate.pfx"
# Run the function
Add-OwnersToSharePointSite -SiteUrl $siteUrl `
-OwnerEmails $ownerEmails `
-ClientId $clientId `
-Tenant $tenant `
-CertificatePath $certificatePathGenerates reports on Copilot agent usage and activities in SharePoint Online.
$spoAdminUrl="https://<your tenant>-admin.sharepoint.com"
.\SharePoint-Online\Get-CopilotAgentReport.ps1
Retrieves Microsoft Graph delta query results for tracking changes in SharePoint Online.
# Run the script to get delta query results
.\SharePoint-Online\Get-GraphDeltaQueryResults.ps1Retrieves audit log entries for SharePoint agent creation events.
# Set your parameters
$upn = "admin@yourdomain.com"
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\SharePoint-Online\Get-SharePointAgentCreationAuditLogItems.ps1Retrieves audit log entries for SharePoint agent interaction events.
# Set your parameters
$upn = "admin@yourdomain.com"
$startDate = "2025-06-01"
$endDate = "2025-06-24"
# Run the script
.\SharePoint-Online\Get-SharePointAgentInteractionAuditLogItems.ps1Gets metadata properties of a file in a SharePoint document library using PnP PowerShell.
# Get file properties
.\SharePoint-Online\Get-SharePointFileProperties.ps1 -SiteUrl "https://contoso.sharepoint.com/sites/team" `
-LibraryUrl "/sites/team/Shared Documents" `
-FileName "Document.docx"Creates a complete demo environment with hub sites, regional sites, and project sites with proper associations.
# Run the script to create demo project hub structure
.\SharePoint-Online\New-DemoProjectHubSites.ps1Creates demo project plan documents with random team assignments and tasks.
# Requires ImportExcel and PSWriteWord modules
# Run the script to generate project plan documents
.\SharePoint-Online\New-DemoProjectPlanDocs.ps1Creates SharePoint Online Hub Sites using PnP.PowerShell, with optional parent hub site association.
# Create hub sites
$siteUrls = @("https://contoso.sharepoint.com/sites/Hub1", "https://contoso.sharepoint.com/sites/Hub2")
$parentHubSiteId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# Run the script
.\SharePoint-Online\New-HubSites.ps1 -SiteUrls $siteUrls -ParentHubSiteId $parentHubSiteIdCreates new OneDrive sites for users in SharePoint Online.
# Set your parameters
$usernames = @("user1@domain.com", "user2@domain.com", "user3@domain.com")
$batchSize = 200
$tenantName = "yourtenant"
# Run the script function
New-OneDriveSites -usernames $usernames -batchsize $batchSize -tenantname $tenantNameConfigures SharePoint Online organizational asset libraries for Office templates and images.
# Update the tenant variable with your tenant name
$tenant = "contoso"
# Run the script to configure organizational asset libraries
.\SharePoint-Online\Set-SPOOrgAssetLibrary.ps1Uploads documents to specified SharePoint sites and libraries using an input array.
# Define documents to upload
$documents = @(
@{
FilePath = "C:\temp\ProjectA Plan.docx"
SiteUrl = "https://contoso.sharepoint.com/sites/ProjectA"
Library = "Shared Documents"
},
@{
FilePath = "C:\temp\ProjectB Plan.docx"
SiteUrl = "https://contoso.sharepoint.com/sites/ProjectB"
Library = "Shared Documents"
}
)
# Run the script
.\SharePoint-Online\Upload-Documents.ps1Retrieves all Teams meeting policies and their configuration settings.
# Run the script to get all Teams meeting policies
.\Teams\Get-AllTeamsMeetingPolicies.ps1Retrieves all Microsoft Teams using Microsoft Graph API.
# Set your Graph API parameters
$clientId = "your-app-registration-id"
$tenantId = "your-tenant-id"
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object {$_.Subject -like "*YourCertName*"}
# Run the script
.\Teams\Get-AllTeamsViaGraph.ps1Retrieves messages from specified Teams channels.
# Run the script
.\Teams\Get-ChannelMessages.ps1Gets Teams and their membership information.
# Run the script
.\Teams\Get-TeamsAndMembers.ps1Retrieves all Teams that a specific user is a member of.
# Set the user parameters
$userId = "user@yourdomain.com"
$tenantId = "your-tenant-id"
# Run the script
.\Teams\Get-UserTeams.ps1Creates new channels in a specified Microsoft Team.
# Set your parameters
$teamId = "<your team id>"
$channelNames = @("General Discussion", "Project Updates", "Resources")
# Run the script
.\Teams\New-Channels.ps1 -TeamId $teamId -ChannelNames $channelNamesCreates new Microsoft Teams with specified names and optional owners/members.
# Set your parameters
$teamNames = @("Project Alpha", "Project Beta", "Project Gamma")
$owner = "admin@yourdomain.com"
$members = @("user1@yourdomain.com", "user2@yourdomain.com")
# Run the script
.\Teams\New-Teams.ps1 -TeamNames $teamNames -Owner $owner -Members $membersConfigures moderation settings for Teams channels.
# Set your channel parameters
$clientId="<your client id>"
$teamId = "<your team id>"
$channelId = "<your-channel-id>"
$tenantDomain = "yourdomain.onmicrosoft.com"
$moderationSettings = @{
"moderationSettings"= @{
"userNewMessageRestriction"= "moderators"
"replyRestriction" = "authorAndModerators"
"allowNewMessageFromBots" = "false"
"allowNewMessageFromConnectors"= "false"
}
}
# Run the script
.\Teams\Set-ChannelModerationSettings.ps1Blocks a Teams app, making it unavailable to all users by modifying the app permission policy.
# Block a Teams app using its App ID
.\Teams\Set-TeamsAppAvailability.ps1 -AppId "12345678-1234-1234-1234-123456789012"
# Block app with a custom policy name
.\Teams\Set-TeamsAppAvailability.ps1 -AppId "12345678-1234-1234-1234-123456789012" `
-PolicyName "CustomPolicy"