Set-CMStatusMessageQuery

Set-CMStatusMessageQuery

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

Syntax

Parameter Set: DeleteMessageByIdMandatory
Set-CMStatusMessageQuery -DeleteMessage -Id <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: DeleteMessageByNameMandatory
Set-CMStatusMessageQuery -DeleteMessage -Name <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: DeleteMessageByObjectMandatory
Set-CMStatusMessageQuery -DeleteMessage -InputObject <IResultObject> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SetSecurityScopeById
Set-CMStatusMessageQuery -Id <String> -SecurityScopeAction <SecurityScopeActionType> {AddMembership | RemoveMembership} -SecurityScopeName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SetSecurityScopeByName
Set-CMStatusMessageQuery -Name <String> -SecurityScopeAction <SecurityScopeActionType> {AddMembership | RemoveMembership} -SecurityScopeName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SetSecurityScopeByValue
Set-CMStatusMessageQuery -InputObject <IResultObject> -SecurityScopeAction <SecurityScopeActionType> {AddMembership | RemoveMembership} -SecurityScopeName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SetStatusMessageQueryByIdMandatory
Set-CMStatusMessageQuery -Id <String> [-Comments <String> ] [-Expression <String> ] [-NewName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SetStatusMessageQueryByNameMondatory
Set-CMStatusMessageQuery -Name <String> [-Comments <String> ] [-Expression <String> ] [-NewName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SetStatusMessageQueryByObjectMondatory
Set-CMStatusMessageQuery -InputObject <IResultObject> [-Comments <String> ] [-Expression <String> ] [-NewName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Set-CMStatusMessageQuery cmdlet changes settings for a Microsoft System Center 2012 SP1 Configuration Manager status message query. Status message queries return status messages from a System Center 2012 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.

Parameters

-Comments<String>

Specifies a comment for a query.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DeleteMessage

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

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Expression<String>

Specifies an expression in WMI Query Language (WQL).

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Id<String>

Specifies an ID for a status message query.

Aliases

QueryId

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-InputObject<IResultObject>

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

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies a name for a status message query.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-NewName<String>

Specifies a new name for a query.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SecurityScopeAction<SecurityScopeActionType>

Specifies an action for a security scope. The acceptable values for this parameter are: AddMembership and RemoveMembership.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SecurityScopeName<String>

Specifies the name of a security scope. A security scope name can be Default or the name of a custom security scope.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Add a security scope

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

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

Example 2: Delete messages

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

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

Example 3: Rename a query

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

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

Get-CMStatusMessageQuery

New-CMStatusMessageQuery

Remove-CMStatusMessageQuery