Cmdlet Syntax
Get-MgGroupPlannerPlan -GroupId <String> [-ExpandProperty <String[]>] [-Property <String[]>]
- GroupId: Specifies the ID of the group whose Planner plans are to be retrieved.
- ExpandProperty: Expands related entities inline.
- Property: Selects specific properties to be returned.
Usage Examples
Retrieve All Planner Plans for a Group
This command retrieves all Planner plans associated with the specified group.
$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
Get-MgGroupPlannerPlan -GroupId $groupId
Retrieve Specific Properties of Planner Plans
This command retrieves the specified properties of all Planner plans associated with the specified group.
$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
Get-MgGroupPlannerPlan -GroupId $groupId -Property "id", "title", "owner"
Filter Plans by Title
This command retrieves all Planner plans for a group and filters them to return only those with titles containing "Project".
$groupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
$plans = Get-MgGroupPlannerPlan -GroupId $groupId
$filteredPlans = $plans | Where-Object { $_.title -like "*Project*" }
$filteredPlans
Export Planner Plans for a Group to CSV
Connect-MgGraph -Scopes "Group.Read.All", "Planner.Read.All"
$GroupId = "d7b14b9a-6d4b-4a1c-bd74-67c6c4aaf2ed"
$ExportPath = "C:\Reports\GroupPlannerPlans.csv"
Get-MgGroupPlannerPlan -GroupId $GroupId -Property "id,title,owner,createdDateTime" |
Select-Object Id, Title, Owner, CreatedDateTime |
Export-Csv -Path $ExportPath -NoTypeInformation
Write-Host "Planner plans exported to $ExportPath"
What this script does
This script retrieves Planner plans associated with a specific Microsoft 365 Group and exports the plan details to a CSV file.
Why this example is useful
This is useful for documenting Planner usage, auditing group-linked plans, and preparing Planner inventory reports before migration, cleanup, or governance reviews.
Cmdlet Tips
- Permissions: Ensure you have the necessary permissions to access Planner plans. Typically, this requires Group.ReadWrite.All permissions.
- Property Selection: Use the -Property parameter to limit the properties returned and improve performance.
- Related Entities: To retrieve related entities such as buckets or tasks, use the appropriate cmdlets (e.g., Get-MgPlannerBucket, Get-MgPlannerTask) with the plan ID.
Use Cases
- Project Management: Retrieve all Planner plans for a team to monitor project progress and ensure tasks are on track.
- Reporting: Automate the generation of reports that include details about Planner plans.
- Integration: Integrate Planner plan retrieval into other automation scripts for a seamless workflow.
Frequently Asked Questions
- Can I retrieve all Planner plans across the organization?
- Why does Get-MgGroupPlannerPlan return an empty result?
- How can I retrieve plan details such as title or owner directly?
- Can I export Planner plan details to a CSV file?
- What permissions are required to use Get-MgGroupPlannerPlan?
Yes, you can loop through all Microsoft 365 Groups using Get-MgGroup and then call Get-MgGroupPlannerPlan for each group. This is useful for generating a tenant-wide Planner inventory report.
This usually occurs if the group doesn’t have any associated Planner plans or if the authenticated account lacks the required Group.Read.All or Group.ReadWrite.All permissions.
Use the -ExpandProperty parameter with Get-MgGroupPlannerPlan to include nested details like the plan title, owner, and creation date in a single command.
Absolutely. You can pipe the results to Select-Object to choose the properties you need, then export them using Export-Csv for easy reporting
You typically need Planner and group read permissions, such as:
Connect-MgGraph -Scopes "Group.Read.All", "Planner.Read.All"
Use write permissions only when your script needs to modify Planner or group data.
No. Get-MgGroupPlannerPlan retrieves the Planner plans connected to a group. To retrieve tasks, first get the plan ID, then use task-related Planner cmdlets such as Get-MgPlannerTask.
Get-MgPlannerTask -Filter "planId eq 'PLAN-ID-HERE'"
Possible Errors & Solutions
| Error | Cause | Solution |
|---|---|---|
| Insufficient Permissions | The account running the cmdlet does not have the required permissions to access Planner plans. | Ensure the account has the Group.ReadWrite.All Graph API permission. Connect-MgGraph -Scopes "Group.ReadWrite.All" |
| Invalid GroupId | The provided GroupId is incorrect or does not exist. | Verify the GroupId and ensure it is correct. |
| API Throttling | Too many requests are being made to the Microsoft Graph API in a short period. | Implement retry logic with exponential backoff to handle throttling. |
If your tenant contains numerous groups, you can narrow results by specifying a group ID when running
Get-MgGroupPlannerPlan.This ensures you retrieve only the plans associated with that particular group, improving script performance and clarity in large environments.
The
-ExpandProperty parameter allows you to access embedded Planner plan details, such as the title, owner, or creation date, without needing multiple queries.This saves time when building dashboards or exporting Planner data across several groups.
Conclusion
The Get-MgGroupPlannerPlan cmdlet is a powerful tool for retrieving Microsoft Planner plans associated with a specific group using the Microsoft Graph PowerShell module. By understanding its syntax, parameters, and usage, you can effectively manage and automate tasks related to Planner plans. Remember to handle possible errors appropriately to ensure smooth execution of your scripts.
Additional Resources
Graph PowerShell Get-MgGroupPlannerPlan Cmdlet DocMicrosoft Graph PowerShell Module Documentation
Microsoft Graph API Documentation
Related Articles:
Using Get-MgDirectoryRole in Graph PowerShellUsing Get-MgUserLicenseDetail in Graph PowerShell
Using Find-GraphMgCommand in Graph PowerShell
Connect to Microsoft 365 Using PowerShell
How to Create Bulk Users in Office 365 Using Graph PowerShell?
Create Microsoft 365 Group Using Microsoft Graph PowerShell
Block Microsoft 365 User Using Microsoft Graph PowerShell
Assign Microsoft 365 License Using Graph PowerShell
Microsoft 365 User Management Using Graph PowerShell
Checking Group Membership in Microsoft 365
Bulk Assign Microsoft 365 License
Find Inactive Users in Microsoft 365
Using Powershell Graph Search Query
Using Powershell Graph Filter Query
Using Where-Object In Graph PowerShell
Using Expand Property In Graph PowerShell
Using Select Object In Graph PowerShell
Using -Contains Operator In Graph PowerShell
Add User to Multiple Microsoft 365 Groups Using Graph PowerShell
Get Microsoft 365 User Location Using Graph PowerShell
Import Microsoft 365 Groups from CSV File Using Graph PowerShell
Microsoft 365 Group User Import Using Graph PowerShell