I needed to enable disable(on/off) windows features from my C# WMI provider Dll.
I tried using the native functions from DismApi.dll. (I use DllImport ).The functions wanted to use are DismInitialize, DismOpenSession, DismEnableFeature, DismDisableFeature and DismCloseSession.
When I call DismInitialize from WMI provider Dll I am getting HR result as 0x800702e4 (The requested operation requires elevation).
I am calling the coupled WMI provider with the help of PowerShell scripts. The PowerShell ISE is running as Administrator.
Also just for tests I tried using Dism APIs from console application instead of WMI provider. If I call same DISM APIs from console application I am not getting 0x800702e4 error.
Any suggestions to get over this issue ?