Skip to content

Commit

Permalink
Update Revoke-CIPPSessions.ps1
Browse files Browse the repository at this point in the history
fixed error in writing to logbook
  • Loading branch information
BNWEIN committed Jul 27, 2023
1 parent 04f74e9 commit dc4de40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/Revoke-CIPPSessions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ function Revoke-CIPPSessions {

try {
$GraphRequest = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$($userid)/invalidateAllRefreshTokens" -tenantid $TenantFilter -type POST -body '{}' -verbose
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APIName -message "Revoked sessions for $($username)" -Sev "Info" -tenant $TenantFilter
Write-LogMessage -user $ExecutingUser -API $APIName -message "Revoked sessions for $($username)" -Sev "Info" -tenant $TenantFilter
return "Success. All sessions by $username have been revoked"

}
catch {
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APIName -message "Revoked sessions for $($username)" -Sev "Info" -tenant $TenantFilter
Write-LogMessage -user $ExecutingUser -API $APIName -message "Revoked sessions for $($username)" -Sev "Info" -tenant $TenantFilter
return "Revoke Session Failed: $($_.Exception.Message)"
}
}

0 comments on commit dc4de40

Please sign in to comment.