ProVal Tech’s Consultant Alex guides you through ConnectWise Automate PowerShell Command vs Execute Script.
Step by Step:
- Today I wanted to go over a couple of commands inside of Automate, especially in the scripting functions that you may be accustomed to using and why you should use one versus the other.
If I pull up this script here what I’m looking for is normally you would copy and paste any of your PowerShell into an execute script and this allows you to basically paste anything you want inside of this.
- Text editor here and it will execute all within PowerShell which is great however sometimes when you’re running into issues you may have to run it differently.
- I was actually running it into an issue with this in this particular script where you may have to use the PowerShell command and use the one-line version of that and the difference is this is running as ps.exe so a live terminal and reporting back to the PowerShell result. Whereas the other one is writing to like a temporary PS1 File running it and then basically deleting itself and reporting back to a variable.
- This is especially noteworthy when you’re doing importing modules or things you need to use multiple times example in this script here.
- I’m importing a module called PS Windows update to then be later used in terms of getting the update history, but I have to run the update history as a ps.exe in order for it to import the module automatically.