CMD commands for Active Directory administration

Examples of frequently used server administration command-line commands.

Adprep

  • adprep /forestprep – (prepares the schema on Windows 2000/2003 before installing the first Windows Server 2008; run this command first)
  • adprep /domainprep – (prepares a Windows 2003 domain before installing the first Windows Server 2008)
  • adprep /domainprep /gpprep – (prepares a Windows 2000 domain before installing the first Windows Server 2008)
  • adprep /rodcprep – (prepares Windows Server 2003 before installing the first Windows Server 2008 RODC)

DCDiag

  • DCDiag /test:replications – (runs a replication test)

dcgpofix

  • dcgpofix /target:Domain – (resets Default Domain Policy)

DCpromo

  • dcpromo.exe /adv – (installs the DC role in advanced mode, equivalent to selecting Advanced mode in the graphical console)
  • dcpromo.exe /UseExistingAccount:Attach – (installs the DC role with a choice of installation user account)
  • dcpromo.exe /UseExistingAccount:Attach /unattend:c:\server.txt – (installs the DC role using parameters predefined in server.txt)

Dnscmd

  • Dnscmd /enlistdirectorypartition DomainDnsZones.contonso.com – (adds the domain-wide zone contonso.com)
  • Dnscmd /enlistdirectorypartition ForestDnsZones.contonso.com – (adds the forest-wide zone contonso.com)

GPResult

  • GPResult /r – (lists applied GPOs and group membership. On XP, omit /r)

GPUpdate

  • GPUpdate /force – (forces all GPOs to reload/overwrite)

ipconfig

  • ipconfig /all – (displays detailed network connection parameters)
  • ipconfig /flushdns – (clears the DNS cache)
  • ipconfig /release – (releases TCP/IP settings)
  • ipconfig /renew – (renews/requests TCP/IP settings)

Netdom

  • Netdom renamecomputer %computername% /newname: SERVER-DC1 /force /reboot:5 – (renames the computer SERVER-DC1 and restarts it automatically)

Netsh

  • netsh interface ipv4 show interfaces – (lists IPv4 network connection names and Idx numbers)
  • netsh interface ipv4 set address name=<Idx číslo sítě> source=static address=10.50.0.10 mask=255.255.255.0 gateway=10.50.0.1 – (changes TCP/IP parameters)

Ntdsutil

  • ntdsutil – activate instance ntds – ifm – Create Full C:\InstallationMedia – (creates installation media for a writable DC with prepared SYSVOL)
  • ntdsutil – activate instance ntds – ifm – Create rodc C:\InstallationMedia – (creates installation media for an RODC)
  • ntdsutilsnapshot – activate instance ntds – create – list all – mount number – (obtain number from the preceding list all command)
  • ntdsutil – activate Instance ntds – files – compact to C:\temp – integrity – (offline defragmentation creates the AD database in c:\temp. Afterwards run copy “c:\>temp\ntds.dit” “c:\Windows\NTDS\ntds.dit” and delete all C:\Windows\NTDS\*.log

repadmin

  • repadmin /showrepl – (shows replication status)
  • repadmin /showrepl server1.contonso.com – (shows replication status for server1)
  • repadmin bridgeheads – (lists all bridgehead servers)

Start

  • start /w ocsetup DNS-Server-Core-Role – (installs the DNS role on Server Core)

Komentáře