0

I have a .NET Core application that utilizes the PowerShell libraries (System.Management.Automation) to Get / Install / Uninstall-WindowsFeature on Windows Server machines. The equivalent on non-server machines is to use Get / Add / Remove-Capability.

For a variety of reasons I am investigating alternative methods for replicating the above functionality without using Powershell in our application.

Are there other alternative libraries available (either commercial or OpenSource)? Are there .NET or Win32 Api/libraries that could be leveraged?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
JohnB
  • 3,921
  • 8
  • 49
  • 99
  • 1
    See https://stackoverflow.com/questions/8054282/how-can-you-programmatically-turn-off-or-on-windows-features and links there for more details about dism or alternatives – Dallas May 09 '23 at 17:16
  • @Dallas - Thanks for the reply. Working on a more secure Windows machine, DISM/Powershell might be disabled/removed/restricted in access. Is it possible to manage Windows Features directly through .Net libraries or Win32 API? – JohnB May 09 '23 at 22:02
  • So no CMD or using servermanger either I assume? There is a DISM COM API I think that only needs System.Runtime.InteropServices . Might that be an option if DISM isn't? There must be something in .NET to get/set Win32_OptionalFeature class though I would think. – Dallas May 15 '23 at 17:41

0 Answers0