I came across a code snippet by Mick Pletcher () that you can add to the end of a compliance item script to kick off the evaluation of a baseline. I took that and added a parameter to it so you can use it as a ConfigMgr Run Script. It look like a lot of code but 90% is just documentation.
Continue reading “ConfigMgr Run Script – Kickoff Compliance Baseline Check”Category: PowerShell
ConfigMgr PowerShell Script – Create Collections off Compliance Settings Configuration Items
The script uses Get-CMConfigurationItem cmdlet to get a list of LocalizedDisplayNames of Compliance Setting CIs and then runs a Foreach to create three collections based using the LocalizedDisplayName. Parameters specify the CM Site Code, Limiting Collection collection ID, and the CI Name. It does a check to see if a collection exists beofre creating which is also a self repair feature as a deleted collection will be recreated.
Continue reading “ConfigMgr PowerShell Script – Create Collections off Compliance Settings Configuration Items”ConfigMgr Run Script – Set Service State
As you can tell, many of my script posts occur after something was needed at work and I ended scripting it. This time we needed to alter the startup of a service on a group of systems. I wrote this PowerShell script to set the startup type and status of a specified service. It does require three parameters: service name, startup type desired, and desired status.
Continue reading “ConfigMgr Run Script – Set Service State”ConfigMgr Log Collector Run Script
In most environment I have worked in, I have not had access or easy access to some systems I was expected to troubleshoot ConfigMgr issues on especially servers. I would normally have to ask for someone to send me logs and half the time needed to explain where to find that logs. I wrote a quick ConfigMgr Run Script that I can target against a system or collection and no longer have to ask for logs because the script will get them for me.
Continue reading “ConfigMgr Log Collector Run Script”Using PowerShell to fake converting ConfigMgr IPSubnet to IPRange boundaries
Over the years that I have done work ConfigMgr, there was a back and forth on what type of boundaries to use between IPRange and IPSubnet. I have worked in places that were one or the other as well as mixed. Normally, what was used was determined by the suggestion of a Microsoft PFE. Now, I want to convert my IPSubnet boundaries to IPRange boundaries. Continue reading “Using PowerShell to fake converting ConfigMgr IPSubnet to IPRange boundaries”
VSCode script template with logging
I recently created an alternative version of the script template. This one is for PowerShell scripts and includes additions for the logging that I do both within a log file and Event Viewer. I am including the template and the code to add to VSCode to make it a snippet. I also have the code and snippets for adding the logging within the script. Continue reading “VSCode script template with logging”
PowerShell Script Template
I recently went to Midwest Management Summit aka MMS (and if you are in the ConfigMan world and don’t go then you are missing out). A few of the sessions I attended were centered around scripting and how to improve things. One thing that was brought up a few times is having a standard on how your scripts are formatted. This is important as it helps when viewing the script to understand what it does and doing any work on the script. With that I developed the following PowerShell template I would like to share. Continue reading “PowerShell Script Template”