2007/06/28

How to process command-line args in bash scripts

while [ $# -gt 0 ]; do
case $1 in
--somevar)
SOMEVAR=$2
SOMEVARSTR="--somevar $2"
shift; shift
;;
--othervar)
OTHERVAR=$2
shift; shift
;;
--version)
VERSION=$2
shift; shift
;;
--debug)
DEBUGSTR="--debug"
shift
;;
*)
if [ -n "$TARGET" -o ! -d $1 ]; then
usage
fi
TARGET=$1
shift
;;
esac
done

2007/06/05

Gathering information on Windows Servers

Some of these tools require you to download the Windows (2003) support tools and install them on a Windows XP or 2003 computer that is a member of the domain; download the tools from http://support.microsoft.com/kb/892777 .

  • Remotely get replication info on a Windows server
    • repadmin /showattr ncobj:domain:
  • Remotely get the OS version and SP level of a Windows server (enter on one line)
    • repadmin /showattr ncobj:domain: /filter:"(&(objectCategory=computer)(primaryGroupID=516))" /subtree /atts:operatingSystem,operatingSystemVersion,operatingSystemServicePack
  • Verify DC replication
    • REPADMIN /REPLSUM /BYSRC /BYDEST /SORT:DELTAdcdiag
  • Verify DC configuration of all DCs in a forest:
    • dcdiag /v /e /n:domain_name
  • more to come