blogging about…… Microsoft, Cloud Computing
I wanted to write a powershell script to retrieve the last logon property of an Active Directory User. Here is how I came to the final script.
First of all: to get the domain users, use the command:
This will return a list of all the domain users. As it will not return the property LastLogon, you have to include it. And for a better performance you can exclude the default properties
You will now have all your domain users and the property Lastlogon. To list them:
Next, to export it to a csv file (use the NoTypeInformation parameter to remove the .NET object header):
BTW: I used PowerGUI Script Editor