Set-CMBaseline

Change the settings of configuration baselines.

Syntax

Set-CMBaseline
   [-AddBaseline <String[]>]
   [-AddCategory <String[]>]
   [-AddOptionalConfigurationItem <String[]>]
   [-AddOSConfigurationItem <String[]>]
   [-AddProhibitedConfigurationItem <String[]>]
   [-AddRequiredConfigurationItem <String[]>]
   [-AddSoftwareUpdate <String[]>]
   [-AllowComanagedClients <Boolean>]
   [-ClearBaseline]
   [-ClearOptionalConfigurationItem]
   [-ClearOSConfigurationItem]
   [-ClearProhibitedConfigurationItem]
   [-ClearRequiredConfigurationItem]
   [-ClearSoftwareUpdate]
   [-Description <String>]
   [-DesiredConfigurationDigestPath <String>]
   -Id <Int32>
   [-NewName <String>]
   [-PassThru]
   [-RemoveBaseline <String[]>]
   [-RemoveCategory <String[]>]
   [-RemoveOptionalConfigurationItem <String[]>]
   [-RemoveOSConfigurationItem <String[]>]
   [-RemoveProhibitedConfigurationItem <String[]>]
   [-RemoveRequiredConfigurationItem <String[]>]
   [-RemoveSoftwareUpdate <String[]>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMBaseline
   [-AddBaseline <String[]>]
   [-AddCategory <String[]>]
   [-AddOptionalConfigurationItem <String[]>]
   [-AddOSConfigurationItem <String[]>]
   [-AddProhibitedConfigurationItem <String[]>]
   [-AddRequiredConfigurationItem <String[]>]
   [-AddSoftwareUpdate <String[]>]
   [-AllowComanagedClients <Boolean>]
   [-ClearBaseline]
   [-ClearOptionalConfigurationItem]
   [-ClearOSConfigurationItem]
   [-ClearProhibitedConfigurationItem]
   [-ClearRequiredConfigurationItem]
   [-ClearSoftwareUpdate]
   [-Description <String>]
   [-DesiredConfigurationDigestPath <String>]
   -Name <String>
   [-NewName <String>]
   [-PassThru]
   [-RemoveBaseline <String[]>]
   [-RemoveCategory <String[]>]
   [-RemoveOptionalConfigurationItem <String[]>]
   [-RemoveOSConfigurationItem <String[]>]
   [-RemoveProhibitedConfigurationItem <String[]>]
   [-RemoveRequiredConfigurationItem <String[]>]
   [-RemoveSoftwareUpdate <String[]>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMBaseline
   [-AddBaseline <String[]>]
   [-AddCategory <String[]>]
   [-AddOptionalConfigurationItem <String[]>]
   [-AddOSConfigurationItem <String[]>]
   [-AddProhibitedConfigurationItem <String[]>]
   [-AddRequiredConfigurationItem <String[]>]
   [-AddSoftwareUpdate <String[]>]
   [-AllowComanagedClients <Boolean>]
   [-ClearBaseline]
   [-ClearOptionalConfigurationItem]
   [-ClearOSConfigurationItem]
   [-ClearProhibitedConfigurationItem]
   [-ClearRequiredConfigurationItem]
   [-ClearSoftwareUpdate]
   [-Description <String>]
   [-DesiredConfigurationDigestPath <String>]
   -InputObject <IResultObject>
   [-NewName <String>]
   [-PassThru]
   [-RemoveBaseline <String[]>]
   [-RemoveCategory <String[]>]
   [-RemoveOptionalConfigurationItem <String[]>]
   [-RemoveOSConfigurationItem <String[]>]
   [-RemoveProhibitedConfigurationItem <String[]>]
   [-RemoveRequiredConfigurationItem <String[]>]
   [-RemoveSoftwareUpdate <String[]>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Use this cmdlet to change the settings of a configuration baseline in Configuration Manager. A configuration baseline can include the following types of configuration data:

  • Configuration items
  • Other configuration baselines
  • Software updates

The Configuration Manager client evaluates its compliance against this baseline. If all of the specified items are compliant, then the baseline itself is assessed as compliant. You can also include optional items, which are only evaluated if the relevant application or setting exists on the device.

For more information, see Create configuration baselines in Configuration Manager.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Configure a configuration baseline

This example first uses the Get-CMConfigurationItem cmdlet to get a series of configuration items (CIs).

It then splats the cmdlet parameters into the parameters variable. It's not required to splat the parameters, it just makes it easier to read the parameters for such a long command line.

The last command configures the PSTestBaseLine baseline with a new name and description, removes a category, and adds the CIs.

$objPSTestWinAppCI = Get-CMConfigurationItem -Name PSTestWinAppCI
$objPSTestWinAppCI2 = Get-CMConfigurationItem -Name PSTestWinAppCI2
$objPSTestWinOSCI = Get-CMConfigurationItem -Name PSTestWinOSCI
$objPSTestWinAppCI3 = Get-CMConfigurationItem -Name PSTestWinAppCI3
$objPSTestWinAppCI4 = Get-CMConfigurationItem -Name PSTestWinAppCI4
$objPSTestMDCI = Get-CMConfigurationItem -Name PSTestMDCI
$objPSTestMacCI = Get-CMConfigurationItem -Name PSTestMacCI

$parameters = @{
  Name = "PSTestBaseLine"
  NewName = "PSTestBaseLineNew"
  Description = "DCM Testing New"
  RemoveCategory = ("IT Infrastructure")
  AddRequiredConfigurationItems = ($objPSTestWinAppCI4.CI_ID,$objPSTestMDCI.CI_ID)
  AddProhibitedConfigurationItems = ($objPSTestWinAppCI.CI_ID)
  AddOSConfigurationItems = ($objPSTestWinOSCI.CI_ID,$objPSTestMacCI.CI_ID)
  AddOptionalConfigurationItems = ($objPSTestWinAppCI2.CI_ID,$objPSTestWinAppCI3.CI_ID)
}

Set-CMBaseline @parameters

Example 2: Add a custom category

This example first uses the New-CMCategory cmdlet to create a custom baseline category Accounting. It then configures the Accounting baseline to add the new category.

$category = New-CMCategory -CategoryType BaselineCategories -Name "Accounting"
Set-CMBaseline -Name "Accounting baseline" -AddCategory $category.LocalizedCategoryInstanceName

Parameters

-AddBaseline

Specify an array of baseline IDs to add as configuration data to the target baseline. This value is the CI_ID property of the baseline, for example, 16777516.

Type:String[]
Aliases:AddBaselines
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AddCategory

Specify an array of configuration category names to add to the configuration baselines. These categories improve searching and filtering. By default, the site includes the following categories for configuration baselines:

  • Client
  • IT Infrastructure
  • Line of Business
  • Server

To use another category, first add it with the New-CMCategory cmdlet and -CategoryType BaselineCategories parameter.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AddOptionalConfigurationItem

Specify an array of configuration item IDs to add with an optional purpose. The Configuration Manager client only evaluates optional items if the relevant application exists on the device.

This value is the CI_ID property of the configuration item, for example, 16777514.

Type:String[]
Aliases:AddOptionalConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AddOSConfigurationItem

Specify an array of configuration item IDs to add of type OS. This value is the CI_ID property of the configuration item, for example, 16777514.

Type:String[]
Aliases:AddOSConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AddProhibitedConfigurationItem

Specify an array of configuration item IDs to add with a prohibited purpose. This value is the CI_ID property of the configuration item, for example, 16777514.

Type:String[]
Aliases:AddProhibitedConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AddRequiredConfigurationItem

Specify an array of configuration item IDs to add with a required purpose. This value is the CI_ID property of the configuration item, for example, 16777514.

Type:String[]
Aliases:AddRequiredConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AddSoftwareUpdate

Specify an array of software update IDs to add.

Type:String[]
Aliases:AddSoftwareUpdates
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AllowComanagedClients

Set this parameter to $true to always apply this baseline even for co-managed clients.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClearBaseline

Add this parameter to remove all baselines as evaluation conditions from the target baseline. To remove individual baselines, use the RemoveBaseline parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClearOptionalConfigurationItem

Add this parameter to remove all optional configuration items as evaluation conditions from the target baseline. To remove individual optional CIs, use the RemoveOptionalConfigurationItem parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClearOSConfigurationItem

Add this parameter to remove all OS configuration items as evaluation conditions from the target baseline. To remove individual OS CIs, use the RemoveOSConfigurationItem parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClearProhibitedConfigurationItem

Add this parameter to remove all prohibited configuration items as evaluation conditions from the target baseline. To remove individual prohibited CIs, use the RemoveProhibitedConfigurationItem parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClearRequiredConfigurationItem

Add this parameter to remove all required configuration items as evaluation conditions from the target baseline. To remove individual required CIs, use the RemoveRequiredConfigurationItem parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClearSoftwareUpdate

Add this parameter to remove all software updates as evaluation conditions from the target baseline. To remove individual software updates, use the RemoveSoftwareUpdate parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

Specify an optional description of the configuration baseline to help identify it.

Type:String
Aliases:LocalizedDescription
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DesiredConfigurationDigestPath

Specify a path to the configuration data stored as an XML digest.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

Specify the CI_ID of the configuration baseline to configure. For example, 16777516.

Type:Int32
Aliases:CIId, CI_ID
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specify a configuration baseline object to configure. To get this object, use the Get-CMBaseline cmdlet.

Type:IResultObject
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specify the name of the configuration baseline to configure.

Type:String
Aliases:LocalizedDisplayName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NewName

Specify a new name for the configuration baseline. Use this parameter to rename the target baseline.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Add this parameter to return an object that represents the item with which you're working. By default, this cmdlet may not generate any output.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveBaseline

Specify an array of baseline IDs to remove as configuration data from the target baseline. This value is the CI_ID property of the baseline, for example, 16777516. To remove all baselines as configuration data from this baseline, use the ClearBaseline parameter.

Type:String[]
Aliases:RemoveBaselines
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveCategory

Specify an array of configuration category names to remove from the configuration baseline.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveOptionalConfigurationItem

Specify an array of optional CI IDs to remove as configuration data from the target baseline. This value is the CI_ID property of the configuration item, for example, 16777514. To remove all optional configuration items from this baseline, use the ClearOptionalConfigurationItem parameter.

Type:String[]
Aliases:RemoveOptionalConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveOSConfigurationItem

Specify an array of OS CI IDs to remove as configuration data from the target baseline. This value is the CI_ID property of the configuration item, for example, 16777514. To remove all OS configuration items from this baseline, use the ClearOSConfigurationItem parameter.

Type:String[]
Aliases:RemoveOSConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveProhibitedConfigurationItem

Specify an array of prohibited CI IDs to remove as configuration data from the target baseline. This value is the CI_ID property of the configuration item, for example, 16777514. To remove all prohibited configuration items from this baseline, use the ClearProhibitedConfigurationItem parameter.

Type:String[]
Aliases:RemoveProhibitedConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveRequiredConfigurationItem

Specify an array of required CI IDs to remove as configuration data from the target baseline. This value is the CI_ID property of the configuration item, for example, 16777514. To remove all required configuration items from this baseline, use the ClearRequiredConfigurationItem parameter.

Type:String[]
Aliases:RemoveRequiredConfigurationItems
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveSoftwareUpdate

Specify an array of software update IDs to remove as configuration data from the target baseline. To remove all software updates from this baseline, use the ClearSoftwareUpdate parameter.

Type:String[]
Aliases:RemoveSoftwareUpdates
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object