itsmevic
asked on
ADFind Query To Find Last Logon of User
Hi Experts!
I think I'm fairly close to figuring the syntax out here but need a little assistance. Trying to pull active users in AD and their last logon time stamp. Here's what I have so far:
I think I'm fairly close to figuring the syntax out here but need a little assistance. Trying to pull active users in AD and their last logon time stamp. Here's what I have so far:
adfind -default "&(objectcategory=person)(objectclass=user)(!userAccountcontrol:AND:=2)* samaccountname userprincipalname displayname lastlogontimestamp -csv -tdca > C:\xxxx\xxxxx\desktop\LastLogon.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hey xxd, I think the only thing missing from the powershell command is the -enabled switch, then they both work
ASKER
That did it, thank you again Mike. Wonder if there is a good book I can buy or a really good reference site that you know of that I can use? I almost feel like I'm bugging you with this piddly stuff everytime I need to query something.
It's fine, you are not a bother I'm glad to help and you are going to be answering these questions yourself in no time.
As far as books the AD Cookbook by O'Reilly (Larua Huner author, she used to post here a lot too) as a lot of good examples. I'd recommend that one, and just trial and error.
One book that I really hope for is http://blog.joeware.net/2010/02/05/1898/ hope Joe has time for that.
Keep up the good work.
Thanks
Mike
As far as books the AD Cookbook by O'Reilly (Larua Huner author, she used to post here a lot too) as a lot of good examples. I'd recommend that one, and just trial and error.
One book that I really hope for is http://blog.joeware.net/2010/02/05/1898/ hope Joe has time for that.
Keep up the good work.
Thanks
Mike
Didn't see the part about only active users. Trying to put what chris-dent showed me last time to good use
ASKER
Good stuff Mike, thank you. I'm assuming your talking Laura Hunters book here ---> http://www.amazon.com/Active-Directory-Cookbook-Robbie-Allen/dp/059610202X/ref=sr_1_1?ie=UTF8&s=books&qid=1276639731&sr=1-1
Oh and yeah if Joe can get that book published, I'll be first in line to get that for sure! Thank you again ( :
Oh and yeah if Joe can get that book published, I'll be first in line to get that for sure! Thank you again ( :
Yeah that is the book, there is a newer version out (3rd edition)
http://www.amazon.com/Active-Directory-Cookbook-2008-publication/dp/0596521103/ref=sr_1_1?ie=UTF8&s=books&qid=1276645338&sr=1-1
Good deal there used too.
Thanks
Mike
http://www.amazon.com/Active-Directory-Cookbook-2008-publication/dp/0596521103/ref=sr_1_1?ie=UTF8&s=books&qid=1276645338&sr=1-1
Good deal there used too.
Thanks
Mike
The command would be
get-qaduser -includeallproperties | select-object name,lastlogontimestamp >c:\file.txt