Powershell Script To Add Computer To SCCM Collection
Maybe your like
Simple Powershell command/script to add computers to SCCM 2012/2007 collections, we use to have many collections in our SCCM platform to control the patching, how we want to push the patches like daily collection or hourly collections with different maintenance windows configured, its easy to add servers manually if we want to add a single server, lets say we want to add hundreds of servers on a collections, how to do this with a simple Powershell command?
Also Read: PowerShell command to extract Group policy result for a list of Servers
Adding Multiple Computers to a Single SCCM Collection from a text file:
Open Powershell from SCCM Console to avoid importing SCCM module, if you want to work with PowerShell for SCCM, you should have opened SCCM Console, and the easiest way is to get into PowerShell with access to the SCCM module is to click the blue drop down arrow from the top of the SCCM console and click Connect via Windows PowerShell

Also Read: Enable Powershell Remoting on Windows server 2008 R2 and 2012
Create TXT file called server_list.txt (c:\temp\server_list.txt) and update the server details
Run below Powershell Command
Get-Content "c:\temp\server_list.txt" | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName "Windowsdailyrun" -ResourceID (Get-CMDevice -Name $_).ResourceID }Note: You needs to change SCCM collection name and input file name as per your requirement
Collection name = Windowsdailyrun
Server list = c:\temp\server_list.txt
Also Read: Interesting oneline script written using windows command
Related posts:
Compare Installed Windows Security Patches with other Servers
Why PowerShell remoting can’t be enabled on a Windows server 2008
Enable Powershell Remoting on Windows server 2008 R2 and 2012
GPO Update failed with LDAP Bind function call failed error on Windows Server 2016/2019/2012 and Windows 10
Microsoft August 2020 Patch issues and unanswered questions: No Netlogon events in Domain Controller logs after August 2020 Patches Tag » Add Computer To Sccm Powershell
-
Import-CMComputerInformation (ConfigurationManager)
-
Add-CMDeviceCollectionDirectMembershipRule - Microsoft Docs
-
Add Multiple Devices To SCCM Collection Using PowerShell
-
Add Multiple Computers To SCCM Collection Using Powershell
-
Import Bare Metal Devices Into SCCM Using PowerShell
-
Add Computers From A File To A SCCM Collection Using PowerShell ...
-
Adding Multiple Devices To SCCM Collection PowerShell
-
Add Computer To A SCCM Device Collection. : R/PowerShell - Reddit
-
PowerShell Add Computers To Collection From CSV - SCCM ConfigMgr
-
UMN-m1 1.0.3 - PowerShell Gallery
-
UMN-m1 1.0.4 - PowerShell Gallery
-
Getting Started With SCCM Powershell Cmdlet - System Center Dudes
-
Use PowerShell To Add Computers To AD Security Groups During ...
-
Add Computer To SCCM Collection - Script Center - Spiceworks