我需要知道Windows是XP,7,8,2003,2008或2012,因为依赖于版本我将运行特定的命令。
我尝试在Windows 2008中安装IIS,但它无效。我尝试在Windows 2012中运行正常。
Filename: pkgmgr; Parameters: "/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-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication;IIS-ManagementService;IIS-CGI;IIS-RequestFiltering;IIS-Performance;IIS-ManagementConsole;IIS-WindowsAuthentication;IIS-WebServer;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;IIS-ASPNET;NetFx4Extended-ASPNET45;IIS-ASPNET45;IIS-NetFxExtensibility45;NetFx4Extended-ASPNET45"; Flags: 64bit; Check: IsWin64
我必须在Windows 2008中手动运行:
start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ManagementService;IIS-CGI;IIS-RequestFiltering;IIS-ASPNET;IIS-HttpLogging;IIS-NetFxExtensibility;IIS-HttpErrors;IIS-DefaultDocument;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-StaticContent;IIS-ManagementConsole;IIS-DirectoryBrowsing;IIS-WindowsAuthentication;IIS-WebServer;
答案 0 :(得分:2)
使用MinVersion
and OnlyBelowVersion
parameters中的[Run]
section:
[Run]
; for Windows 2012 and newer:
Filename: pkgmgr; Parameters: "/iu:..."; MinVersion: 6.2
; for older versions (Windows 2008)
Filename: pkgmgr; Parameters: "/iu:..."; OnlyBelowVersion: 6.2