Get-CMComponentStatusMessage
Get component status messages in Configuration Manager.
Syntax
Get-CMComponentStatusMessage
[-ComponentName <String>]
[-ComputerName <String>]
[-Severity <Severity>]
[-SiteCode <String>]
-StartTime <DateTime>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[<CommonParameters>]
Description
The Get-CMComponentStatusMessage cmdlet gets component status messages for a specified period.
Configuration Manager indicates whether operations succeed or fail and include other information in component status messages. Threads or processes send component status messages to Configuration Manager sites, which are identified by site codes.
You can define which messages to get by the severity of the message, the component that created the message, the computer that hosts that component, or the Configuration Manager server that receives the message. Always specify a viewing period as a TimeSpan object.
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>
. For more information, see getting started.
Examples
Example 1: Get error messages for a site
This example gets all messages with the error severity from a specific start time.
Get-CMComponentStatusMessage -StartTime "2/1/2013 12:00 AM" -Severity Error
Example 2: Get warning messages for a site within the last 24 hours
This example gets all warnings for a specific site in the last day.
Get-CMComponentStatusMessage -StartTime $(Get-Date).AddHours(-24) -Severity Warning -SiteCode "CM1"
Example 3: Get summary of messages for all components within last 24 hours
This example first uses the Get-CMSiteComponent cmdlet to get a list of all components from the current site. It pipes this list through several cmdlets to format the list, and then loops through each component. For each component, it gets the error and warning status messages for the last day. It then summarizes the number of errors and warnings for each component in the last day.
Note
This command can take several minutes to run.
PS OPC:\> Get-CMSiteComponent | Select-Object -ExpandProperty ComponentName -Unique | Sort-Object ComponentName | ForEach-Object {
$errs = $(Get-CMComponentStatusMessage -ComponentName $_ -Severity Error -StartTime $(Get-Date).AddHours(-24)).Count
$warns = $(Get-CMComponentStatusMessage -ComponentName $_ -Severity Warning -StartTime $(Get-Date).AddHours(-24)).Count
[pscustomobject]@{
Component = $_
Errors = $errs
Warnings = $warns
}
}
Component Errors Warnings
--------- ------ --------
SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT 742 0
SMS_WSUS_SYNC_MANAGER 90 0
SMS_WSUS_CONFIGURATION_MANAGER 0 0
SMS_WSUS_CONTROL_MANAGER 62 0
SMS_AD_SYSTEM_DISCOVERY_AGENT 0 0
SMS_CLIENT_HEALTH 0 0
SMS_CLOUD_PROXYCONNECTOR 0 0
SMS_AD_USER_DISCOVERY_AGENT 0 612
...
Parameters
-ComponentName
Specifies the name of a thread or process. A thread or process sends a component status message.
Type: | String |
Aliases: | Component |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ComputerName
Scope the status messages results and specify the name of a computer that hosts a component.
Type: | String |
Aliases: | MachineName |
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 |
-Severity
Specifies the severity of component status messages to get.
Note
This parameter currently doesn't work with the All
value, but also doesn't return any values if omitted.
Type: | Severity |
Accepted values: | All, Error, Warning, Information |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SiteCode
Specifies a site code from which to get component status messages.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StartTime
Specify a time for the start of the viewing period for the component status messages.
Type: | DateTime |
Aliases: | ViewingPeriod |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
IResultObject[]
IResultObject