Set-CMStatusMessageQuery

Changes settings or security scope or deletes messages for a Configuration Manager status message query.

Syntax

Set-CMStatusMessageQuery
   [-Comment <String>]
   [-Expression <String>]
   -InputObject <IResultObject>
   [-NewName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMStatusMessageQuery
   [-Comment <String>]
   [-Expression <String>]
   -Id <String>
   [-NewName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMStatusMessageQuery
   [-Comment <String>]
   [-Expression <String>]
   -Name <String>
   [-NewName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMStatusMessageQuery
   [-DeleteMessage]
   -InputObject <IResultObject>
   [-PassThru]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMStatusMessageQuery
   [-DeleteMessage]
   -Name <String>
   [-PassThru]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMStatusMessageQuery
   [-DeleteMessage]
   -Id <String>
   [-PassThru]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-CMStatusMessageQuery cmdlet changes settings for a Configuration Manager status message query. Status message queries return status messages from a Configuration Manager site database. You can modify a comment, a Windows Management Infrastructure (WMI) expression, or the name of a query.

You can use this cmdlet with the DeleteMessage parameter to delete messages that this query finds.

This cmdlet can also add or remove a security scope for a message query. Every status message query must belong to at least one security scope.

You can specify a name or ID for a query or use the Get-CMStatusMessageQuery cmdlet to obtain a query.

Note

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

Examples

Example 1: Add a security scope

PS XYZ:\> Set-CMStatusMessageQuery -Name "All Status Messages" -SecurityScopeAction AddMembership -SecurityScopeName "Scope22"

This command adds the security scope named Scope22 to the query named All Status Messages.

Example 2: Delete messages

PS XYZ:\> Set-CMStatusMessageQuery -DeleteMessage -Name "All Active Directory Security Groups"

This command removes messages found by the query named All Active Directory Security Groups from the Configuration Manager database.

Example 3: Rename a query

PS XYZ:\> Set-CMStatusMessageQuery -Name "All Active Directory Security Groups" -NewName "Western Security Groups"

This command renames the query All Active Directory Security Groups. The new name of the query is Western Security Groups.

Parameters

-Comment

Type:String
Aliases:Comments
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

-DeleteMessage

Indicates that messages found by this query are deleted from the Configuration Manager database.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
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

-Expression

Specifies an expression in WMI Query Language (WQL).

Type:String
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

Specifies an ID for a status message query.

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

-InputObject

Specifies a status message query object. To obtain a status message query object, use the Get-CMStatusMessageQuery cmdlet.

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

-Name

Specifies a name for a status message query.

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

-NewName

Specifies a new name for a query.

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

-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