Universal Automation v1.5.2

Universal Automation v1.5.2
Universal Automation v1.5.2


The ultimate platform for building web-based IT tools.

PowerShell APIs
Build REST APIs using PowerShell scripts. Accept parameters, return objects as JSON and serve files.

Universal provides the ability to define REST API endpoints using PowerShell. When the endpoints are executed by a compatible HTTP client, the PowerShell script will execute and return the result to the end user.

Execution Environment
The REST API execution environment runs in your default PowerShell version. Unlike Automation jobs, which can also be run via the Universal management API, APIs that you define are run in a single PowerShell process. Because the PowerShell process is not started and stopped for each call to the endpoint, the API is much faster.

Performance
Performance is relative to the hardware and network conditions that you are running Universal on. That said, in ideal conditions you can expect the Universal APIs to service about 500 requests per second. This is with an entirely empty endpoint so any script that you add to that endpoint will reduce the throughput. The reduction of throughput will depend on the cmdlets and script executed within the API endpoint.

Variables
There are a set of predefined variables that are available in API endpoints. You'll be able to use these variables in your scripts.

Accessing Secure Endpoints
Once you have defined a secure endpoint, you will need to provide authentication and authorization to access the endpoint.

PowerShell Universal provides the ability to rate limit requests made to the web server. Rate limiting can be configured on a per endpoint and per period. By default, the client IP address is used to rate limit clients.

Running a Script
You can run a script in the UI by click the Run button the Automation / Scripts page or by clicking View and then Run. In each case, you will be presented with the Run Dialog that allows you to select various settings for the job.

Feedback
Some jobs will require feedback. Any script that contains a Read-Host call will wait until there is user interaction with that job. The job will be in a Waiting for Feedback state and you can respond to that feedback by click the Response to Feedback button on the job page.

Call Scripts from Scripts
You can also call UA scripts from UA scripts. When running a job in UA, you don't need to define an app token or the computer name manually. These will be defined for you. You can just call Invoke-UAScript within your script to start another script. Both jobs will be shown in the UI. If you want to wait for the script to finish, use Wait-UAJob.

Waiting for a Script to Finished
You can use the Wait-UAJob cmdlet to wait for a job to finish. Pipe the return value of Invoke-UAScript to Wait-UAJob to wait for the job to complete. Wait-UAJob will wait indefinitely unless the -Timeout parameter is specified.

Return Pipeline Data
You can use the Get-PSUJobPipelineOutput cmdlet to return the pipeline output that was produced by a job. This pipeline output will be deserialized objects that were written to the pipeline during the job. You can access this data from where you have access to the PowerShell Universal Management API.

Scheduling a Job
To schedule a job, you can do so from the Automation / Schedules page and by clicking the New Schedule button. You can also schedule a script by click the Schedule option from the script's page.

Schedules can be defined based on simple selections like Every Minute or Every Hour or you can define CRON expressions yourself for more configurable schedules. You can also run One Time schedules that run once at a later date.

You can also define which user the scheduled job will run under as well as which PowerShell version to use.

Simple Schedules
Simple schedules are really just helpers for various standard CRON schedules. When you select one, it will define a CRON schedule for your.

CRON
CRON schedules use CRON expressions to define schedules. You can use a tool like Crontab guru to help define the schedule.

Triggers allow for automation jobs to be started when certain events happen within PowerShell Universal. For example, this allows you to take action when jobs complete, the server starts or dashboards stop. Triggers are useful for assigning global error handling or sending notifications when certain things happen.

Trigger Events
The following types of events can be assigned a trigger.
Job Started
Job Completed
Job Requesting Feedback
Job Failed
Dashboard Started
Dashboard Stopped
Server Started
Server Stopping

Running a Script as Another User
You can run scripts as another user by configuring secret variables. PowerShell Universal uses the Microsoft Secret Management module to integrate with secret providers. See variables for more information on secrets.

To run as another user, simply add or import a PSCredential variable. From there, you can select the credential from within the run dialog.

Environments allow you to define an executable, arguments, modules and variables to use when running scripts, hosting APIs and dashboards.

Information
Users of Guests are not allowed to comment this publication.