Retrieve ldap attribute

Retrieve ldap attribute

Retrieve ldap attribute

The lastlogon attribute can help to do some cleanup in its AD database. The recovery of the ldap attribute value can be done in powershell, vbs or dos.

Retrieving attributes from a user account using cmdlet Powershell

Import-Module ActiveDirectory

Get-ADUser -Filter * -Properties * | Select-Object -Property Name,SamAccountName,Description,LastLogonDate,whenCreated,Enabled,Organization | Sort-Object -Property Name | Export-Csv -path C:\Users\nbonnet\Desktop\file1.csv

Retrieving attributes from a computer account using cmdlet Powershell

Import-Module ActiveDirectory

Get-ADComputer -Filter * -Properties * | Select-Object -Property Name,LastLogon,whenCreated,Enabled | Sort-Object -Property Name | Export-Csv -path C:\Users\nbonnet\Desktop\file2.csv

Retrieving attributes from a user account using dos commands

repadmin /showattr srv.domaine.local "dc=domaine,dc=local" /subtree /filter:"(&(objectCategory=Person)(objectClass=User))" /attrs:lastLogontimeStamp >c:\users.csv

Retrieving attributes from a user account using dos commands

repadmin /showattr srv.domaine.local "dc=domaine,dc=local" /subtree /filter:"(&(objectCategory=Computer)(objectClass=Computer))" /attrs:lastLogontimeStamp >c:\Computer.csv

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.