Export (0) Print
Expand All
Expand Minimize

Add-CMDeviceCollectionQueryMembershipRule

Updated: February 7, 2014

Applies To: System Center 2012 R2 Configuration Manager

Add-CMDeviceCollectionQueryMembershipRule

Adds a query membership rule to one or more Configuration Manager device collections.

Syntax

Parameter Set: ByCollectionId
Add-CMDeviceCollectionQueryMembershipRule -CollectionId <String> -QueryExpression <String> -RuleName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionName
Add-CMDeviceCollectionQueryMembershipRule -CollectionName <String> -QueryExpression <String> -RuleName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionValue
Add-CMDeviceCollectionQueryMembershipRule -Collection <IResultObject> -QueryExpression <String> -RuleName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The Add-CMDeviceCollectionQueryMembershipRule cmdlet adds a rule that adds devices to the collections based on a query. You can specify the device collections by using their names, IDs, or by specifying an object that represents the collections. The query is specified as a text string.

A query rule lets you dynamically update the members of a collection based on a query that is run on a schedule. For more information on collection rules in Microsoft System Center 2012 Configuration Manager, see Introduction to Collections in Configuration Manager (http://go.microsoft.com/fwlink/p/?LinkID=259433) on TechNet.

Parameters

-Collection<IResultObject>

Specifies a Configuration Manager device collection object. To obtain a device collection object, use the Get-CMDeviceCollection cmdlet.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CollectionId<String>

Specifies the ID of the device collection where the rule is applied.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CollectionName<String>

Specifies the name of the device collection where the rule is applied.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-QueryExpression<String>

Specifies the query expression that Configuration Manager uses to update the device collections.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-RuleName<String>

Specifies the name for the rule.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.


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.

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 query membership rule

This command adds a membership rule named TPM Information to the device collection named Mobile Windows 7 Devices. The QueryExpression parameter specifies the query that defines the membership rule.


PS C:\> Add-CMDeviceCollectionQueryMembershipRule -CollectionName "Mobile Windows 7 Devices" -QueryExpression "select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from  SMS_R_System inner join SMS_G_System_TPM on SMS_G_System_TPM.ResourceID = SMS_R_System.ResourceId" -RuleName "TPM Information"

Related topics

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft