New-CMStatusMessageQuery

New-CMStatusMessageQuery

Creates a status message query.

Syntax

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

Detailed Description

The New-CMStatusMessageQuery cmdlet creates a status message query in Microsoft System Center 2012 Configuration Manager. Status message queries in System Center 2012 Configuration Manager return status messages from the site database. All major System Center 2012 Configuration Manager components generate status messages.

Parameters

-Comments<String>

Specifies a description for the status message query.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Expression<String>

Specifies WMI Query Language (WQL) text for the query.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies a name for the status message query.

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: Create a status message query

This command creates a status message query named Client Component Configuration Changes and Fatal Errors. The Expression parameter specifies the WMI Query Language (WQL) text for the query.

PS C:\> New-CMStatusMessageQuery -Name "Client Component Configuration Changes and Fatal Errors" -Expression "select stat.*, ins.*, att1.*, stat.Time from SMS_StatusMessage as stat left join SMS_StatMsgInsStrings as ins on stat.RecordID = ins.RecordID left join SMS_StatMsgAttributes as att1 on stat.RecordID = att1.RecordID where stat.ModuleName = 'SMS Client' and stat.MessageID = 669 and stat.SiteCode = ##PRM:SMS_StatusMessage.SiteCode## and stat.Time >= ##PRM:SMS_StatusMessage.Time## order by stat.Time desc"

Get-CMStatusMessageQuery

Set-CMStatusMessageQuery

Remove-CMStatusMessageQuery