Cheatsheet: Add roles and features to a Server Core installation #2

This are some commands to add roles and features to a Windows Server 2008 R2 Core installation.

You also can enable Remote MMC and Remote Server Manager to simply connect from a management server to the core server and add roles with GUI. This may only work within a domain environment. You can enable remote management pretty easy with the sconfig.cmd. Find out more about configuring Windows Server 2008 R2 Core installations here.

List available server roles and features:

oclist

Install, uninstall and configure Active Directory Domain Service role:

dcpromo

Help for dcpromo:

PS C:\> dcpromo /?

Command line parameters include:

/unattend[:filename] Used to specify the unattend operation mode or supply an unattended install script file.

/adv
Enables advanced user options.

/uninstallBinaries
Used to uninstall Active Directory Domain Services binaries.

/?[:{Promotion | CreateDcAccount | UseExistingAccount | Demotion}]

/?:Promotion, /?:CreateDCAccount, /?:UseExistingAccount, and /?:Demotion
will display unattend parameters applicable to the specified task. /CreateDCAccount and /UseExistingAccount:Attach are mutually exclusive.

/CreateDCAccount
Creates an RODC account.

/UseExistingAccount:Attach
Attaches the server to an RODC account.

/forceRemoval
Forcefully uninstalls Active Directory Domain Services on this domain controller. The account for the domain controller will not be deleted in the directory, and changes that have occurred on this domain controller since it last replicated with a partner will be lost.

/?
Will display this help.

Unattend parameters can also be specified on the command-line. For example:

dcpromo.exe /ReplicaOrNewDomain:Replica

Press any key to quit ...

Install a role or feature its basically always the same:

start /w ocsetup <roleorfeature>

start /w ocsetup DNS-Server-Core-Role

Uninstall a role or feature:

start /w ocsetup <roleorfeature> /uninstall

start /w ocsetup DNS-Server-Core-Role /uninstall

Install SNMP feature:

start /w ocsetup SNMP-SC

Install Microsoft Hyper-v role:

start /w ocsetup Microsoft-Hyper-V