Forum Discussion
Anonymous
Dec 21, 2021Deactivate Inactive Guest Users last 3 months
Hi, I am looking for a quick and easy solution for deactivating all guest users in Azure AD that has not logged in to their account the last 3 months. Appreciate all answers! Br,
Dec 05, 2024
This was all too complex for me, here's a simpler solution...
Get a csv with the UPNs of the accounts you want to disable
$Guests = Import-Csv .\Guests.csv
ForEach ($Guest in $Guests) { $params = @{accountEnabled = $false} ; Update-MgUser -UserId $guest.upn -BodyParameter $params }