Monday, 22 March 2010

dsquery

1. How to find all members for a particular group.

>dsget group "" -members

2. How to find memberof , lastlogontimestamp , homemta(Mail server) , Samaccountname & so on(Repadmin /showattr <"DN">)

>dsquery * "" -scope base -attr lastlogontimestamp memberoff
>repadmin /showattr <"DN"> /attrs:lastlogon,homemta,whencreated,lastlogontimestamp,samaccountname

3. How to modify user last name.

>dsmod user -ln ""

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 | dsget subnet
7. How to find all the active users
>dsquery * -filter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))"

8.How to find disabled users
>dsquery user "dc=ssig,dc=com" -disabled


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 | dsget server -site




11. How to get tombstonelifetime

>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 ?

> dsquery server -site Sitename

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

>dsquery computer -inactive 10 -limit 0




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

No comments:

Post a Comment