Nice post David. I tried to comment on it but it errored out.... You can use 
limiting collections with OSD by creating an initial DDR using the SDK to 
ensure the device is in the correct collection before attempting to run the TS. 
Provided your limiting collection query only references SMS_R_System. The DDR 
can create/populate a custom property or an existing, meeting the limiting 
collection's criteria. This way you can still avoid limiting to All Systems and 
still use RBA.

Sent from my Windows Phone
________________________________
From: David O'Brien<mailto:[email protected]>
Sent: ‎7/‎11/‎2014 3:01 AM
To: [email protected]<mailto:[email protected]>
Subject: RE: [mssms] SCCM collection creation by script

Hi,



Just as a kind of best practice, don’t limit all your collections to “All 
Systems”.

Why?

Have a look here: 
http://www.david-obrien.net/2014/05/10/configmgr-collection-updates/



Cheers

David



From: [email protected] [mailto:[email protected]] On 
Behalf Of steven hosking
Sent: Friday, July 11, 2014 5:46 PM
To: [email protected]
Subject: Re: [mssms] SCCM collection creation by script



HI Jason,



understand try these powershell commands:



New-CMDeviceCollection -LimitingCollectionName "all systems" -Name x.x.x.x

Add-CMDeviceCollectionQueryMembershipRule -CollectionName x.x.x.x 
-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_NETWORK_ADAPTER_CONFIGURATION on 
SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceID = SMS_R_System.ResourceId 
where SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.DefaultIPGateway = "x.x.x.x"" 
-RuleName "computers in x.x.x.x"





what I would do is export the default gateways from SQL into excel, and then 
change out the x.x.x.x for the IP address and fill down on the sheet, and copy 
into notepad, clean up the Tab’s then paste it into powershell ISE and run it



hope that helps



Cheers



Steve



From: Jason Wallace <mailto:[email protected]>
Sent: ‎Friday‎, ‎11‎ ‎July‎ ‎2014 ‎5‎:‎33‎ ‎PM
To: [email protected] <mailto:[email protected]>



Hi there Steve

Thanks for that!  That is precisely what we DO have and it works really well 
indeed.

I have an engineer sat there however going through a list of several hundred IP 
subnets and creating this collection.  The list that we built was in itself 
built from a simple DISTINCT selection of default gateways from hardware 
inventory.

I was hoping to go a little further and script the extract from HW inventory 
and then cycle through this list, creating collections based upon the default 
gateways

Jason


  _____

From: [email protected] <mailto:[email protected]>
To: [email protected] <mailto:[email protected]>
Subject: Re: [mssms] SCCM collection creation by script
Date: Fri, 11 Jul 2014 06:16:35 +0000

Hi Jason,



try this:

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_NETWORK_ADAPTER_CONFIGURATION on 
SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceID = SMS_R_System.ResourceId 
where SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.DefaultIPGateway = "x.x.x.x"



Just change the x.x.x.x to the default Gateway Address.



Cheers



Steve



From: Jason Wallace <mailto:[email protected]>
Sent: ‎Friday‎, ‎11‎ ‎July‎ ‎2014 ‎3‎:‎50‎ ‎PM
To: [email protected] <mailto:[email protected]>



Hi folks

A dumb question for this morning but . . .

I am in the midst of a 2007 - 2012 migration.  We want to move devices over by 
IP subnet as there are a large number of branch offices.

I wonder whether someone has a magic script that can allow us to read the 
default gateway from hardware inventory and then create a series of collections 
on that please?

Thanks















Reply via email to