如何访问此处描述的内置 DSC 资源:https ://technet.microsoft.com/en-us/library/dn282121.aspx ?它们应该是内置的,但是当我尝试在配置中使用它们时出现错误。
我的配置如下:
configuration Windows8VM
{
param
(
[Parameter(Mandatory = $true)]
[string] $ComputerName
)
Import-DSCResource -Name Package
Node $ComputerName
{
File gitFolder
{
Ensure = "Present"
Type = "Directory"
DestinationPath = "C:\git"
}
Package gitSoftware
{
Ensure = "Present"
Name = "git"
ProductId = ''
Path = https://chocolatey.org/api/v2/
Arguments = '/SILENT /COMPONENTS="icons,ext\reg\shellhere,assoc,assoc_sh"'
}
}
}
我得到的错误是:
At C:\win8vmconfig.ps1:9 char:5
+ Import-DSCResource -Name Package
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to load resource 'Package': Resource not found.
At C:\win8vmconfig.ps1:20 char:9
+ Package gitSoftware
+ ~~~~~~~
Undefined DSC resource 'Package'. Use Import-DSCResource to import the resource.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : DscResourcesNotFoundDuringParsing
因此,它完全无法定位资源。这里发生了什么,我错过了什么步骤来访问 Microsoft 记录的内置 DSC 资源?
我正在使用 WMF/PowerShell 5.0。