---Want to gather various dsquery in a single space---
************************************************************************************************************************************
Like:
1. How to find all members for a particular group.
>dsget group "<DN of the group>" -members
2. How to find memberof , lastlogontimestamp , homemta(Mail server) , Samaccountname & so on(Repadmin /showattr <DCname> <"DN">)
>dsquery * "<DN>" -scope base -attr lastlogontimestamp memberoff
>repadmin /showattr <DCNAME> <"DN"> /attrs:lastlogon,homemta,whencreated,lastlogontimestamp,samaccountname
3. How to modify user last name.
>dsmod user <dn> -ln "<last name>"
4.How to find memberof , lastlogontimestamp , homemta(Mail server) , Samaccountname & so on for "n"
number of users
>Create a batch file(for /f "eol= tokens=* delims= usebackq" %%x in (%1) do dsquery * %%x -scope base -attr sAMAccountName objectsid whencreated lastlogontimestamp
mail homeMTA memberof) e.g ds.bat
>Create a text file (All users DN e.g:dn.txt)
>Open cmd & run ds.bat dn.txt >> c:\attr.txt
5. How to find DN for n number of computers
>for /f %%x in (%1) do dsquery computer -name %%x
(Create a batch file with line & create a txt file computer.txt
>open cmd >>>>>>batchfile computer.txt >> c:\dn.txt
6. Find Subnet with associated site.
>>dsquery subnet -name <CIDR> | dsget subnet
8.How
to find disabled users
>dsquery user "dc=ssig,dc=com" -disabled
>dsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2))"
9. How to find OS?
>D:\>dsquery * <"DN"> -scope base -attr operatingSystem
operatingSystem
Windows Server 2003
10. How to find site ?
>dsquery site -name * -limit 0
>dsquery server -s <server> | dsget server -site
11. How to gettombstonelifetime ?
>dsquery * "CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=yourdomain,DC=com" -scope base -attr tombstonelifetime
12.How do find the all servers for a specific site ?
13. How to find mail box?
>dsquery * -filter "samaccountname=biswajit" -attr homemdb
14.Find all computers in AD that have not been logged into during the past 10 weeks?
15. How to find the GCs?
>DsQuery Server -domain contoso.com -isgc
16. How to site?
>dsquery server -siteSitename
http://support.microsoft.com/kb/322684
http://www.robvanderwoude.com/ntadmincommands.php
http://social.technet.microsoft.com/Forums/en-US/winserverDS/thread/327717d6-2e0d-4f37-93bf-490ff7118f98
To be continued........................
Thanks Biswajit
>dsquery computer -inactive 10 -limit 0
How to find all the active users?
>dsquery * -filter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))"