Forum Discussion
TomWechsler
Jul 14, 2021MVP
Using PowerShell in Microsoft 365, find all users who have not logged in in the last 180 days!
Hi Azure / Microsoft365 friends,
In a recent project, I was allowed to take on the following task. Search for all users (active users, not deactivated accounts) who had not logged in in the...
UAUWebInfo
Jun 17, 2024Copper Contributor
TomWechsler I am getting the following error code on Powershell 7.0 - any idea how to get around? I am trying to do the same thing you were looking to do:
$allUsers = Get-MsolUser -All -EnabledFilter EnabledOnly | Select UserPrincipalName
Get-MsolUser : The term 'Get-MsolUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-MsolUser -All -EnabledFilter EnabledOnly | Select UserPrincipalNa ...
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MsolUser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
- TomWechslerJun 18, 2024MVPTry it once with the PowerShell ISE (PowerShell 5 version). Maybe it is due to the PowerShell version. Regards, Tom