The title really says it all and I’m not going to re-hash the details and pretend like I came up with this, but I am going to share with you a little trick that will allow you to use this on multiple environments from the same server.
First off you will need to install the SMlets and edit the configuration files in the manner described here:
This works wonderfully and I’ve never run into an issue with it. This configuration allows you to use the SMlets natively on the SCORCH box without having to remote to an MS to run your SMlets and not requiring a full on MS be installed on the SCORCH box.
There is one small problem here though, and that is that you can no longer use the -ComputerName parameter of the SMlets because we override this setting by setting the $GLOBAL:smdefaultcomputer variable in the SMlets configuration file. No matter what you put for the -ComputerName parameter it will always use the default computer.
This is an issue for those of us that use a single Orchestrator environment for multiple SCSM environments. Luckily there is a solution and it’s a simple one:
Comment out the #$GLOBAL:smdefaultcomputer variable.
Once you do this you will no longer be able to just run the SMlet commands without the -ComputerName parameter because it will fail to find the data service. When you use the parameter though it will now work as expected.
Now you can user a server name variable in your SCORCH .net activity and easily change environments the script will target.
Hope this helps!