Use Otter to Level Up Your PowerShell For Free
by Crista Perlton, on Jul 14, 2021 5:49:21 AM
Are you getting absolutely everything you can out of your PowerShell scripts? If you’re not using Otter, a tool that helps you provision your servers and manage configuration, probably not. If you're not already familiar with Otter, check out our 5-minute Getting Started with Otter video.
Your scripts are resources that you and your colleagues toil over, nurture, and rely on. If you’re only using them through the PowerShell you are not getting everything you can out of them.
Here are 2 ways you can instantly level up your PowerShell usage with Otter for free.
Create GUIs for your Scripts
Instead of spending ages trying to make an application out of a script, Otter can run scripts with auto-generated UIs.
Otter can automatically generate a UI around your scripts. It does this in two ways:
Otter lets you add comments and descriptions, which as I’ve stated before, is the key to creating perfect PowerShell scripts.
Using job templates enable self-service, removes time-consuming blockers, and empowers junior members to be productive/involved. The next time a team member needs to run a job, even if they don’t have permission to run scripts, they can use the template, which will restrict inputs AND will prompt a reminder when you’ve forgotten to fill out required fields.
Run Parameterized PowerShell Scripts
Running PowerShell scripts is easy if you're a PowerShell guru. But what if you need non-experts to run your scripts? Using Otter to add a graphical user interface (GUI) to PowerShell makes your PowerShell scripts more accessible to more people on your team.
Otter automatically generates a UI around your PowerShell scripts, enables those who are less comfortable or familiar with PowerShell run scripts without expert intervention. Here's how:
After installing Otter, add your scripts and create a Job Template. Job Templates enable self-service with safety by defining usage restrictions. For example, you can restrict which servers a script may run on. Job templates also let you define variable prompts.
After creating the Job Template, you can use Otter to generate an input prompt (e.g., checkboxes, a text box, select-from list). This organizes the parameters for your PowerShell scripts into an accessible GUI executed as a job. And if you have Comment-based Help in your scripts, Otter will auto-generate these for your script. Check out this documentation page for more on the types of specific variables prompts Otter can create.
Otter doesn't just let your non-expert PowerShell users run scripts; it also allows those in charge to sleep more soundly at night by targeting only specific servers for a particular job or job template. Otter offers three types of server targeting:
|Direct||Best used for set-ups with just one or two servers, "Direct" specifies servers by name, and the script is then run against each server. This method can use variable names.|
|Indirect||Although it requires some planning ahead, "Indirect" specifies a combination of roles and/or environments that will be used to specify the servers the script is run against. This method can use variable names.|
|Custom||This method is the most flexible but also the most complex. "Custom" lets you perform complex orchestration that can run different commands or scripts on different servers. These servers can be targeted sequentially, in parallel, and with branching and iterating (looping) logic.|
Finally, to make sure scripts only ever run on the right servers, you'll want to define your targeting to meet your specific requirements. To do this:
- Click "edit" on your job template.
- Choose "add" under "template variables (prompts)."
- Create your variable using the parameters you desire.
- Confirm that "Custom server targeting" is listed next to "server targeting"
- Commit changes.
Then, of course, test. If you've done everything right, when you (or anyone with access) goes to create a job from that template, the targeting menu should look as you defined it. For example, I configured "TargetServer" to be a list-type variable with list values of testsv1, testsv2, and testsv3. I then tested the template and saw I did everything right:
Level Up with Otter
Otter is designed to help you take your PowerShell usage to the next level. It removes bottlenecks on your team, safeguards your system, and enables self-service in your IT organization without extra costs.
Your IT organization (and you) spend a considerable amount of time creating your PowerShell modules and caring for them. If you’re not using Otter, you’re not stretching them as far as they can go.
Otter has a free forever version available to download here that offers everything your team needs to take your PowerShell experience to the next level.