Sample Scripts¶
This section contains a collection of sample scripts that automate managing the different services in Microsoft 365.
If you'd like to add your script to the collection, let us know by submitting an issue on GitHub.
You can browse the scripts by workload, using the navigation, or by topics, using the list below.
adaptivecards¶
adoption¶
ai¶
apps¶
- List all Power Platform Environments and their Flows and Apps
- Deploy Microsoft Teams app from Azure DevOps
- Deploy Microsoft Teams personal app and add it to users
- List app usage in Microsoft Teams
- Removes Microsoft Teams personal app from users and Microsoft Teams app catalog
attachments¶
azure¶
- Analyze User Profile Photos using Azure Computer Vision API
- Export a single flow to a Logic App
- Sync SharePoint Document Library Documents with Azure Storage Container
cleanup¶
- Delete all Microsoft 365 groups
- Delete all Microsoft 365 groups and SharePoint sites
- Replace a user's membership in selected Microsoft 365 Groups or Teams
- Cancel all running flow runs for a flow in an environment
- Delete all (non-group connected) modern SharePoint sites
- Empty the tenant recycle bin
- Delete custom color themes from SharePoint
- Remove orphaned redirect sites
- Remove pending SharePoint API permission requests
- Delete custom SharePoint site designs
- Delete custom SharePoint site scripts
- Remove a Site Collection Admin User from all Site Collections
- Removes Microsoft Teams personal app from users and Microsoft Teams app catalog
- Remove Wiki tab in a Microsoft Teams channel
- Cleanup completed Microsoft To Do tasks
compliance¶
customizations¶
- Disable specified Tenant-wide Extension
- Export Configurations of Tenant Wide Extensions
- List all application customizers in a tenant
- List all tenant-wide extensions
download file¶
files¶
- Add multiple folders in libraries using a csv file
- Copy files to another SharePoint Library in another site
- Insert pictures in a SharePoint Document Library into a Word document
- List all checked out files in SharePoint
- List all documents with a specific name within a SharePoint site
- List all files with missing required metadata
- Lists number of files in all lists and folders for the given site
- List Attachment Names From SharePoint Lists For A Site
- List all large files within a SharePoint Site
- How to perform operations if a command is not covered by the CLI for Microsoft 365
- Sync SharePoint Document Library Documents with Azure Storage Container
- Upload local files and folders to SharePoint Online
flows¶
- Cancel all running flow runs for a flow in an environment
- Export all flows in environment
- Export a single flow to a Logic App
- Flow runs day summary report
- Inventory Flows By Creator
- Resubmit all failed flow runs for a flow in an environment
- Search flows for connections
- List all Power Platform Environments and their Flows and Apps
groups¶
- Delete all Microsoft 365 groups
- Delete all Microsoft 365 groups and SharePoint sites
- Scan for Microsoft 365 Groups created with user's first or last name
- Bulk add/remove users to Microsoft Teams and Microsoft 365 Groups
- Replace a user's membership in selected Microsoft 365 Groups or Teams
- Replace an owner in a Microsoft 365 Group or Microsoft Team
- Add users to the Associated SharePoint Groups of a site from a CSV File
- Change group membership of all SharePoint Online sites
- List all external users in site groups across all site collections
- Create a Microsoft Team with channels from a Microsoft 365 Group
guests¶
- List all external users in site groups across all site collections
- List all external users in all site collections
libraries¶
- Add multiple folders in libraries using a csv file
- Add multiple lists in multiple sites
- Copy files to another SharePoint Library in another site
- Insert pictures in a SharePoint Document Library into a Word document
- Lists number of files in all lists and folders for the given site
- Setup example site
listitems¶
- Copy list items between SharePoint lists
- List all items with unique permissions
- How to perform operations if a command is not covered by the CLI for Microsoft 365
lists¶
- Copy list items between SharePoint lists
- Ensure the Site Assets Library is created
- Hide SharePoint list from Site Contents
- List Attachment Names From SharePoint Lists For A Site
- List site collections and their lists
- Planner migration to SharePoint list
- Setup example site
migration¶
- Export all flows in environment
- Export a single flow to a Logic App
- Add multiple tasks in Planner
- Add custom client-side web part to modern page
- Copy files to another SharePoint Library in another site
- Copy list items between SharePoint lists
- Download attachments from a SharePoint Online list
- Planner migration to SharePoint list
- Sync SharePoint Document Library Documents with Azure Storage Container
- Upload local files and folders to SharePoint Online
- Export all channels in Microsoft Teams teams in the tenant
- Export conversations from Microsoft Teams Channels
pages¶
pipelines¶
provisioning¶
- Add App Catalog to SharePoint site
- Add custom client-side web part to modern page
- Add multiple folders in libraries using a csv file
- Add multiple lists in multiple sites
- Disable specified Tenant-wide Extension
- Ensure the Site Assets Library is created
- Delete custom color themes from SharePoint
- Setup example site
- Bulk add members to Microsoft Teams team from CSV file
- Create a Microsoft Teams team and bulk add members from CSV file
- Create a Microsoft Team with channels from a Microsoft 365 Group
- Deploy Microsoft Teams app from Azure DevOps
- Deploy Microsoft Teams personal app and add it to users
reports¶
- Scan for Microsoft 365 Groups created with user's first or last name
- Flow runs day summary report
- Inventory Flows By Creator
- Search flows for connections
- List all Power Platform Environments and their Flows and Apps
- Export Configurations of Tenant Wide Extensions
- List all application customizers in a tenant
- List all checked out files in SharePoint
- List all documents with a specific name within a SharePoint site
- List all files with missing required metadata
- Lists number of files in all lists and folders for the given site
- List Attachment Names From SharePoint Lists For A Site
- List all external users in site groups across all site collections
- List all failed site design for all sites
- List all large files within a SharePoint Site
- Lists active SharePoint site collection application catalogs
- List site collections and their lists
- List site collection owners
- List all tenant-wide extensions
- Monitor Site Collections Storage Usage
- Get all the Teams a specific user is part of
- Govern orphaned Microsoft Teams
- List all tabs in Microsoft Teams teams in the tenant
- List all team members in Microsoft Teams teams in the tenant
- List app usage in Microsoft Teams
- List Microsoft Teams teams, channels, and tabs in the tenant
- Monitor and notify Microsoft 365 health status
security¶
- Analyze users for known data breaches with have i been pwned
- Bulk add/remove users to Microsoft Teams and Microsoft 365 Groups
- Replace a user's membership in selected Microsoft 365 Groups or Teams
- Replace an owner in a Microsoft 365 Group or Microsoft Team
- Add a Site Collection Admin using a csv file
- Add users to the Associated SharePoint Groups of a site from a CSV File
- Change group membership of all SharePoint Online sites
- Grant API permissions to SharePoint Azure AD Application
- List all items with unique permissions
- List site collection owners
- List all external users in all site collections
- Remove SharePoint API permissions
- Remove pending SharePoint API permission requests
- Remove a Site Collection Admin User from all Site Collections
- Replace site collection admin with another user
- Govern orphaned Microsoft Teams
sites¶
- Delete all Microsoft 365 groups and SharePoint sites
- Add App Catalog to SharePoint site
- Delete all (non-group connected) modern SharePoint sites
- List all external users in site groups across all site collections
- List site collections and their lists
- Monitor Site Collections Storage Usage
- Remove orphaned redirect sites
- Remove a Site Collection Admin User from all Site Collections
- Setup example site
tasks¶
- Add multiple tasks in Planner
- Planner migration to SharePoint list
- Cleanup completed Microsoft To Do tasks
teams¶
- Bulk add/remove users to Microsoft Teams and Microsoft 365 Groups
- Replace a user's membership in selected Microsoft 365 Groups or Teams
- Replace an owner in a Microsoft 365 Group or Microsoft Team
- Create a Microsoft Teams team and bulk add members from CSV file
- Create a Microsoft Team with channels from a Microsoft 365 Group
- Export all channels in Microsoft Teams teams in the tenant
- Export conversations from Microsoft Teams Channels
- Get all the Teams a specific user is part of
- Govern orphaned Microsoft Teams
- List all tabs in Microsoft Teams teams in the tenant
- List all team members in Microsoft Teams teams in the tenant
- List app usage in Microsoft Teams
- List Microsoft Teams teams, channels, and tabs in the tenant
- List all Microsoft Teams team's Owners and Members
- Remove Wiki tab in a Microsoft Teams channel
users¶
- Analyze User Profile Photos using Azure Computer Vision API
- Analyze users for known data breaches with have i been pwned
- Scan for Microsoft 365 Groups created with user's first or last name
- Bulk add/remove users to Microsoft Teams and Microsoft 365 Groups
- Replace a user's membership in selected Microsoft 365 Groups or Teams
- Replace an owner in a Microsoft 365 Group or Microsoft Team
- Inventory Flows By Creator
- Add a Site Collection Admin using a csv file
- Add users to the Associated SharePoint Groups of a site from a CSV File
- Change group membership of all SharePoint Online sites
- List all external users in site groups across all site collections
- List site collection owners
- List all external users in all site collections
- Remove a Site Collection Admin User from all Site Collections
- Replace site collection admin with another user
- Bulk add members to Microsoft Teams team from CSV file
- Create a Microsoft Teams team and bulk add members from CSV file
- Get all the Teams a specific user is part of
- Govern orphaned Microsoft Teams
- Deploy Microsoft Teams personal app and add it to users
- List all team members in Microsoft Teams teams in the tenant
- Recognize most active users for a specific Team
- Share social champions to Teams