4

I want to turn on/off windows features programmatically.Manually it can be done via control panel->Programs and features->Turn windows feature on or off.

Is there any windows api to do so? or any com interface to mange this?

Mrunal
  • 139
  • 1
  • 9
  • Unlikely that there is an API for this. Group policy is more likely. This seems like a sysadmin question. Which feature do you want to enable/disable? And why do you want to do it programmatically? – David Heffernan Oct 07 '14 at 09:08
  • I want to enable IIS feature. Requirement is Enable IIS, Check IIS version. I have some applications which require such settings. Hence I want to enable/disable IIS feature programmatically. – Mrunal Oct 07 '14 at 13:00
  • You should ask that specific question then. You don't care about being able to enable/disable a variety of features. All you care about is IIS. Answers will likely be very IIS specific. This might help: http://stackoverflow.com/questions/16079030/better-way-to-install-iis7-programmatically – David Heffernan Oct 07 '14 at 13:03

2 Answers2

3

You should be able to use DismEnableFeature which is part of Deployment Image Servicing and Management (DISM) API.

Regent
  • 5,502
  • 3
  • 33
  • 59
1

you can use a powershell script and intall-windowsfeature cmdlet :

Install-WindowsFeature -Name Web-Server

technet link

Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103