Hi,
I would like to create a device-/usercollection with a short powershellscript.
Within Microsoft SCCM 2012, I have two commands new-cmdevicecollection and add-cmdevicecollectionmembershiprule.
Both combined are like:
New-CMDeviceCollection -Name "W7 - Microsoft Internet Explorer 12" -Comment "Internet Explorer 12" -LimitingCollectionName "W7 - All Devices" -RefreshType Periodic -RefreshSchedule (New-CMSchedule -Start (get-date) -RecurInterval
Minutes -RecurCount 60) -Verbose
Add-CMDeviceCollectionQueryMembershipRule -RuleName "Active Directory Group" -Collectionname "W7 - Microsoft Internet Explorer 12" -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 where SMS_R_System.Obsolete = 0 and SMS_R_System.OperatingSystemNameandVersion like 'Microsoft Windows NT Workstation 6.1%' and SMS_R_System.SystemGroupName = 'ourdomain\ouradgroupforsystemsthatneedIE12'"
What I'd like to do now is have a powershellcommand that simplifies/only asks for collectionname, comment and adgroup the command.
I'm not familiar with writing scripts, can you clarify how to make that would work?
Note: even handier would be to do this from an Excel sheet, but not sure if that would work.
J.
Jan Hoedt