You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/get-disabled-or-inactive-user-accounts/README.md
+148-4Lines changed: 148 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,158 @@
4
4
5
5
## Summary
6
6
7
-
In order to keep your tenant clean (Governance), you might want to ensure that disabled or inactive user accounts will be replaced where oppropriate (Think Owners of sites/groups, assignedto user on tasks/planner and so on). This script will help you find those accounts.
7
+
Maintaining a clean and well-governed Microsoft 365 tenant requires visibility into disabled and inactive user accounts. These accounts can unintentionally retain ownership or assignments across SharePoint sites, Microsoft Teams, Microsoft 365 Groups, and task-based workloads such as Planner.
8
+
9
+
This script helps identify disabled and inactive user accounts from multiple sources, enabling administrators to proactively review and replace users where appropriate. By doing so, organizations can reduce operational risk, improve governance, and ensure continued accountability for owned resources and assigned workloads.
8
10
9
11

10
12
13
+
### Purpose
11
14
12
-
# [PnP PowerShell](#tab/pnpps)
15
+
The purpose of this script is to support Microsoft 365 governance by identifying user accounts that are disabled or inactive but may still hold ownership, permissions, or assignments across the tenant. The output can be used as an input for remediation activities such as ownership reassignment, access review, or account cleanup.
16
+
17
+
### Use Cases
18
+
19
+
- Identifying disabled users who still own SharePoint sites or Microsoft Teams
20
+
- Detecting inactive users assigned to Planner tasks or project deliverables
21
+
- Supporting periodic access reviews and governance audits
22
+
- Preparing for offboarding or tenant cleanup initiatives
23
+
24
+
# [PnP PowerShell V2](#tab/pnppsv2)
13
25
14
26
```powershell
15
27
28
+
# =========================================
29
+
# Script: User Status Discovery (PnP + Graph)
30
+
# Purpose: Identify disabled and inactive users from multiple sources
[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)]
153
+
154
+
# [PnP PowerShell](#tab/pnpps)
155
+
156
+
In order to keep your tenant clean (Governance), you might want to ensure that disabled or inactive user accounts will be replaced where oppropriate (Think Owners of sites/groups, assignedto user on tasks/planner and so on). This script will help you find those accounts.
157
+
158
+
```powershell
16
159
17
160
function Get-UserFromGraph
18
161
{
@@ -82,8 +225,6 @@ function Get-UserFromGraphThatHasntLoggedInResently($duration = 90)
Copy file name to clipboardExpand all lines: scripts/get-disabled-or-inactive-user-accounts/assets/sample.json
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
"In order to keep your tenant clean (Governance), you might want to ensure that disabled or inactive user accounts will be replaced where oppropriate (Think Owners of sites/groups, assignedto user on tasks/planner and so on). This script will help you find those accounts."
0 commit comments