PowerShell 7 delegation with ScriptRunner

If you are using PowerShell to manage your environment today, there may be challenges with centralized management, auditing, versioning, and change control. ScriptRunner is a tool that helps manage PowerShell automation across your environment. In this post, we review the recently added new features and see how these enhance PowerShell automation across your environment.

There is no question that most organizations today use some form of automation to carry out routine IT operations within their environments. For Windows environments and even cross-platform environments, PowerShell has certainly become the scripting language of choice due to its integration, extensive modules, and ease of use.

However, there are challenges when organizations begin using PowerShell across the environment for automation. These include centralized management, change control, no effective testing of scripts, lack of versioning, and non-existent auditing of script execution across the environment.

ScriptRunner is a tool that allows IT admins to automate IT operations via PowerShell in a way that is manageable, controlled, versioned, audited, and simplified. In this review of ScriptRunner's new features, we will take a look at how these enhancements make the solution even more powerful.

New features in ScriptRunner ^

What new features have been added to ScriptRunner in 2020? The recent ScriptRunner release is the 2020PS7 Edition, Build 6.0.365.0. It adds support for the following:

  • PowerShell 7
  • PowerShell 7 Remoting via SSH
  • Office 365 extended service automation
  • Azure and cloud services connection enhancements with Azure Az
  • Additional PowerShell remoting enhancements via management/jump hosts
  • Multiple PSSession targets

Installation

The installation of ScriptRunner is fairly straightforward; however, you will not find that it is a "next, next, finish" type of operation. There are several components, requirements, and other details that you must give attention to for the solution to be set up and configured properly.

The PowerShell 7 components that are new with this release require additional configuration on top of the basic installation. It would be nice to see all these installation/configuration options packaged in a nice installation wizard instead of multiple configuration steps and installations. As seen below, there are several components included with the ScriptRunner installation.

ScriptRunner component installation

ScriptRunner component installation

As the product matures, it will be interesting to see whether the installation becomes a bit more consolidated and easier to configure. This is not a dealbreaker; however, it is a point worth noting about the solution.

PowerShell 7 and related enhancements

PowerShell 7 is the latest release from Microsoft of the cross-platform scripting language that not only works in Windows but also Linux and macOS environments. This new capability is due to the fact that PowerShell 7 is built on top of .NET Core, which is also a platform-independent runtime.

The cross-platform version of PowerShell, now with PowerShell 7, is certainly the way forward. Microsoft is committed to continuing to support PowerShell 5.1; however, any major new features are going to be found in the cross-platform version of PowerShell.

The latest version of ScriptRunner provides full integration with PowerShell 7 and supports automation and delegation scenarios with PowerShell 7 running in parallel with PowerShell 5.1.

One thing I noted with the PowerShell 7 option in ScriptRunner is that it is noted as "experimental." You can switch your actions over to using PowerShell 7 in ScriptRunner fairly easily. One nice point to note is that you don't have to install the full PowerShell 7 module on your server. Rather, you have to make sure you have the .NET Core 3.1.x release installed on your ScriptRunner server.

Installing .NET Core 3.1 Runtime on the ScriptRunner server

Installing .NET Core 3.1 Runtime on the ScriptRunner server

There are a couple of things you have to do with ScriptRunner to prepare it to use PowerShell 7. There is an included .ZIP file, PowerShell7\pwsh.zip, that must be extracted to the C:\Program Files\ScriptRunner\Service\Pwsh directory.

Once you have the files extracted to your ScriptRunner server, you can then change the actions available to use the PowerShell 7 host option. ScriptRunner allows you to do this for each individual action. In other words, you can choose to "flip the switch" only for certain actions to use PowerShell 7 instead of making a legacy PowerShell connection.

Changing to the PowerShell 7 option for a ScriptRunner action

Changing to the PowerShell 7 option for a ScriptRunner action

With PowerShell 7, you can also use SSH key files to connect with PowerShell remoting over SSH.

Configuring SSH key for PowerShell over SSH in PowerShell 7

Configuring SSH key for PowerShell over SSH in PowerShell 7

Office 365 and Azure enhancements

ScriptRunner not only allows you to target on-premises resources with your PowerShell scripts and actions, you can also target Office 365 and Azure. This allows you to interact with your cloud resources along with the on-premises resources that are available by setting up the target types in ScriptRunner.

Selecting target types, including Office 365 and Azure

Selecting target types, including Office 365 and Azure

This release of ScriptRunner allows integrating with Microsoft’s Power Automate. With Power Automate, you can streamline repetitive tasks and paperless processes to boost productivity, automate at scale, and build intelligent workflows.

Adding ScriptRunner to the mix allows IT operations teams to use Power Automate as a workflow engine, with ScriptRunner powering the PowerShell platform. By integrating ScriptRunner with Power Automate, teams can use ScriptRunner actions as "ready-made" code to perform tasks without the need to program custom WebAPI calls.

Additional Office 365 functionality, including the Exchange Online V2 module, has been integrated with ScriptRunner. This allows ScriptRunner to natively interact with Exchange Online via the latest procedure implemented by Microsoft.

ScriptRunner has now implemented an all-new module for interacting with Microsoft Teams. With this release, the connection and authentication with Microsoft Teams is handled by ScriptRunner. To interact with Microsoft Teams, you also need to install the PowerShell module for Microsoft Teams on your ScriptRunner server.

Managing Microsoft Teams with ScriptRunner

Managing Microsoft Teams with ScriptRunner

ScriptRunner has made enhancements with Microsoft Azure environments as well. With the new ScriptRunner release, you can make use of the Microsoft Azure Az module to connect and interact with your Azure environment. The new Az module is the new Azure module, which is now compatible with the cross-platform version of PowerShell Core.

The Azure Az module can now be used to connect to your Microsoft Azure environment

The Azure Az module can now be used to connect to your Microsoft Azure environment

Remoting via jump hosts

ScriptRunner introduces a new concept, called a distribution node, that allows bypassing the normal "double hop" method of connecting and running PowerShell. It is now possible to build a mixed-target environment where you can execute scripts on a remote target as well as access O365 or Azure from the same remote system.

Using a PS remoting jump host for session settings for a target

Using a PS remoting jump host for session settings for a target

Multiple targets with PSSession, PowerShell Direct extended

There have been additional enhancements with this release, including in PowerShell's ability to perform multitarget PSSessions. ScriptRunner can now take advantage of this natively. Also, ScriptRunner now features extended options when setting up a new PowerShell Remoting target. These include the following:

  • Hyper-V Direct
  • Container
  • CIM
New PowerShell remoting connection options in ScriptRunner

New PowerShell remoting connection options in ScriptRunner

Final thoughts and impressions ^

Overall, I like the workflow concept and tooling that ScriptRunner provides to IT administrators and IT operations teams that build their automation around PowerShell. ScriptRunner provides a streamlined, centralized management console that allows managing PowerShell across your environment in a single location with all the benefits of such, including auditing, versioning, change control, and more.

There are a couple of pain points with the solution, including the installation. Installing ScriptRunner is a bit cumbersome and includes a combination of many smaller "installations" of various components. Documentation with this solution is still very much lacking. I found the official ScriptRunner knowledge base to be very minimal in the information provided.

However, aside from those pain points, I think the solution has promise in consolidating PowerShell scripting across environments and building graphical workflows of automation using PowerShell. The auditing features are excellent, and the solution provides really great visibility into the automation activities going on across your environment.

ScriptRunner offers a free 30-day trial version of the software. You can check it out here.

3+
avataravatar

Join the 4sysops PowerShell group!

Your question was not answered? Ask in the forum!

1 Comment
  1. Andrew 4 months ago

    Anyone who is interested in central management, versioning, checks and distribution of PowerShell scripts, can find this https://github.com/ztrhgf/Powershell_CICD_repository free solution as very useful too.

    So did I smiley

    2+
    avatar

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account