Using Powershell you can do many things in SCCM. Over the years, in many SCCM consulting projects we got involved in, we get the same question: “Can you create SCCM collections for Servers, Laptops, Workstations, Windows 10…”. Back in 2015, I started to build an SCCM collection PowerShell script to create SCCM operational collections which we create just after an SCCM installation. With time, I added more and more collections to the script. Fast forward to today, the script now contains 148 collections and has been downloaded more than 75 000 times making this PowerShell script my most downloaded contribution to the community. This set of collections usually covers 95% of the initial client needs. All you need to do is to run the SCCM collection PowerShell script on your SCCM server and wait. In about 5 minutes, you’ll end up having 148 collections in an Operational folder. The collections are set to … Read More
SCCM Remove Computer from Collection after OSD
This post is a step-by-step guide on how to remove computers from the collection after OSD. If you’re using specific collections for your OSD deployments you certainly know that the collections are not emptied automatically. After a couple of weeks, you’ll end up with a collection full of systems. The bad news is that there’s nothing built-in in the product, the good news is that our friend PowerShell can do this dirty job. To run the script : The imported module needs to be trusted The script must run in x86 mode The computer account must have proper permission (SCCM and DCOM) SCCM Remove Collection OSD – Permission You need to add your primary site computer account as a “Full Administrator” in SCCM You need to add the “System” account “Remote Access” right in DCOM permission Launch “dcomcnfg.exe” Navigate to Component Services / Computer / My Computers (Right-Click) / Properties … Read More
SCCM PowerShell Script to Delete Unused Collection
Are you using an SCCM Script to Delete your collection? From all SCCM management activities, collections are arguably the most important object to know about. Collection evaluation, if not configured correctly can have a huge impact on your SCCM hierarchy. This Powershell script will detect and delete SCCM Devices Collections that have no members and no deployment assigned to them. This can be useful to delete unused/unneeded collections. We often see lots of these “orphan” collections after years of management. The less collection, the fewer evaluation task for your server. Why would you want to consume server resources on collections that are useless? Even worst, if you are using incremental collection refresh, it could slow down considerably your server. You can do the whole process manually but it will be difficult to identify and fastidious to delete all collections one by one. This is where Powershell becomes really useful and saves … Read More
Getting started with SCCM Powershell cmdlet
You can run SCCM Powershell cmdlet and scripts from the SCCM console or from a Windows PowerShell session. This is very useful to do stuff in SCCM without using the console. You can do pretty much anything using Powershell. When you get used to it, you can write more complex scripts to automate and save lots of time. Supported versions of SCCM’s current branch support Windows PowerShell version 5.1. Starting in version 2010, the Configuration Manager PowerShell cmdlet library supports PowerShell 7. If you’re not familiar with PowerShell and SCCM, the easiest way to connect to your site is to use the shortcut in the console : In the SCCM console Select the upper-left white arrow choose Connect via Windows PowerShell A Windows PowerShell loads, you’ll see a prompt that contains your site code. For example, if the site code is “SCD”, the prompt will show: PS SCD:\> SCCM Powershell Cmdlet Syntax … Read More
Create SCCM Maintenance Windows using Powershell
Maintenance windows are useful to ensure that important tasks on devices are run at the right moment. Usually you create a Maintenance Window in the SCCM console butyou can manage your SCCM maintenance Windows using PowerShell. This is useful when you have to create many. Here’s a simple example but you can get creative. This example will create a Maintenance Window that occurs each fourth day of every 3 months effective the time you create it at 3:00 AM. We are using the New-CMMaintenanceWindow and New-CMSchedule cmdlet. You have to know that Maintenance windows can be applied to Application and package, Software update, Compliance settings and task sequences. The maximum duration of a window is 24h. SCCM Maintenance Windows Powershell Validation Once you’ve run the script and the Maintenance Windows is created, you can check in the SCCM console or use one of our report. Console In the SCCM Console … Read More
SCCM Powershell collection boundary groups
With SCCM 2002 that was just released, a small but extremely useful feature is now available in console. It is now possible to view what boundary group a device is connected to! This offers a new opportunity with collections based on Boundary groups, which could mean physical sites or any other meaningful needs in your environment. I’ve created a PowerShell script that automatically creates collections based on all the available boundary groups. Requirements SCCM must be at least version 2002. See our Step-by-step guide upgrade guide here SCCM Powershell collection boundary groups The script can be downloaded on GitHub, since Technet Gallery is retiring soon. Be sure to rate the submission if you are using it. Example of the result of the script Collection query for boundary groups Thanks to fellow SystemCenterDudes, Eswar Koneti, for his post about that exact query This isn’t the typical query for collections Note that … Read More
How to detect Office bitness with MEMCM global condition
I recently came across an issue where a MEMCM) Global condition was detecting the Office bitness (architecture), but only to one specific version(example below). This lead to a requirement issue where the computer was running another version of Office that wasn’t covered by the global condition. With that said, we still needed a requirement only for the architecture of Office, while the version was not that important for now. I’ve uploaded a new script to Technet Gallery that returns the Office Bitness no matter what version is installed (from Office XP to the latest). In this post, I’ll describe how to use the script with a MEMCM global condition as a requirement for an application. MEMCM Global Condition Office Bitness Requirement Download the Office Bitness detection script from Github The script The script is looking at the Bitness registry key of Outlook. The script will return the value of Bitness. … Read More
Use Powershell to generate certificates for your lab
Certificates are becoming more and more important and are used almost everywhere and many solutions need a certificate to even start up. In production, you should have a healthy PKI solution up and running, but in your lab environment or if you just want to quickly test things without involving your company’s PKI-guy you can use PowerShell to quickly spin up certificates. Here’s how to use Powershell to generate certificates in your lab : Create a Root CA First we’ll create our root certificate. Copy the Thumbprint of your newly generated root cert into notepad ,you’ll need it later. This does a few things. It creates a new certificate with the CertSign usage with means we can use it to sign other certificate and puts it in the current users cert store. This is our new mini root certificate that we’ll use to sign all the other certificates. The second … Read More
SCCM Report Manager Tool for managing SCCM Reports
We developed an SCCM Report Manager tool using Powershell to manage your reports on an SCCM Reporting Point. SQL Reporting Services can be time-consuming when you need to download, upload or change data source on multiples reports. If you purchase one of our reports or our Complete Report Bundle, you had to upload every report and change their data source one-by-one. This tool is then a must if you need to manage multiple reports. Based on your SCCM Reporting Point and SCCM site code, the tool allows to : Upload multiple reports from a specific folder — Useful if you have multiple RDL files to upload at once Download all report from a specific SSRS folder — Useful if you have multiple custom reports and are doing a migration to a new reporting point Change data source of all reports from a specific SSRS folder — Useful if you upload multiple new reports … Read More