我想安装一个Windows功能列表,例如IIS-WebServerRole,使用chocolatey保存在packages.config中。
列出可用的Windows功能为我提供了ID ....
choco list --source windowsFeatures
Chocolatey v0.10.8
Deployment Image Servicing and Management tool
Version: 10.0.14393.0
Image Version: 10.0.14393.0
Features listing for package : Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~10.0.14393.0
----------------------------------------------------- | --------
Feature Name | State
----------------------------------------------------- | --------
IIS-WebServerRole | Enabled
IIS-WebServer | Enabled
...
将这些ID放在packages.config中并设置source属性:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="IIS-WebServerRole" source="windowsfeatures" />
<package id="IIS-Security" source="windowsfeatures" />
</packages>
</xml>
安装via会给出错误消息:
choco install .\packages.config --yes --acceptlicense
Chocolatey v0.10.8
Installing from config file:
.\packages.config
By installing you accept licenses for the packages.
Installing the following packages:
IIS-WebServerRole
IIS-Security
IIS-WebServerRole not installed. The package was not found with the source(s) listed.
If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.
Version: ""
Source(s): "windowsfeatures"
IIS-Security not installed. The package was not found with the source(s) listed.
If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.
Version: ""
Source(s): "windowsfeatures"
Chocolatey installed 0/2 packages. 2 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- IIS-Security - IIS-Security not installed. The package was not found with the source(s) listed.
If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.
Version: ""
Source(s): "windowsfeatures"
- IIS-WebServerRole - IIS-WebServerRole not installed. The package was not found with the source(s) listed.
If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.
Version: ""
Source(s): "windowsfeatures"
是否可以安装package.config中列出的Windows功能?
答案 0 :(得分:3)
答案 1 :(得分:1)
默认情况下,Chocolatey在其数据中心内搜索软件包。您尝试在此处启用Windows功能,而不是软件/应用程序。使用以下命令运行。
choco install .\choco_iis.config --yes --acceptlicense -s windowsfeatures