I have a power shell command line where i am trying to import a txt file filled with serial numbers (example. "123","456", etc.) into SCCM to create a device collection. I am trying to import within parameters so it only create 1 Query using List of Values, but I keep getting an error "A Positional paramter cannot be found that accepts argument .\process.txt"
$Process = ".\process.txt
Add-CMDeviceCollectionQueryMembershipRule -Collection $collection -RuleName "Membership $collectionName" -QueryExpression "select * from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM_PRODUCT on SMS_G_System_COMPUTER_SYSTEM_PRODUCT.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM_PRODUCT.IdentifyingNumber in "`("$Process"`)""
Expected Results
select * from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM_PRODUCT on SMS_G_System_COMPUTER_SYSTEM_PRODUCT.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM_PRODUCT.IdentifyingNumber in ("9876","6543",12345")
Actual Results
Add-CMDeviceCollectionQueryMembershipRule : A positional parameter cannot be found that accepts argument
'(C:\Users\Owner\Desktop\Process.txt)'.
At C:\Users\Owner\Desktop\Add2Sccm_Works SerialNumber - Copy.ps1:42 char:1
+ Add-CMDeviceCollectionQueryMembershipRule -Collection $collection -Ru ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Add-CMDeviceCol...yMembershipRule], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ConfigurationManagement.Cmdlets.Collections.Comman
ds.AddDeviceCollectionQueryMembershipRuleCommand