Hi All
I have a servers list in a text file in the below format. I have a Collection by name MyCollection, i wan to add the servers to this collection by importing the text file. I am connected to configuration manager primary site server, if i execute the below syntax from windows powershell will it work for me.
server01
server02
server03
Get-Content "C:\temp\servers.txt" | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName "MyCollection" -ResourceID (Get-CMDevice -Name $_).ResourceID }
If i want to create a collection and at the same time i want to import the text file how do i do it from windows powershell.