Monday, 29 March 2010

Pre-Post test for DC patching for n nos. of DC

for /f %%x in (%1) do nltest /server:%%x /dsgetsite

for /f %%x in (%1) do uptime \\%%x

for /f %%x in (%1) do dcdiag /s:%%x

for /f %%x in (%1) do repadmin /replsummary %%x

Thursday, 25 March 2010

For your reading entertainment


How many times the server was rebooted from a specific date

How many times the server was rebooted from a specific date.
Total bluedump error , System Availability & so many more .try it.
Download the exe & put it system32.
C:\Documents and Settings\Administrator>uptime /s /d:12/25/2009
Uptime Report for:
Current OS: Microsoft Windows Server 2003, Service Pack 2, Multiprocessor F
Time Zone: India Standard Time
System Events as of 12/27/2009 8:29:25 PM:
Date: Time: Event: Comment:
---------- ----------- ------------------- ------------------------------
12/28/2009 10:48:07 AM Shutdown Prior uptime:23d 1h:54m:50s
12/28/2009 12:33:53 PM Boot Prior downtime:0d 1h:45m:46s
12/28/2009 1:48:22 PM Shutdown Prior uptime:0d 1h:14m:29s
12/28/2009 1:49:04 PM Boot Prior downtime:0d 0h:0m:42s
12/28/2009 2:52:04 PM Shutdown Prior uptime:0d 1h:3m:0s
12/28/2009 6:12:00 PM Boot Prior downtime:0d 3h:19m:56s
12/28/2009 11:29:47 PM Shutdown Prior uptime:0d 5h:17m:47s
12/25/2009 12:45:54 PM Shutdown Prior uptime:0d 1h:34m:41s
12/25/2009 10:53:15 PM Boot Prior downtime:0d 10h:7m:21s
12/26/2009 12:35:23 AM Shutdown Prior uptime:0d 1h:42m:8s
12/26/2009 10:53:02 AM Boot Prior downtime:0d 10h:17m:39s
12/26/2009 11:12:54 AM Shutdown Prior uptime:0d 0h:19m:52s
12/26/2009 12:05:21 PM Boot Prior downtime:0d 0h:52m:27s
12/26/2009 1:02:14 PM Shutdown Prior uptime:0d 0h:56m:53s
12/26/2009 11:01:24 PM Boot Prior downtime:0d 9h:59m:10s
12/27/2009 1:29:07 AM Shutdown Prior uptime:0d 2h:27m:43s
12/27/2009 10:20:35 AM Boot Prior downtime:0d 8h:51m:28s
12/27/2009 2:06:17 PM Shutdown Prior uptime:0d 3h:45m:42s
12/27/2009 2:33:31 PM Boot Prior downtime:0d 0h:27m:14s
12/27/2009 3:00:11 PM Shutdown Prior uptime:0d 0h:26m:40s
12/27/2009 5:55:18 PM Boot Prior downtime:0d 2h:55m:7s
Current System Uptime: 0 day(s), 2 hour(s), 34 minute(s), 32 second(s)
Since 12/25/2009: (Last 2 Days)
System Availability: -39.6115%
Total Uptime: 4d 14h:44m:57s
Total Downtime: 3d 23h:37m:13s
Total Reboots: 15
Mean Time Between Reboots: 0.19 days
Total Bluescreens: 0


How to check the uptime for "n" number of servers

Create a batch file with below mentioned line & create a txt file with server list.
Put the uptime.exe in system32

for /f %%x in (%1) do uptime \\%%x

Monday, 22 March 2010


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