SCCM 2012 Management Scripts

This is a sort of guest post from my good friend Marius van de Ven. It is about a set of management scripts for Configuration Manager. He loves to PowerShell and make his SCCM life easier and better that way. The pack of scripts can be found on TechNet Gallery:
PowerShell: SCCM 2012 Management Scripts (Create Collections, Packages and more)
He explains what this set of scripts is all about below:
I created some sort of “Management Pack” for SCCM 2012. This pack contains quite some scripts which should ease up the management (and maybe implementation) tasks of SCCM 2012. The following scripts + example input files are present:

  • add_PackagesToDPs.ps1
  • add_PackagesToDPs.input
  • create_collections.ps1
  • create_collections.input
  • create_folders.ps1
  • create_folders.input
  • create_metering_rules.ps1
  • create_metering_rules.input
  • create_packages.ps1
  • create_packages.input
  • create_programs.ps1
  • create_programs.input
  • move_collections.ps1
  • move_collections.input
  • move_metering_rules.ps1
  • move_metering_rules.input
  • move_packages.ps1
  • move_packages.input

The names of the scripts pretty much explain what they do, but here is a short description for all of them.
This script will add all packages to all the available DP’s, except the PXE’s. DP’s can be excluded by changing the select query.
This script will create collections that are described in the input file. A distinction in the collections can be made by giving a different CollectionType (device or user).
This will create all the folders, within the SCCM console, to make seperation for collections, packages, etc. This makes the whole more manageable for the SCCM administrators. A distinction can be made between folders for Packages, Advertisements, Software Metering Rules, Devices and Users. Just change the FolderType in the input file to the appropriate value (see the script for an overview).
This will create all the Software Metering Rules. Not much more to say about this. Check the script for a short summary of common LanguageID’s that can be used.
This script will create all the packages that are described in the input file. The packages can also be created / moved to a folder that is described in the input file (and was probably created with the create_folders.ps1 script). If the folder doesn’t exist, the package will be created / placed in the root.
This will create all the programs in the package that is described in the input file. This was purposely seperated from the packages, because in some cases the program wasn’t known yet and the package was. They had to be created in advance.
With this script it is possible to move collections from one folder (location) to another. I had to do this for a lot of collections / applications, because new versions were released, but we wanted to keep the old. I decided to move it all to an _old folder. This script does it fast and clean.
Same functionality as the previous script, except for the metering rules.
You could have guessed what this does 🙂 Move multiple packages to new folders, fast and clean.
Most of these scripts will also work (with some minor adjustments) with SCCM 2007, but I created them especially for SCCM 2012, since more and more customers want this. Find a short ‘snippet’ of the create collections script + input. If you have any questions / improvements / etc. please let me know.
Note #1: I made the scripts not really in ‘PowerShell style’, but more in a ‘VBScript style’. This is to make them more readable and understandable, also for the less experienced scripters.
Note #2: I seperated all scripts / steps, because that gives me greater control of the total management. All these scripts could also be combined in one (which I have build previously in VBScript for SCCM 2007), but I like this better. Feel free to adjust it to your needs 🙂
Note #3: I ran all these scripts from the Management Point / SCCM Server! You probably want to do that too or write a small function that makes a connect to that server.
Note from Bob Cornelissen:
This looks like a very nice set of scripts to make your life easier. And of course I see more possibilities to bring this into a combination with other System Center products even.
Feel free to send me your suggestions for changes/improvements/additions and so on and I will pass them on to Marius.