Skip to content

Commit

Permalink
Merge pull request #1119 from Ren-Roros-Digital/TweakDisableGuestUser
Browse files Browse the repository at this point in the history
Disable guest user use lastSuccessfulSignInDateTime
  • Loading branch information
JohnDuprey authored Oct 4, 2024
2 parents bdbd888 + b0887a2 commit 97ef8c3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Invoke-CIPPStandardDisableGuests {
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableGuests'

$Lookup = (Get-Date).AddDays(-90).ToUniversalTime().ToString('o')
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$filter=(signInActivity/lastNonInteractiveSignInDateTime le $Lookup)&`$select=id,UserPrincipalName,signInActivity,mail,userType,accountEnabled" -scope 'https://graph.microsoft.com/.default' -tenantid $Tenant | Where-Object { $_.userType -EQ 'Guest' -and $_.AccountEnabled -EQ $true }
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users?`$filter=(signInActivity/lastSuccessfulSignInDateTime le $Lookup)&`$select=id,UserPrincipalName,signInActivity,mail,userType,accountEnabled" -scope 'https://graph.microsoft.com/.default' -tenantid $Tenant | Where-Object { $_.userType -EQ 'Guest' -and $_.AccountEnabled -EQ $true }

If ($Settings.remediate -eq $true) {

Expand Down

0 comments on commit 97ef8c3

Please sign in to comment.