Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

Disable users with lastlogon and O365 lastlon over 30 days with PowerShell

Hi,

How can I code this with PowerShell?

Search all users in AD
If users lastlogon is over 30 days and his O365 lastlogon also over 30 days then
Disable users

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
are your exchange online users also login to onpremise AD workstations or do you use ADFS?

In that case search those users in active directory for inactivity since last 30 days and disable those with onpremise

u can use dsquery or powershell for same
Avatar of SAM2009

ASKER

Many thanks!