Desired State Configuration (DSC) Resources provide the building blocks for a DSC configuration. A resource exposes properties that can be configured and contains the PowerShell script functions that the Local Configuration Manager (LCM) calls to apply the Configuration.
A resource can create something as generic as a file or as specific as an IIS server setting. Groups of resources are combined into a DSC Module, which organizes all the required files into a structure that is portable and includes metadata to identify how the resources are intended to be used.
DSC is supplied with several resources which are listed with the Get-DSCResource cmdlet:
PS > Get-DscResource | select Name,Module,Properties | Ft -AutoSize
Name Module Properties
---- ------ ----------
File {DestinationPath, Attributes, Checksum, Contents...}
SignatureValidation {SignedItemType, TrustedStorePath}
cChocoFeature cChoco {FeatureName, DependsOn, Ensure, PsDscRunAsCredential}
cChocoInstaller cChoco {InstallDir, ChocoInstallScriptUrl, DependsOn, PsDscRunAsCre...
cChocoPackageInstaller cChoco {Name, AutoUpgrade, chocoParams, DependsOn...}
cChocoPackageInstallerSet cChoco {DependsOn, PsDscRunAsCredential, Name, Ensure...}
cChocoSource cChoco {Name, Credentials, DependsOn, Ensure...}
cNtfsAuditEntry cNtfsAccessControl {Path, Principal, AuditRuleInformation, DependsOn...}
cNtfsAuditInheritance cNtfsAccessControl {Path, DependsOn, Enabled, PreserveInherited...}
cNtfsPermissionEntry cNtfsAccessControl {Path, Principal, AccessControlInformation, DependsOn...}
cNtfsPermissionsInheritance cNtfsAccessControl {Path, DependsOn, Enabled, PreserveInherited...}
Computer ComputerManagementDsc {Name, Credential, DependsOn, Description...}
OfflineDomainJoin ComputerManagementDsc {IsSingleInstance, RequestFile, DependsOn, PsDscRunAsCredent...
PendingReboot ComputerManagementDsc {Name, DependsOn, PsDscRunAsCredential, SkipCcmClientSDK...}
PowerPlan ComputerManagementDsc {IsSingleInstance, Name, DependsOn, PsDscRunAsCredential}
PowerShellExecutionPolicy ComputerManagementDsc {ExecutionPolicy, ExecutionPolicyScope, DependsOn, PsDscRunA...
RemoteDesktopAdmin ComputerManagementDsc {IsSingleInstance, DependsOn, Ensure, PsDscRunAsCredential...}
ScheduledTask ComputerManagementDsc {TaskName, ActionArguments, ActionExecutable, ActionWorkingP...
SmbServerConfiguration ComputerManagementDsc {IsSingleInstance, AnnounceComment, AnnounceServer, Asynchro...
SmbShare ComputerManagementDsc {Name, Path, CachingMode, ChangeAccess...}
TimeZone ComputerManagementDsc {IsSingleInstance, TimeZone, DependsOn, PsDscRunAsCredential}
VirtualMemory ComputerManagementDsc {Drive, Type, DependsOn, InitialSize...}
WindowsCapability ComputerManagementDsc {Name, DependsOn, Ensure, LogLevel...}
WindowsEventLog ComputerManagementDsc {LogName, DependsOn, IsEnabled, LogFilePath...}
PackageManagement PackageManagement {Name, AdditionalParameters, DependsOn, Ensure...}
PackageManagementSource PackageManagement {Name, ProviderName, SourceUri, DependsOn...}
Archive PSDesiredStateConfiguration {Destination, Path, Checksum, Credential...}
Environment PSDesiredStateConfiguration {Name, DependsOn, Ensure, Path...}
Group PSDesiredStateConfiguration {GroupName, Credential, DependsOn, Description...}
GroupSet PSDesiredStateConfiguration {DependsOn, PsDscRunAsCredential, GroupName, Ensure...}
Log PSDesiredStateConfiguration {Message, DependsOn, PsDscRunAsCredential}
Package PSDesiredStateConfiguration {Name, Path, ProductId, Arguments...}
ProcessSet PSDesiredStateConfiguration {DependsOn, PsDscRunAsCredential, Path, Credential...}
Registry PSDesiredStateConfiguration {Key, ValueName, DependsOn, Ensure...}
Script PSDesiredStateConfiguration {GetScript, SetScript, TestScript, Credential...}
Service PSDesiredStateConfiguration {Name, BuiltInAccount, Credential, Dependencies...}
ServiceSet PSDesiredStateConfiguration {DependsOn, PsDscRunAsCredential, Name, StartupType...}
User PSDesiredStateConfiguration {UserName, DependsOn, Description, Disabled...}
WaitForAll PSDesiredStateConfiguration {NodeName, ResourceName, DependsOn, PsDscRunAsCredential...}
WaitForAny PSDesiredStateConfiguration {NodeName, ResourceName, DependsOn, PsDscRunAsCredential...}
WaitForSome PSDesiredStateConfiguration {NodeCount, NodeName, ResourceName, DependsOn...}
WindowsFeature PSDesiredStateConfiguration {Name, Credential, DependsOn, Ensure...}
WindowsFeatureSet PSDesiredStateConfiguration {DependsOn, PsDscRunAsCredential, Name, Ensure...}
WindowsOptionalFeature PSDesiredStateConfiguration {Name, DependsOn, Ensure, LogLevel...}
WindowsOptionalFeatureSet PSDesiredStateConfiguration {DependsOn, PsDscRunAsCredential, Name, Ensure...}
WindowsPackageCab PSDesiredStateConfiguration {Ensure, Name, SourcePath, DependsOn...}
WindowsProcess PSDesiredStateConfiguration {Arguments, Path, Credential, DependsOn...}
AccountPolicy SecurityPolicyDsc {Name, Account_lockout_duration, Account_lockout_threshold, ...
SecurityOption SecurityPolicyDsc {Name, Accounts_Administrator_account_status, Accounts_Block...
SecurityTemplate SecurityPolicyDsc {IsSingleInstance, Path, DependsOn, PsDscRunAsCredential}
UserRightsAssignment SecurityPolicyDsc {Identity, Policy, DependsOn, Ensure...}
xPrinter xPrinterManagement {DriverName, Name, PortName, Comment...}
xPrinterDriver xPrinterManagement {DriverName, DependsOn, Ensure, Environment...}
xPrinterPort xPrinterManagement {Name, DependsOn, Ensure, PrinterHostAddress...}
HttpDownload xRemoteDownload {File, DependsOn, PsDscRunAsCredential}
S3Download xRemoteDownload {AccessKey, Bucket, Destination, Force...}
Monitor xRemoteMonitor {Url, DependsOn, PsDscRunAsCredential}
Types of resources
Windows comes with built in resources and Linux has OS specific resources. There are resources for cross-node dependencies, package management resources, as well as community owned and maintained resources.
These are the builtin resources:
Windows built-in resources
- Archive Resource
- Environment Resource
- File Resource
- Group Resource
- GroupSet Resource
- Log Resource
- Package Resource
- ProcessSet Resource
- Registry Resource
- Script Resource
- Service Resource
- ServiceSet Resource
- User Resource
- WindowsFeature Resource
- WindowsFeatureSet Resource
- WindowsOptionalFeature Resource
- WindowsOptionalFeatureSet Resource
- WindowsPackageCabResource Resource
- WindowsProcess Resource
Cross-Node dependency resources
Package Management resources
Linux resources
- Linux Archive Resource
- Linux Environment Resource
- Linux FileLine Resource
- Linux File Resource
- Linux Group Resource
- Linux Package Resource
- Linux Script Resource
- Linux Service Resource
- Linux SshAuthorizedKeys Resource
- Linux User Resource
With these resources you have the tools to configure for example Windows services, registry keys or to create local users.
Extend with further Modules
These few resources allow you to begin using DSC, but you are likely to need more functionality as your use of DSC increases. At that point, it is possible to add extra resources from the PowerShell Gallery
To use them locally, all you need to do is to copy and paste them into your PowerShell modules folder:
PS > Get-ChildItem -Path Env:\PSModulePath | select value | fl *
Value : C:\Users\USERNAME\Documents\WindowsPowerShell\Modules;C:\Program
Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\AWS
Tools\PowerShell\
Extend with your own Modules
It is possible to create your own DSC resources by defining what you want to configure on the nodes.