Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

SOLVED Error when created collection with command

Status
Not open for further replies.

DAKHAMA MEHDI

Member
Messages
5
Reaction score
3
Points
3
Hi family,
i have this error when i want creat a collection with powershell from OU
my code :
$OU_Name = 'info.prive/parc/users/disi'

New-CMUserCollection -LimitingCollectionName 'All Users' -Name $OU_Name -RefreshSchedule $Schedule -Comment $O_GUID

Add-CMUserCollectionQueryMembershipRule -CollectionName $OU_Name -QueryExpression "select * from SMS_R_USER where SMS_R_User.SystemOUName = '$O_Name'" -RuleName "OU Membership"

the error :

Au caractère C:\Users\mehdi\Downloads\sccmou.Run.ps1:287 : 4
ERROR: + Add-CMUserCollectionQueryMembershipRule -CollectionName $O_Name -QueryExpress ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (Microsoft.Confi...shipRuleCommand:AddUserCollecti...shipRuleCommand) [Add-CMUserCollectionQueryMembershipRule], W
ERROR: qlQueryException
ERROR: + FullyQualifiedErrorId : UnhandledException,Microsoft.ConfigurationManagement.Cmdlets.Collections.Commands.AddUserCollectionQueryMembershipRuleCommand
ERROR: Add-CMUserCollectionQueryMembershipRule : Objet d'erreur ConfigMgr :
ERROR: instance of SMS_ExtendedStatus
ERROR: {
ERROR: CauseInfo = "";
ERROR: Description = "Error waiting for query to return.";
ERROR: ErrorCode = 1078464258;
ERROR: File = "..\\sspobjectquery.cpp";
ERROR: Line = 5472;
ERROR: ObjectInfo = "select * from SMS_R_USER where SMS_R_User.SystemOUName = 'info.prive/parc/users/disi'";
ERROR: Operation = "ExecQuery";
ERROR: ParameterInfo = "select * from SMS_R_USER where SMS_R_User.SystemOUName = 'info.prive/parc/users/disi'";
ERROR: ProviderName = "WinMgmt";
ERROR: SQLMessage = "[42S22][207][Microsoft][SQL Server Native Client 11.0][SQL Server]Nom de colonne non valide : 'SystemOUName'.";
ERROR: SQLSeverity = 16;
ERROR: SQLStatus = 207;
ERROR: StatusCode = 2147749889;
ERROR: };
 
i fixed the error,
the probleme was the queryexpression, correct from a graphic model of sccm,
the correct command to create collection is :
New-CMUserCollection -LimitingCollectionName 'All Users' -Name NAME -RefreshSchedule "7"

Add-CMUserCollectionQueryMembershipRule -CollectionName "Name" -QueryExpression "select * from SMS_R_User where SMS_R_User.UserOUName = 'NAME-OU'" -RuleName "OU Membership"

i will do an article to do it from powershell later,
thanks
 
Status
Not open for further replies.

Forum statistics

Threads
7,182
Messages
28,011
Members
18,317
Latest member
rbushart

Trending content

Back
Top