Otter Documentation

Incorporate PowerShell Scripts into a Plan

PowerShell is the standard for automating configuration on Windows servers. While you definitely don't need to be a scripting guru to use Otter, Otter's seamless integration with PowerShell allows you to easily incorporate scripts into your Otter plans and in turn automate virtually any aspect of Windows.

In Otter, PowerShell scripts can be added as an Asset and then called as an operation in a plan. Plans and assets are essentially files, and Otter uses a raft to store them. (Note that you can store configurations by either using the database or by storing and versioning them using Git as a repository)

Otter simplifies the use of PowerShell scripts by parsing through them and using their existing documentation to enrich the UI. Though your script will likely include all of the conventional documentation headers, Otter will use only two of them: SYNOPSIS (a brief explanation of what the script or function does) and PARAMETER (an explanation of a specific parameter). See this article for more information on documentation headers.

Adding a PowerShell Script in Assets

Click Add PowerShell Script > Enter script name > Click Save and Edit > Edit script > Click Save Script

  • Visual
  • Text
 <# 
.SYNOPSIS 
Creates users in Active Directory
.DESCRIPTION
This will create multiple user accounts in Active Directory
.EXAMPLE
$params = @{$FirstName="Ahmad";$Initials="AH";$LastName="Hamad";$ModifiedFullName="HamadAhmad";UserLogonName="ahamad";$Password="password1"} 
& “.\create-active-directory-users .ps1” @params
.PARAMETER $FirstName
.PARAMETER $Initials
.PARAMETER $LastName 
.PARAMETER $ModifiedFullName
Modify Full name to add initials or reverse the order of first and last names
.PARAMETER $UserLogonName 
.PARAMETER $Password

#>

param($FirstName,$Initials,$LastName,$ModifiedFullName,$UserLogonName,$Password)
"Creating user $UserLogonName..."

  

Creating/Editing Plan

Click Plans > Click Create Orchestration Plan > Enter plan name > Click Create Plan > Click plan to edit

Calling the Script in a Plan

After writing a script and saving it as an asset, you can now invoke it by dragging and dropping a PS Call operation into the plan editor. The first thing you’ll notice in the UI is that a PS Call operation is created for our script by name, and the operation description (or Synopsis) inputted is displayed as well.

After dropping a PS Call operation into the plan editor, you can also see that Otter has automatically created inputs for the Parameters set earlier. These changes in the UI precisely reflect the documentation and parameters added to the script, thus guiding you through the use of PS scripts in an easy and intuitive way.

When we save and run our plan we can see the Log output of the script being called from the assets and being run with the information that we filled in the fields with.