我正在尝试以编程方式安装IIS7+。如果我在cmd提示符中直接运行它,它就运行得很好。
start /w pkgmgr /l:log.etw /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-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI由于开头的“开始”部分,我对如何运行它的ServiceProcess.Process类感到有点困惑。我可以运行我所需要的任何其他的执行程序,但是pkgmgr.exe看上去不太好。
Using proc As New Process()
proc.StartInfo.FileName = "c:\windows\system32\pkgmgr.exe"
proc.StartInfo.Arguments = "/l:log.etw /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-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI"
proc.Start()
proc.WaitForExit()
End Using发布于 2013-04-19 04:16:15
我找到了一个值得信赖的链接使用无人值守的安装程序安装IIS 7.0
步骤1: PKGMGR.EXE概述
Vista/Windows 2008中的Windows可选特性是使用名为Pkgmgr的新命令工具安装的。使用pkgmgr.exe的命令行语法是:
Start /w pkgmgr.exe /iu:update1;update2… Pkgmgr.exe命令
/iu:{update };这指定要按更新名称安装的更新,并采用分号分隔的更新名称进行安装。
/uu:{update };这指定要卸载的更新,并采用分号分隔的可选更新列表从系统中卸载。必须至少指定一个更新名称。
/n:{unattend }此指定未参加XML文件的文件名。
有关XML文件的详细信息,请参阅MSDN文章。
例:
若要仅安装IIS7.0默认功能,请将以下unattend.xml文本复制到记事本中。
<?xml version="1.0" ?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<servicing>
<!-- Install a selectable update in a package that is in the Windows Foundation namespace -->
<package action="configure">
<ssemblyIdentity
name="Microsoft-Windows-Foundation-Package"
version="6.0.5308.6"
language="neutral"
processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
versionScope="nonSxS"
/>
<selection name="IIS-WebServerRole" state="true"/>
<selection name="WAS-WindowsActivationService" state="true"/>
<selection name="WAS-ProcessModel" state="true"/>
<selection name="WAS-NetFxEnvironment" state="true"/>
<selection name="WAS-ConfigurationAPI" state="true"/>
</package>
</servicing>
</unattend> https://stackoverflow.com/questions/16096585
复制相似问题