Meilleur auteur de réponses
Installation de IIS

Question
-
Bonjour,
je rencontre un problème pour installer IIS à partir d'une commande c#.
ma commande d'installation est la suivante :
Process proc = new Process(); string cmd = @"C:\Windows\System32\pkgmgr.exe"; string cmdargument = @" start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures; IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment; IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging; IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-WindowsAuthentication; IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-WebServerManagementTools; IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;WAS-WindowsActivationService; WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;NetFx3"; proc = Process.Start(cmd, cmdargument); proc.WaitForExit(); proc.Close();
mon soucis est le suivant :
ce code fonctionne très bien sur les serveurs jusqu'à 2008 R2 mais sous 2012 (et ça se vérifie avec Win 8), j'ai un message d'erreur :
0x80070057 Parametre incorrect.
de ce que j'en lis dans le livre ENI sur IIS, ils disent que la commande "Pkgmgr" n'est plus supportée après Windows 2008 R2.
Avez-vous une autre solution pour installer IIS à partir d'une commande C# ? Script dans un autre langage ? une commande C# pour faire l'installation ?
par avance merci.
Lallemand Sébastien
- Déplacé Gilles TOURREAU dimanche 24 mars 2013 15:56
Réponses
-
Vous avez DISM pour installer en cmdline, attention cela doit être fait depuis une session élévée.
dism /online /Enable-Feature /FeatureName:blablabla /FeatureName:blobloblo
Source : http://technet.microsoft.com/fr-fr/library/dd744311(v=ws.10).aspx
Bruce Jourdain de Coutance - Consultant Exchange http://brucejdc.blog.free.fr - Un script pour facilement monter son lab chez soi : http://social.technet.microsoft.com/Forums/fr-FR/windows8fr/thread/f26dd7dd-96b2-4b6a-a085-bc83d3d64599 Votez pour si ce script va vous servir!
- Marqué comme réponse Sébastien Lallemand mardi 26 mars 2013 16:15
-
bonjour,
la solution fonctionne bien dans un script en C#.
merci beaucoup !
Lallemand Sébastien
- Marqué comme réponse Florin Ciuca mercredi 27 mars 2013 09:48
Toutes les réponses
-
Bonjour,
Vérifier d'abord si vous avez le fichier sysocmgr.exe dans le répertoire C:\Windows\System32 et après essayer avec ce code:
System.Diagnostics.Process Proc = new System.Diagnostics.Process(); Proc.StartInfo.FileName = "sysocmgr.exe"; Proc.Start();
Cordialement.Sami CHNITER Software Engineer
-
Bonjour,
sysocmgr.exe n'est pas présent sur la machine. je pourrai l'installer mais l'idée est de pouvoir lancer l'installation de IIS, même si sysocmgr.exe n'est pas disponible. il y a bien la solution du commande powershell mais je ne maitrise pas cette partie...
Lallemand Sébastien
-
Bonjour,
Essayer de supprimer "start /w pkgmgr" au debut de variable cmdargument , votre cmdargument sera comme suit:
string cmdargument = @" /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;
IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;
IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-WindowsAuthentication;
IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;
IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;WAS-WindowsActivationService;
WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;NetFx3";
Cordialement.
Sami CHNITER Software Engineer
-
-
Bonjour,
Je déplace votre question sur les forums TechNet qui seront mieux vous répondre en ce qui concerne l'installation d'un composant Windows en ligne de commande.
Cordialement
Gilles TOURREAU - MVP C#
Architecte logiciel/Consultant/Formateur Freelance
Blog : http://gilles.tourreau.fr
- MCPD : Enterprise Developper / Windows Developper 3.5 / ASP .NET 3.5/4.0
- MCITP : SQL Server 2008 Developper
- MCTS : ADO .NET 3.5 / SQL Server 2008 Developper / Windows Forms 3.5 / ASP .NET 3.5/4.0 -
Vous avez DISM pour installer en cmdline, attention cela doit être fait depuis une session élévée.
dism /online /Enable-Feature /FeatureName:blablabla /FeatureName:blobloblo
Source : http://technet.microsoft.com/fr-fr/library/dd744311(v=ws.10).aspx
Bruce Jourdain de Coutance - Consultant Exchange http://brucejdc.blog.free.fr - Un script pour facilement monter son lab chez soi : http://social.technet.microsoft.com/Forums/fr-FR/windows8fr/thread/f26dd7dd-96b2-4b6a-a085-bc83d3d64599 Votez pour si ce script va vous servir!
- Marqué comme réponse Sébastien Lallemand mardi 26 mars 2013 16:15
-
bonjour,
la solution fonctionne bien dans un script en C#.
merci beaucoup !
Lallemand Sébastien
- Marqué comme réponse Florin Ciuca mercredi 27 mars 2013 09:48