How can you programmatically turn off or on 'Windows Features'

后端 未结 2 593
执念已碎
执念已碎 2021-01-12 08:59

Currently, users must go into Control Panel > Programs > Turn Windows features on or off, then click on the check the box of the feature that they want to activate. I\'d lik

2条回答
  •  失恋的感觉
    2021-01-12 09:02

    I do this using NSIS for IIS using :

    $Sysdir\pkgmgr.exe /n:$Temp\iis7Unattend.xml
    

    You can call the pkgmgr program from your c# program and usually you would create an unattend file with the instructions for the pkgmgr to use for the feature.

    You need to use

     System.Diagnostics.Process.Start().
    

提交回复
热议问题