Get-EntraInactiveSignInUser
Retrieve users without an interactive sign-in since a specified number of days ago.
Syntax
Default (Default)
Get-EntraInactiveSignInUser
[-LastSignInBeforeDaysAgo <Int32>]
[-UserType <String>]
[<CommonParameters>]
Description
The Get-EntraInactiveSignInUser cmdlet retrieves users who didn't sign in interactively within a specified number of days. This cmdlet can be useful for identifying inactive accounts in your Microsoft Entra ID environment.
Examples
Example 1: Retrieve users who didn't sign in for 30 days
Connect-Entra -Scopes 'AuditLog.Read.All','User.Read.All'
Get-EntraInactiveSignInUser -LastSignInBeforeDaysAgo 30 -All
UserID : dddddddd-3333-4444-5555-eeeeeeeeeeee
DisplayName : John Doe
UserPrincipalName : johndoe@contoso.onmicrosoft.com
Mail : johndoe@contoso.onmicrosoft.com
UserType : Member
AccountEnabled : True
LastSignInDateTime : 03/02/2025 5:59:28 AM
LastSigninDaysAgo : 30
lastSignInRequestId : cccccccc-2222-3333-4444-dddddddddddd
lastNonInteractiveSignInDateTime : Unknown
LastNonInteractiveSigninDaysAgo : Unknown
CreatedDateTime : 01/04/2025 5:55:34 AM
CreatedDaysAgo : 30
UserID : aaaaaaaaa-3333-4444-5555-eeeeeeeeeeee
DisplayName : Example User
UserPrincipalName : example@contoso.onmicrosoft.com
Mail : example@contoso.onmicrosoft.com
UserType : Guest
AccountEnabled : True
LastSignInDateTime : 03/02/2025 5:59:28 AM
LastSigninDaysAgo : 30
lastSignInRequestId : ddddddddd-2222-3333-4444-dddddddddddd
lastNonInteractiveSignInDateTime : Unknown
LastNonInteractiveSigninDaysAgo : Unknown
CreatedDateTime : 01/04/2025 5:00:34 AM
CreatedDaysAgo : 30
This command retrieves users without an interactive sign-in within the last 30 days.
Example 2: Retrieve inactive guest users
Connect-Entra -Scopes 'AuditLog.Read.All','User.Read.All'
Get-EntraInactiveSignInUser -LastSignInBeforeDaysAgo 90 -UserType "Guest"
UserID : dddddddd-3333-4444-5555-eeeeeeeeeeee
DisplayName : John Doe
UserPrincipalName : example@contoso.onmicrosoft.com
Mail : example@contoso.onmicrosoft.com
UserType : Guest
AccountEnabled : True
LastSignInDateTime : 03/02/2025 5:59:28 AM
LastSigninDaysAgo : 30
lastSignInRequestId : cccccccc-2222-3333-4444-dddddddddddd
lastNonInteractiveSignInDateTime : Unknown
LastNonInteractiveSigninDaysAgo : Unknown
CreatedDateTime : 01/04/2025 5:55:34 AM
CreatedDaysAgo : 30
This command retrieves guest users without an interactive sign-in within the last 90 days.
Parameters
-LastSignInBeforeDaysAgo
Specifies the number of days since the last interactive sign-in. Users who didn't sign in within this period are returned.
Parameter properties
| Type: | System.Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-UserType
Filters users based on their type (for example, "Member" or "Guest").
Parameter properties
| Type: | System.String |
| Default value: | All |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
System.Int32
You can pipe an integer value to the -LastSignInBeforeDaysAgo parameter.
Outputs
System.Object
Returns a list of users who didn't sign in within the specified period.