Using dsquery to find inactive users in AD
While reading the study guide for 70-290 (Managing a Win2k environment) I was pleased to find you could use dsquery to find users in your AD who had been inactive for a certain amount of time. However, it failed to mention that your AD must be at the Windows Server 2003 functional level for this to work, else it will complain:
C:\>dsquery user -inactive 4 dsquery failed: The parameter is incorrect. Windows could not run this query because you are connected to a domain that does not support this query. type dsquery /? for help.
After raising the functional level from Windows 2000 to Windows Server 2003 it works without complaining, but doesn’t return any data - I guess it’s not even stored until you fix the functional level.
May
2006
02:30
If your like me your domain is mixed, You can retreive the information per each object if you query the LDAP via ASP,VB or some sort of programming level.