Community

Since the built-in resources are nowhere near enough to configure modern IT systems, you will often find yourself downloading community resources. Many of those initially came from the DSC Resource Kit, which was, initially, to be released in waves. Nowadays, development on DSC resources takes place on GitHub, with many PowerShell enthusiasts and developers all over the world as contributors:

While new resource kit announcements are still published online, DSC resource modules are simply released to the PowerShell Gallery every now and then. To download these resources, simply use PowerShellGet and the Find-DscResource and Install-Module cmdlets:

# The x denotes experimental, while a c indicates a community resource
Find-DscResource -Name xMaintenanceWindow

# If a fitting module is found, install with Install-Module
Find-DscResource xMaintenanceWindow | Install-Module

# Discover additional resources in a module
Get-DscResource -Module xDscHelper

# There are some HQRM (High-quality resource modules) that are
# really extensive and are held to a higher coding standard
# https://github.com/powershell/dscresources
Find-DscResource -Name SqlSetup,SqlDatabase

Using any resource in a configuration requires you to import the resource module with the Import-DscResource cmdlet. Most likely, you will also want to specify the version of the module being used in case there are multiple versions installed. The added benefit of that is that you can test newer versions while keeping the production configuration intact and using the module version you tested with:

configuration withCustomResources
{
Import-DscResource -ModuleName xDscHelper
Import-DscResource -ModuleName PsDscResources

xMaintenanceWindow mw
{
# Maintenance Window between 23:00 and 06:00
ScheduleStart = [datetime]::Today.AddHours(23)
ScheduleEnd = [datetime]::Today.AddHours(6)
# First tuesday of a month
DayOfWeek = 'Tuesday'
DayOfMonth = 1
ScheduleType = 'Monthly'
}

File f
{
DestinationPath = 'C:somefile'
DependsOn = '[xMaintenanceWindow]mw'
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.84.155