Posts

Showing posts from 2020

CMPivot to check Services and start them (with a little help)

Image
Have you ever needed to get a really fast real-time look at if a service is running on a set of servers or workstations? Open CMPivot against a collection, type in your query, and send it. Seconds later you get real-time answers to your query for any online device. Queries for CMPivot run on 42 devices at once, until all devices you're querying have responded. The last time my organization did server updates, I (and a trusty super awesome coworker) had to verify if a couple of SQL services were running on a small collection of servers. As we were manually checking these one by one, I came up with the idea that it would be incredibly helpful to use CMPivot. The below query in CMPivot will return all devices where a SERVICE with the name containing SQL is NOT RUNNING and the service's start type is AUTO. In other words, if a service with SQL in the same is supposed to be automatically running and it's not, this query tells us.Service |where Name contains'sql' | where…

Uninstall MSI Applications with Run Scripts and CMPivot

Image
As Config Manager admins, we're frequently approached by managers that want us to do something NOW. Enter the Run Scripts feature in Config Manager. If you're not familiar with CMPivot, Run Scripts, and Client Notification then it would be super helpful for you to read a few of my past blogs.

Intro to CMPivot and Run Scripts A Deeper Dive into CMPivot, Run Scripts, and Client Notification Adding Parameters to Run Scripts
Today's ramble is on how to use Run Scripts with a parameter to instantly uninstall an MSI application from your device(s). We're going to use a quick 12 year old PowerShell script (it's an oldie, but a goodie) I found on Stack Overflow.
#Uninstall an MSI application
Param( [Parameter(Mandatory=$True)] [string]$ApplicationName )
Get-WmiObject-ClassWin32_Product|Where-Object {$_.Name -eq$ApplicationName} |foreach-object-process {$_.Uninstall()}
In you SCCM or MEMCM or MECM or whatever you call it now console, go to Software Library > Scripts and click on

Run Scripts with Parameters in MEMCM (R.I.P. SCCM)

Image
How do you use Parameters in MEMCM's (R.I.P. SCCM) Run Scripts?
How do you use Parameters on the Run Scripts feature? You get three guesses, but the first two don't count. That's right, you create a script with standard PowerShell Parameters and you build it out in MEMCM. In your MEMCM console, navigate to Software Library > Overview > Scripts. If you're not familiar with Run Scripts in MEMCM, check out my previous Blog articles on it.

Click on Create Script. In the Create Script Wizard that pops up input a Script Name, pick between PowerShell or PowerShell in your Script Language, import or paste in your script with Parameters, and click on Next.

My demo script for this article (scroll alllll the way down, it's at the bottom) is about an 8 out of 10 on the cool factor, and about a 3 out of 10 on the usefulness factor. Long story short, the script will make a computer talk. There are two Parameters that you can input, one for "what do you want to say?&qu…