oclist ,ocsetup and DISM 
* 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


oclist :  is used to list roles and features (installed or not installed ) on server core
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 commands
1- 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
1- you need to get the name of role or feature by using the oclist or dism
2- use 1 of the next 2 commands
    •  ocsetup ( the old command )
                   start /w ocsetup feature or role name
    • dism ( the new command ) 
                   dism /online /enable-feature:feature or role name
note : roles and features are case sensitive ( for example : DHCPServerCore ,  DNS-Server-Core-Role )

for example :
            to enable DHCP on server core
1- ocsetup command
              3 commands are needed
                        start /w ocsetup DHCPServerCore
                        sc config dhcpserver start= auto
                        net start dhcpserver
Note : in the 2nd command start= auto (there is a space between the equal sign and auto)
2- dism command 
          dism /online /enable-feature:DHCPServerCore
 

  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
  1. you need to get the name of role or feature by using the oclist or dism 
  2. use 1 of the next 2 commands
    •  ocsetup ( the old command )
                    stop /w ocsetup feature or role name
    •  dism ( the new command ) 
                    dism /online /disable-feature:feature or role name

for example :
            to disble DHCP on server core
  1. ocsetup command
  2. dism command 
          dism /online /disable-feature:DHCPServerCore



oclist = windows optional component list
ocsetup = windows optional component setup
DISM= Deployment Image Servicing and Management tool