Find all the AD groups a particular user belongs to:
dsquery user -samid username | dsget user -memberof
Find all members of an AD group:
dsquery group -samid groupname | dsget group -members
Find all inactive users:
dsquery user -disabled -inactive 12