PowerShell Universal v4.0

PowerShell Universal

June 13, 2023

quote Discuss this Article

Today, we’re happy to announce the release of PowerShell Universal v4! You can download directly from the PowerShell Universal downloads page. Below, you’ll find the highlights.

Apps

Dashboards are now called Apps. This name change reflects the fact that you can display more than just data and can build full fledged web applications with PowerShell Universal. We’ve included aliases for all dashboard cmdlets so that your existing dashboards will continue to work.

App Designer

The new app designer allows you to visual create pages for your apps. You can add components and edit their properties directly from the designer. The designer outputs PowerShell script in the same way that you would author it yourself. The designer currently supports a subset of the components provided by PowerShell Universal.

For example, the above app would yield the following PowerShell script. You’ll notice that the app designer uses the grid layout system for positioning.

New-UDPage -Url "/Home" -Name "Home" -Content {
    New-UDAlert -Id '7b3889ed-5bc5-45a6-8c7e-9843a696c8fb' -Severity 'error' -Text 'Oh No!' -Title 'Error'
} -Generated -Layout (
    New-UDPageLayout -Large @(
        New-UDItemLayout -Id '7b3889ed-5bc5-45a6-8c7e-9843a696c8fb' -Row 0 -Column 0 -RowSpan 8 -ColumnSpan 12
    )
)

You can even define your own components in modules that will show up within the designer.

Live App Documentation

Live App Documentation is now included with the platform. You will be able to play with various components and view the code that was used to create them.

New and Updated Components

We’ve added and improved many of the components provided by PowerShell Universal.

New Components

Updated Components

Pages

We’ve decided to continue to provide the pages feature. Our original intention was to remove the feature in favor of the App Designer. We feel that App Designer is currently not a full replacement for Pages and will continue to support them through v4.

By the v5 time frame, we hope to have a much more complete App Designer with a migration tool for pages.

Event Hubs

Event Hubs provide the ability to connect client machines to a PowerShell Universal system and receive events directly from the platform. When an event is received, the client machine can execute a script with optionally provided data from the server.

Modules

APIs, Apps and Scripts can now be defined using modules and commands. Not only does this expand how resources can be defined within the platform, it also opens up the possibility of creating modules that provide their own resources. Modules have replaced the template functionality of PowerShell Universal v3.

We now provide a module gallery that allows you to install modules directly from the PowerShell Universal admin console or via PowerShellGet. Modules that contain PSU resources will be automatically imported into the platform. We’ve also created several modules that provide apps, custom components and examples you may wish to use in your own environment.

Some examples include:

ActiveDirectory

Active Directory tools built with PowerShell Universal. Reset passwords, restore deleted users, manage group membership and search for objects.

NetworkUtilities

Network utilities built with PowerShell Universal. Resolve DNS names, scan networks, and run speed tests.

PowerGUI

A PowerGUI Administrative Console clone made in PowerShell Universal.

Calendar

Calendar component for PowerShell Universal apps.

Contributing

Unlike templates, PowerShell Universal Modules are just PowerShell modules. You can create and publish your modules to the PowerShell Gallery with the PowerShellUniversal tag in order to expose your modules to other PowerShell Universal users.

All of our examples are open source and available here: https://github.com/ironmansoftware/universal-modules

HTTP Middleware

You can now use the middleware.ps1 file to define HTTP middleware in PowerShell. Middleware is executed on each request and allows you to add headers, content or return different status codes before the request is processed by the platform.

New-PSUMiddleware -Name 'Middleware' -ScriptBlock {
    param($HttpContext)
    $HttpContext.Response.Cookies.Append('X-Test', "Test")
    $true
}

Health Checks

Health checks now run against the PSU environment. Included are checks such as IIS settings, CPU and memory usage, PSScriptAnalyzer access and more.

Logging

Logging is now much more customizable. Instead of solely writing to the file system, logs are now written to a database. Logs are searchable from the new log viewer. You can filter by message, feature and resource. Logs for APIs and apps are pulled directly from the log table.

In addition to the standard logging configuration, you can now use logging targets such as TCP, HTTP and custom logging systems written with PowerShell. Each logging target can be scoped to a specific resource or feature to improve performance and help identify issues more easily.

Runtime Updates

PowerShell Universal is now built on PowerShell 7.3 and .NET 7.0. This means that you can use the latest features of PowerShell and .NET in your apps and APIs.

Version Support

With the release of PowerShell Universal v4, we will no longer support v2 of PowerShell Universal. PowerShell Universal v3 has entered stable designation and will continue to be supported and receive bug fixes and small feature updates. It will be supported until July 2024. PowerShell Universal v4 will be supported through July 2025.

Upgrading

You can upgrade to PowerShell Universal v4 by downloading the latest MSI and running the installer. If you are hosting in IIS, you will need to install the .NET 7.0 Windows Hosting Pack. As this is a major version upgrade, we recommend testing your upgrade in a development environment before running in production.

Breaking Changes