* all these commands used to list,install,uninstall roles and features on windows server
* in this post you learn how to use them to do the previosouly listed tasks
ocsetup : is used to start (add or install or enable ) or stop (remove or uninstall or disable) roles and features on server core
DISM :
- is used to list roles and features (installed or not installed ) and start (add or install or enable ) or stop (remove or uninstall or disable) roles and features on server core
- DISM was introduced in windows server 2008 R2
List all Roles and Features
to list roles and features use 1 of the following commands1- oclist (the old command )
oclist
2- dism (the new command)
dism /online /get-features or dism /online /get-features /format:list
dism /online /get-features /format:table
Add or Enable or Start Roles and Features
to enable Roles and Features- ocsetup ( the old command )
- dism ( the new command )
for example :
to enable DHCP on server core
-
3 commands are needed
start /w ocsetup DHCPServerCore
sc config dhcpserver start= auto
net start dhcpserver

Find a role or feature
dism /online /get-features | find "part of the feature or the role name"for example :
dism /online /get-features | find "DNS"
dism /online /get-features | find"DHCP"
Remove or Disable or Stop Roles and Features
to disable roles and features- you need to get the name of role or feature by using the oclist or dism
- use 1 of the next 2 commands
- ocsetup ( the old command )
- dism ( the new command )
for example :
to disble DHCP on server core
- ocsetup command
- dism command