I'm exploring DSC and wondering what's the best way to copy DSC resources to target host ?
When I try to push my configuration to the target host, It complain of missing DSC resource.
The PowerShell DSC resource xWebAdministration does not exist at the PowerShell module path nor is it registered as a WMI DSC resource.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : DscResourceNotFound
+ PSComputerName : server1.appman.net
The easiest way to ensure resources are available is to setup a file share based repository for pulling down modules. This blog should help you out http://nanalakshmanan.com/blog/Push-Config-Pull-Module/
I tried to install PS modules using DSC. It requires 3 separate configurations:
Configuration InitialConfiguration
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node MyServer
{
Script InstallModule
{
SetScript = { Install-Module PackageManagement -MinimumVersion 1.1.7 -Force }
TestScript = { $version = (Get-Module PackageManagement -ListAvailable).Version; $version.Major -ge 1 -and $version.Minor -ge 1 }
GetScript = { Get-Module PackageManagement -ListAvailable }
}
}
}
Configuration ModulesConfiguration
{
Import-DscResource -ModuleName 'PackageManagement' -ModuleVersion 1.1.7.0
Node MyServer
{
PackageManagement xWebAdministration
{
Name = 'xWebAdministration'
}
}
}
Configuration WebServerConfiguration
{
Import-DscResource –ModuleName 'xWebAdministration'
Node MyServer
{
xWebAppPool SampleAppPool
{
Name = 'SampleAppPool'
}
}
}
However, Microsoft uses simple script to install modules using WinRM in their example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With