Today we are going over a recent feature within ConnectWise RMM that allows us to hook into the output of a PowerShell, Bash, or Shell script from within the script editor.
Step by Step:
- Today I want to go through some ConnectWise RMM actually and take a look at some of the new features that they have which is actually super helpful when it comes to setting custom EDFs or things like that but here’s what we can do in terms of scripting and then utilizing basically the script output to further our automation.
- So, I have my machine pulled up here and if I pull the documentation from ConnectWise RMM or Connect Command as well the Powershell output is considered just percent output percent just like it is in automate as a system variable.
- So, we can use that when we run a Powershell command you can use that in a Powershell command here to basically set that or utilize that or trigger something else from here.
- So, what I’ve done is I’ve thrown together a quick script nothing fancy at all but if I come in here and I look for Alex’s EDF so what I’ve done in here is I’ve just utilized the script editor so that I can break it down very simplistic.
- What I’m doing and the nice thing about here is I can do if then else basically at each line so drastically improvement upon the automation system, but what I’ve done in here is just write a simple Powershell script you don’t have to know exactly what this is doing but the shorthand is that I’m grabbing the OS versio, I’m running a regex pattern to remove basically the build number like the table style, and then just grabbing the last what is it 10 digits or 16 digits of the actual version and so that’s all I’ve got there.
- Inside my script log I am just outputting that exact message.
- So, whatever the script says just dump it instead of otherwise it would just say script succeeded. So keep that in mind this is helpful to basically read what the actual script ran.
- And then in the last thing here I have a workstation OS field basically on every machine and I’m just outputting that same output to that EDF and that output that custom field is a string variable. So what I can do is if I come back into my devices here and I’ll hit abandon (because I didn’t change anything) open up my machine and I did run this once but what we can do is come in here and if I search for my EDF I can say run now and it does trigger it takes maybe a minute or two I think when you use the editor it does take some extra time compared to just running Powershell direct (which is fine it does give that two-way automation just like automate where it does send and receive in between each step of the script) this is what that looks like it will say script succeeded and it will spit out the script log so that’s super handy.
- This is what I wanted to see and if done correctly when once this is completed and if I keep selecting automation it does kind of a soft refresh here or keep clicking on the script.
- Once that is complete and it says script succeeded again then when I come over to Custom Fields here this workstation OS is currently empty and it was edited by me just moments ago and once that script completes I should see this with that 10.0.22000 number and then I also should see Modified by and this is the script ID of that machine so that gives you an idea of who actually modified it versus the system or I should say versus the system versus the user.
- So, if I come into automation here script success script succeeded, dumped my version number in here, come back to Custom Fields there it is and now I can see this is the script ID that ran this is like an internal script ID so it’s not something currently accessible.
- Then it did update shortly after the call here.