PowerShell:如何安装 DSC Resource Kit Wave 8 模块? [英] PowerShell: How to install the DSC Resource Kit Wave 8 modules?
问题描述
我正在尝试按照以下技术网文章在 Windows 2012 R2 机器上设置 DSC 拉取服务器:
I am trying to set up a DSC pull server on Windows 2012 R2 machine by following this technet article:
http://technet.microsoft.com/en-us/library/dn249913.aspx
但是我无法让模块工作.安装说明说:
However I just can't get the modules working. The installation instructions says:
要安装所有 DSC 资源工具包模块,请解压缩
To install all DSC Resource Kit Modules, unzip the content under
$env:ProgramFiles\WindowsPowerShell\Modules
要确认安装,请运行 Get-DSCResource
以查看所有此页面上的资源属于列出的 DSC 资源.
To confirm installation run Get-DSCResource
to see that all of the
resources on this page are among the DSC Resources listed.
因此,我将DSC Resource Kit Wave 8 10282014"文件夹的内容复制到了 C:\Program Files\WindowsPowerShell\Modules
,现在看起来如下所示:
So I copied the content of the 'DSC Resource Kit Wave 8 10282014' folder to C:\Program Files\WindowsPowerShell\Modules
which now looks as follows:
c:\Program Files\WindowsPowerShell\Modules>tree
├───cFileShare
│ ├───DSCResources
│ │ ├───VSAR_cCreateFileShare
│ │ └───VSAR_cSetSharePermissions
│ ├───Examples
│ ├───ResourceDesignerScripts
│ └───Unit Tests
├───xActiveDirectory
│ ├───DSCResources
│ │ ├───MSFT_xADDomain
│ │ ├───MSFT_xADDomainController
│ │ ├───MSFT_xADDomainTrust
│ │ ├───MSFT_xADUser
│ │ └───MSFT_xWaitForADDomain
│ └───Misc
├───xAdcsDeployment
│ ├───DSCResources
│ │ ├───MSFT_xAdcsCertificationAuthority
│ │ └───MSFT_xAdcsWebEnrollment
│ └───xCertificateServices
│ ├───DSCResources
│ │ ├───MSFT_xAdcsCertificationAuthority
│ │ └───MSFT_xAdcsWebEnrollment
│ └───Examples
[...]
然后我重新启动了我的 PowerShell 控制台以确保它正在重新加载 $env:PSModulePath
顺便包含它(手动添加换行以提高可读性):
Then I restarted my PowerShell console to ensure it's reloading $env:PSModulePath
which contains this by the way (added linewrap manually for better readability):
PS C:\Users\Administrator> $env:PSModulePath
C:\Users\Administrator\Documents\WindowsPowerShell\Modules;
C:\Program Files\WindowsPowerShell\Modules;
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
所以这里的一切都是默认的.但是 get-module -ListAvailable
只是没有监听上述任何模块,例如xPSDesiredStateConfiguration
.此外,Get-DscResource
cmdlet 没有返回此模块附带的任何资源(尤其是 xDSCWebService
是我正在寻找的用于设置拉取服务器的 DSC 资源).
So everything is pretty much default here. However get-module -ListAvailable
is just not listening any of the above modules e.g. xPSDesiredStateConfiguration
. Also the Get-DscResource
cmdlet is not returning any ressources that come with this module (especially xDSCWebService
is the DSC resource I am looking for to setup the pull server).
如果我手动将 xPSDesiredStateConfiguration\DSCResources\*
的内容复制到模块路径文件夹之一,我 do 会看到 DSC 资源.但是,拉取服务器设置脚本 (Sample_xDscWebService.ps1
) 失败.打开编辑器,它显示我附近的语法错误:
If I manually copy the content of xPSDesiredStateConfiguration\DSCResources\*
to one of the modules path folder's I do see the DSC resources. However the pull-server setup script (Sample_xDscWebService.ps1
) fails. Opening the editor it shows me a syntax error near to:
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
我无法弄清楚我在这里做错了什么.那么,如何安装 DSC 资源工具包?
I just can't figure out what I am doing wrong here. So, how can I install the DSC Resource Kit?
推荐答案
这个问题似乎与一些缺失的补丁有关.不幸的是我不知道是哪一个.下面博客文章的链接提到了 KB2883200.但是在我的系统上安装它并没有改变.
This issue seems to be related to some missing patches. Unfortunately I dont know which one. The link to the blog post below is mentioning KB2883200. But installing it on my system did not make a change.
但是,它适用于另一台完全打补丁的 Windows 2012 R2 服务器.不幸的是,我在工作中无法轻松访问将手动安装的服务器修补到最新可用的.
However it works on another fully patched Windows 2012 R2 server. Unfortunatley I don't have an easy access at work to patch my manually installed server to the latest available.
这篇关于PowerShell:如何安装 DSC Resource Kit Wave 8 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!