dsccommunity / ConfigMgrCBDsc

This module contains DSC resources for the management and configuration of Microsoft System Center Configuration Manager Current Branch (ConfigMgrCB).
MIT License
27 stars 8 forks source link

ConfigMgrCBDsc

This module contains DSC resources for the management and configuration of Microsoft System Center Configuration Manager Current Branch (ConfigMgrCB).

Current Branch starts after System Center 2012 with version 1511 Configuration Manager CurrentBranch.

Starting with version 1910 Configuration Manager is now part of Microsoft Endpoint Manager.

This module has been tested on the following versions:

Note

ConfigMgrCBDsc module uses the ConfigurationManager module that is installed with Configuration Manager. In order to use this module, the site needs to be registered and the certificate needs to be in the Trusted Publishers store. Import-ConfigMgrPowerShellModule, adds keys to the HKEY_Users hive and imports the signing certificate from the ConfigurationManager.psd1 to allow the module to function, as either LocalSystem, or PSDscRunAsCredential specified.

This occurs in Get, Test, and Set. The function that is called in the resources is Import-ConfigMgrPowerShellModule.

Build Status Azure DevOps coverage (branch) codecov Azure DevOps tests PowerShell Gallery (with prereleases) PowerShell Gallery

Code of Conduct

This project has adopted this Code of Conduct.

Change Log

A full list of changes in each version can be found in the Change Log.

Releases

For each merge to the branch master a preview release will be deployed to PowerShell Gallery. Periodically a release version tag will be pushed which will deploy a full release to PowerShell Gallery.

Contributing

Please check out common DSC Community contributing guidelines.

Resources

xSccmPreReqs

xSccmPreReqs Examples

xSccmInstall

Note

If you installed SCCM on version 1906 or earlier, the registry key on the SCCM server won't change on upgrade and you won't need to change the version here if you are using apply and auto correct.

xSccmInstall Examples

CMAccounts

CMAccounts Examples

CMIniFile

CMIniFile Examples

CMCollections

CMCollections Examples

CMBoundaries

CMBoundaries Examples

CMForestDiscovery

CMForestDiscovery Examples

CMClientStatusSettings

CMClientStatusSettings Examples

CMBoundaryGroups

CMBoundaryGroups Examples

CMManagementPoint

CMManagementPoint Examples

CMAssetIntelligencePoint

CMAssetIntelligencePoint Examples

CMFallbackStatusPoint

CMFallbackStatusPoint Examples

CMSoftwareUpdatePoint

CMSoftwareUpdatePoint Examples

CMDistributionPoint

CMDistributionPoint Examples

CMHeartbeatDiscovery

CMHeartbeatDiscovery Examples

CMNetworkDiscovery

CMNetworkDiscovery Examples

CMSystemDiscovery

CMSystemDiscovery Examples

CMServiceConnectionPoint

CMServiceConnectionPoint Examples

CMReportingServicePoint

CMReportingServicePoint Examples

CMPxeDistributionPoint

CMPxeDistributionPoint Examples

CMPullDistributionPoint

CMPullDistributionPoint Examples

CMSiteMaintenance

CMSiteMaintenance Examples

CMAdministrativeUser

CMAdministrativeUser Examples

CMDistributionGroup

CMDistributionGroup Examples

CMSiteSystemServer

CMSiteSystemServer Examples

CMStatusReportingComponent

CMStatusReportingComponent Examples

CMCollectionMembershipEvaluationComponent

CMCollectionMembershipEvaluationComponent Examples

CMDistributionPointGroupMembers

CMDistributionPointGroupMembers Example

CMSecurityScopes

CMSecurityScopes Examples

CMUserDiscovery

CMUserDiscovery Examples

CMSecurityRoles

CMSecurityRoles Examples

CMClientPushSettings

CMClientPushSettings Examples

CMSoftwareDistributionComponent

CMSoftwareDistributionComponent Examples

CMMaintenanceWindows

CMMaintenanceWindows Examples

CMFileReplication

CMFileReplication Examples

CMEmailNotificationComponent

CMEmailNotificationComponent Examples

CMGroupDiscovery

CMGroupDiscovery Examples

CMSoftwareUpdatePointComponent

CMSoftwareUpdatePointComponent Examples

CMClientSettings

CMClientSettings Examples

CMClientSettingsBits

CMClientSettingsBits Examples

CMClientSettingsClientCache

CMClientSettingsClientCache Examples

CMClientSettingsClientPolicy

CMClientSettingsClientPolicy Examples

CMClientSettingsCloudService

CMClientSettingsCloudService Examples

CMClientSettingsCompliance

CMClientSettingsCompliance Examples

CMClientSettingsComputerAgent

CMClientSettingsComputerAgent Examples

CMClientSettingsComputerRestart

CMClientSettingsComputerRestart Examples

CMClientSettingsDelivery

CMClientSettingsDelivery Examples

CMClientSettingsHardware

CMClientSettingsHardware Examples

CMClientSettingsMetered

CMClientSettingsMetered Examples

CMClientSettingsPower

CMClientSettingsPower Examples

CMClientSettingsRemoteTools

CMClientSettingsRemoteTools Examples

CMClientSettingsSoftwareCenter

CMClientSettingsSoftwareCenter Examples

CMClientSettingsSoftwareDeployment

CMClientSettingsSoftwareDeployment Examples

CMClientSettingsSoftwareInventory

CMClientSettingsSoftwareInventory Examples

CMClientSettingsSoftwareMetering

CMClientSettingsSoftwareMetering Examples

CMClientSettingsSoftwareUpdate

CMClientSettingsSoftwareUpdate Examples

CMClientSettingsStateMessaging

CMClientSettingsStateMessaging Examples

CMClientSettingsUserDeviceAffinity

CMClientSettingsUserDeviceAffinity Examples

CMSiteConfiguration

CMSiteConfiguration Examples

CMHierarchySetting

CMHierarchySetting Examples

ReverseDsc

Most organizations using this module already have an existing Configuration Manager environment. Creating a configuration and a PowerShell data file that contains all of the configurations of an environment, to either stand-up a lab environment or document a production environment, can be a time consuming task to undertake. ReverseDsc with-in the ConfigMgrCBDsc module will assist in documenting the current production or development environment and allow you to take that configuration and allow you to monitor your current settings or rebuild another environment with the core functionality quickly using the same settings that are currently set within the Configuration Manager environment.

Typically, with ReverseDsc you will get a configuration that has all of the data hard coded within the configuration. With this module, it will generate a data file and if desired a Configuration that will reference the data file to generate a mof file. This allows you to only have to modify the data file for each of your environments, production or Lab, and use the same configuration file for each environment.

Note

**No passwords are gathered by ReverseDsc. Items such as CMAccounts will only list the account and when the configuration is ran a prompt will be provided to provide the password for the account.

With the default configuration created, it does NOT use certificates and all passwords specified will be in plain text in the mof file when it is compiled. If desired, once the configuration is created you can add the necessary pieces to encrypt the passwords in the mof file.**

If looking to stand-up a brand new environment, an example of installing pre-reqs, SQL, and installing Configuration Manager can be found in examples: PrimaryInstall.ps1. Using the information in the example can assist with setting up a brand new environment and using the output from ReverseDsc to quickly stand up a new test environment.

Supported DSC Resources

Currently not all modules will gathered by ReverseDSC. Below will list all of the modules and specify if it is currently supported by ReverseDSC.

Importing the ReverseDsc module

The ConfigMgrCBDsc module will have to be installed to run ReverseDSC. ReverseDSC uses the helper function and each module to gather the information about the environment. After installing the module, next the ReverseDsc module will need to be imported, replace <version> with the version number of currently installed module:

Import-Module -Name 'C:\Program Files\WindowsPowerShell\Modules\ConfigMgrCBDsc\<version>\Modules\ConfigMgrCBDsc.ReverseDsc\ConfigMgrCBDsc.ReverseDsc.psd1'

After importing the module, Set-ConfigMgrCBDscReverse will be available.

Set-ConfigMgrCBDscReverse

Set-ConfigMgrCBDscReverse Examples

Running ReverseDsc with all options and creating a configuration file.

$params = @{
    SiteCode         = 'Lab'
    Include          = 'All'
    DataFile         = 'C:\temp\datafile.psd1'
    ConfigOutputPath = 'C:\temp\CMConfig.ps1'
    MofOutputPath    = 'C:\temp\Mof'
}
Set-ConfigMgrCBDscReverse @params

Running ReverseDsc using exclude and not creating a configuration file. This will still create a DataFile containing all of the information retrieved.

$params = @{
    SiteCode = 'Lab'
    Include  = 'All'
    Exclude  = 'SiteSystemServer'
    DataFile = 'C:\temp\datafile.psd1'
}
Set-ConfigMgrCBDscReverse @params

Running ReverseDsc and only creating a configuration file. DataFile and MofOutputPath are still required. The reason is when the configuration is created, it hard codes the path into the configuration file.

$params = @{
    SiteCode         = 'Lab'
    Include          = 'ConfigFileOnly'
    DataFile         = 'C:\temp\DataFile.psd1'
    ConfigOutputPath = 'C:\temp\CMConfig.ps1'
    MofOutputPath    = 'C:\temp\Mof'
}
Set-ConfigMgrCBDscReverse @params

After creating a DataFile and configuration file, to compile the mof one additional command will need to be ran. After running the command below, any item that requires a password, example CMAccounts, will prompt to enter a password for those accounts. If running against and environment already up and running, the passwords are not evaluated and set if the account already exists with a password.

C:\temp\CMConfig.ps1