To create a user collection, select the User Collections node. Then, on the Home tab of the ribbon, in the Create group, select Create Device Collection. To create a device collection, select the Device Collections node. In the Configuration Manager console, go to the Assets and Compliance workspace. The new collection contains Dell desktops that have at least 4 GB of RAM. The exclude collection is for a collection of computers that have less than 4 GB of RAM. The include collection rule is for a collection of Dell desktops. You create a collection that has one include collection rule and one exclude collection rule. If a collection includes both include collection and exclude collection rules and there's a conflict, the exclude collection rule takes priority. You can add multiple exclude collection rules to a collection. If the excluded collection changes, Configuration Manager updates the membership of the current collection on a schedule. Exclude collection ruleĮxclude collection rules let you exclude the members of one collection from another Configuration Manager collection. You can add multiple include collection rules to a collection. If the included collection changes, Configuration Manager updates the membership of the current collection on a schedule. Include the members of another collection in a Configuration Manager collection. This collection is automatically updated when new users are added to or removed from the Human Resources organizational unit.įor example queries that you can use to build collections, see How to create queries. For example, you can create a collection of users that are a member of the Human Resources organizational unit in Active Directory Domain Services. Query ruleĭynamically update the membership of a collection based on a query that Configuration Manager runs on a schedule. Direct rule collections have more administrative overhead than query rule collections because they require manual changes. Before you can add the resources to a direct rule collection, Configuration Manager must have discovered them or you must have imported them. The membership doesn't change unless you remove a resource from Configuration Manager. Use direct rules to choose the users or computers that you want to add to a collection. There are different types of rules that you can use to configure the members of a collection in Configuration Manager. For more information about how to export and import collections, see How to manage collections. You can also import collections that were created at the current Configuration Manager site or at another one. The information in this article can help you create collections in Configuration Manager. If you try to do that, you should get an InvalidOperationException with a message like "Collection was modified enumeration operation may not execute.A collection can contain users or devices, but not both. You need to be careful, though, because you can't do this: foreach (var item in collection) You could write your extension method to take the other approach, and pass an IEnumerable as in your example. Second, the question's sample code passes a sequence of items to be removed from the collection, but List.RemoveAll() and HashSet.RemoveWhere() take a predicate to identify the items to be removed (as shown in the other answers). If you want to be able to do this for any ICollection, you should write an extension method. A couple of interesting points:įirst, RemoveAll() is not defined in the ICollection or ICollection interface it's defined on List, for example, but the semantically equivalent method on HashSet is called RemoveWhere(). Both of the already-submitted answers are correct, but omit an explanation why the poster's sample code doesn't work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |