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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -