Install Windows Server Roles/Features using C# 32bit and Powershell -
i trying install windows server roles using c# executing powershell commands. here code:
initialsessionstate iss = initialsessionstate.createdefault(); iss.importpsmodule(new string[] { "servermanager" }); runspace powershellrunspace = runspacefactory.createrunspace(iss); powershellrunspace.open(); using (powershell powershell = powershell.create()) { powershell.runspace = powershellrunspace; powershell.addcommand("install-windowsfeature"); powershell.addargument("xps-viewer"); powershell.invoke(); } powershellrunspace.close(); but error tearm 'install-windowsfeature' not recognized name of cmdlet, function....
please let me know how install xps-viewer. using .net 2.0 32 bit , executing on windows server 2016 os.
Comments
Post a Comment