How do you automatically distribute Desired State

2020-04-02 09:30发布

I'm working on leveraging Microsoft's DSC Resource Kit (specifically, XWebAdministration, at least for starters). I'm relatively familiar with DSC, so no worries on the script's actual functionality... it does what it's supposed to, or at least I'm pretty sure it does.

The problem is that when I execute the script from my orchestration box, the servers I'm targeting return this error:

The PowerShell provider xWebAdministration does not exist at the PowerShell module 
path nor is it registered as a WMI provider.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager 
   :String) [], CimException
    + FullyQualifiedErrorId : ModuleNameNotFound
    + PSComputerName        : [redacted]

The reason why it's happening is obvious: I didn't install the xWebAdministration module on those machines. The question is: What's the proper method for automatically distributing custom resources as part of a deployment? It's onerous to manually install custom resources on dozens or hundreds of boxes, so there has to be a way, I just don't see any documentation on the subject anywhere.

4条回答
可以哭但决不认输i
3楼-- · 2020-04-02 09:48

Assuming you're using Windows Management Framework / PowerShell 5, you can use Install-Module to install the resource from a NuGet feed.

查看更多
ゆ 、 Hurt°
4楼-- · 2020-04-02 09:52

If you don't want to use a Pull Server, the only other option you have is to manually Push the resources out, either doing it by using the File Resource in your Configuration (and using Depends On) or copying them out manually somewhere else.

I highly recommend the PowerShell.org E-Book on DSC. It walks you through this scenario and many others. https://onedrive.live.com/?cid=7f868aa697b937fe&id=7F868AA697B937FE%21107

查看更多
ゆ 、 Hurt°
5楼-- · 2020-04-02 10:02

You could configure a centralized pull-server for DSC that clients can get configuration and resources from. Check out:

查看更多
登录 后发表回答