Dec 19, 2011

Largest Delta? What is it?

[
Short version: typically you don't have to pay attention to this stat. As long as number of "fails" is zero, AD replication is healthy.
Note: When you have replication fails and subsequently remedy the problem, the number of "fails" in "replsummary" report is not going to change to zeros right away. The report of this command is a snapshot of history, so it takes a bit time for all fails to disappear.
]

Repadmin /replsummary result is simple, but yet somewhat confusing. A few notes:
  • If you don't specify /bysrc or /bydest, it will list status for both directions. You want to pay attention to Destination DSA as AD replication is pull-based.
  • Most critical column is "fails". If there is no fails, obviously you don't have much to worry about
  • Most confusing column is "largest delta". It's common misunderstanding (on the Net at least) that value in this column should be less then 1hr. However, depending on how large your AD environment is, and how frequent changes happen in a particular Naming Context, value in this column could be very large (days)
  • Microsoft's official interpretation for "largest delta": longest replication gap amongst all replication links for a particular DC", which is not really helpful. I personally had hard time to understand this interpretation itself.
  • This value is for the particular DC, among all its replication partners, the longest time that it hasn't replicated anything against whatever NC. This value has to be read together with /showrepl command against that DC.
Read on for example:




Nov 1, 2011

How to troubleshoot account lockout issue

[Note] Event ID applicable to Windows 2003 DC only, but it shouldn't be too difficult to find related W2k8 event IDs.
[Edit Feb 14/2012] Full list of audit events in windows 2008 can be downloaded here, also KB947226
Please read the differences between "Account Logon/logoff" event and "Logon/Logoff" event first.

- First, using lockoutstatus to find out initial authenticating DC (more than often PDC is not the initial authenticating DC. It has same event IDs mentioned below merely because other DCs check with PDC for latest password.) and time of logon attempt
- Then go to authenticating DC, check security log. Pin-point the log entry using time identified by lockoutstatus
- We are looking for: event ID 675 (4771 in w2k8?), the client IP is the offending machine that sent bad pwds
- Failure code in event ID 675(This is corresponding kerberos error code, full list here)
  • 0x18: original wrong password
  • 0x12: this will be logged after the fact that account has already been locked
- Logon type in event ID 675 ( full list here)
  • 2 being interactive
  • 3 network
  • 5 service
  • 10 Remote interactive

Oct 26, 2011

Powershell: Predefined Variables

Also called Automatic Variables.

Get-help about_automatic_variable

Oct 18, 2011

Time service commands

Determine current time source


w32tm /query /source
Config a manual time source


w32tm /config /manualpeerlist:peers /syncfromflags:manual /update 
Replace "peers" with a list of time servers, delimited by space, enclosed with double quotes.
Ignore KBs that maually set registry entries
Config a manual time source as the top time source in forest
w32tm /config /manualpeerlist:peers /syncfromflags:manual /reliable:yes /update
What you should specify in [peers] value: worth reading:

Detect time difference
w32tm /stripchart /computer:TimeServerName /samples:n /dataonly
Set server to use domain hierarchy
w32tm /config /syncfromflags:domhier /update


After change time settings, it's normally required to restart time service

Note: If there is time difference, it takes time for the  system to bring the difference down depending on how much correct can be made in one step. The change is gradual.


[Addition, Jun 13, 2012] When workstations and member servers have trouble synchronizing time with domain, you should check the hierarchy all the way up to forest PDC. I was seeing "The computer did not resync because no time data was available." error, plus time source being "Local CMOS" or "free running OS" etc., in child domain, but the root cause turned out to be forest root PDC wasn't working properly.

Oct 5, 2011

Token Size vs. Paged Pool - draft

This is mostly a complete copy from microsoft.com

When users access a resource using Windows authentication and authorization (for example logging on to a workstation or accessing a file share), an “access token” is built to represent that user.
      The number of SIDs (representing group membership, etc) in that token largely determines how much kernel memory space (Paged Pool) is required to store each copy of the token.
      These allocations follow a “stair-step” pattern, as follows:
      At approximately 84 SIDs, allocation jumps from 4KB to 8KB.
      At approximately 177 SIDs, allocation jumps from 8KB to 12KB.
      At approximately 270 SIDs, allocation jumps from 12KB to 16KB.
      At approximately 363 SIDs, allocation jumps from 16KB to 20KB and so on.

Sep 21, 2011

Programer's Font On Windows 7

I've been looking for a font on Windows 7 that's good for scripting. The two main requirements are:
  1. It has to be fixed width (monospace) (of course!);
  2. It can easily let you tell the difference between a 0 (zero) and an O (as in Oops!)
There are a lot nice fonts but filtered by above two criteria and native to Windows 7, it comes down to Consolas.

Jul 18, 2011

2011 Microsoft Scripting Game - Advanced Leader Board

I was recently in the Scripting Guy 2011 game advanced group and placed 32nd overall. Not too bad :-) considering I didn't have enough time to finish all scripts (I've done 8 out of 10), neither did I have time to polish my scripts which costed quite a few points :-(. Nevertheless it's a great experience. I learned a lot new PowerShell techniques along the way!

2011 Advanced Group Final Leader Board

Apr 20, 2011

Using System Namespace In Powershell

There are many cool pre-defined constants, functions, methods, and etc. in System object. One would normally learn individual ones through sample scripts, but really should browse the MSDN page to explore what System namespace has to offer. Go to a class/structure/enumeration that you are interested, then pay special attention to those static members.

A few examples:

[System.DateTime]::Today  versus [System.DateTime]::Now
[System.String]::Empty
[System.Console]:: almost everything are static, not surprisingly
[System.Math]::PI

There are also a bunch of other namespaces, please see .Net Framework Libraries