Tocatech
New Member
- Messages
- 1
- Points
- 1
thanks so much for the article to show us how to add devices to a collection through powershell, it works great. https://www.prajwaldesai.com/add-multiple-devices-to-sccm-collection-using-powershell/
but i have another scenario that i need help with. so i have a list of 200 user accounts the company's device naming policy is that the machine name will always be first name and first 3 letters of the second name eg: Elvis Presley machine name will be Elvispr-wrk or Elvispr-lap
So i would like to modify the script to say... look at the txt file and add any device name that is like Elvispr%.
below is an extract of the script from the article above.
Get-Content "E:\Sources\Import\List_computers.txt" | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName "Computer List" -ResourceID (Get-CMDevice -Name $_).ResourceID }
but i have another scenario that i need help with. so i have a list of 200 user accounts the company's device naming policy is that the machine name will always be first name and first 3 letters of the second name eg: Elvis Presley machine name will be Elvispr-wrk or Elvispr-lap
So i would like to modify the script to say... look at the txt file and add any device name that is like Elvispr%.
below is an extract of the script from the article above.
Get-Content "E:\Sources\Import\List_computers.txt" | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName "Computer List" -ResourceID (Get-CMDevice -Name $_).ResourceID }