Get-CMDeviceCollectionDirectMembershipRule
Get a direct membership rule for a device collection.
Syntax
Get-CMDeviceCollectionDirectMembershipRule
-CollectionName <String>
[-ResourceName <String>]
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-CollectionName <String>
-Resource <IResultObject>
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-CollectionName <String>
-ResourceId <String>
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-CollectionId <String>
-Resource <IResultObject>
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-CollectionId <String>
-ResourceId <String>
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-CollectionId <String>
[-ResourceName <String>]
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-InputObject <IResultObject>
-Resource <IResultObject>
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-InputObject <IResultObject>
-ResourceId <String>
[<CommonParameters>]
Get-CMDeviceCollectionDirectMembershipRule
-InputObject <IResultObject>
[-ResourceName <String>]
[<CommonParameters>]
Description
Use this cmdlet to get one or more direct membership rules for a device collection.
A direct membership rule lets you explicitly choose the members of the device collection.
Default collections don't have direct membership rules. Any collection that you target should have an ID that starts with the site code, not SMS
.
For more information, see How to create collections in Configuration Manager.
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 all direct membership rules for a collection by name
This command gets the direct membership rules for the device collection named Device01.
Get-CMDeviceCollectionDirectMembershipRule -CollectionName "Device01"
Example 2: Get all direct membership rules by using the pipeline
This command uses the Get-CMCollection cmdlet to get the device collection object named Device02. It then uses the pipeline operator to pass the object to the Get-CMDeviceCollectionDirectMembershipRule cmdlet.
Get-CMCollection -Name "Device02" | Get-CMDeviceCollectionDirectMembershipRule
Parameters
-CollectionId
Specify the ID of the device collection to get the rule. This value is the CollectionID property, for example, XYZ00012
. Since default collections can't have direct membership rules, this ID starts with the site code and not SMS
.
Type: | String |
Aliases: | Id |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CollectionName
Specify the name of the device collection to get the rule.
Type: | String |
Aliases: | Name |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
Specify an object for the device collection to get the rule. To get this object, use the Get-CMCollection or Get-CMDeviceCollection cmdlets.
Type: | IResultObject |
Aliases: | Collection |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Resource
Specify a device object to get its direct membership rule from the device collection. To get this object, use the Get-CMResource or Get-CMDevice cmdlets.
Type: | IResultObject |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceId
Specify the ID of the device to get its direct membership rule from the device collection. This value is the ResourceID property, for example 16777219
.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceName
Specify the name of the device to get its direct membership rule from the device collection.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Inputs
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object