PowerShell: How to install the DSC Resource Kit Wa

2019-02-19 02:58发布

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:

To install all DSC Resource Kit Modules, unzip the content under

$env:ProgramFiles\WindowsPowerShell\Modules 

To confirm installation run Get-DSCResource to see that all of the resources on this page are among the DSC Resources listed.

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
[...]

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\

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).

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

I just can't figure out what I am doing wrong here. So, how can I install the DSC Resource Kit?

3条回答
\"骚年 ilove
2楼-- · 2019-02-19 03:09

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.

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.

http://blogs.msdn.com/b/powershell/archive/2013/12/26/holiday-gift-desired-state-configuration-dsc-resource-kit-wave-1.aspx

查看更多
一夜七次
3楼-- · 2019-02-19 03:20

I had the same problem. After installation of 3 updates (KB2894029, KB2894179 and KB2883200) everything works ;)

查看更多
啃猪蹄的小仙女
4楼-- · 2019-02-19 03:24

I had this error and fixed it!
See my blog post at http://tfl09.blogspot.com//2015/04/using-dsc-resource-kit-hot-fixes-may-be.html

That location points to the specific patches you need.

查看更多
登录 后发表回答