Tip: How to use the Current Version of PowerShell Core

The installation of UiPath Studio or Robot contains Microsoft PowerShell Core. On this way you can use PowerShell Core in Windows compatibility mode (x64) without additional software installation. The advantage of this approach is that the package contains all we need and we have nothing to do. UiPath delivers it and we can use it in our context. But we cannot always wait for the UiPath release updates to close known security leaks and vulnerabilities. It is our task to ensure security in our processes. Therefore it is possible to download the Microsoft.PowerShell.SDK via Manage Packages - with a fresh published date.

After the download and installation you can find the current Microsoft.PowerShell.SDK in the list of your dependencies of your project. This also has the advantage that the dependency is directly transparent in the project.json file - this is very good for analysis purposes.

image

A tiny test brings us very quick the desired result, with UiPath’s built-in Invoke PowerShell activity.

image

Here the Test.ps1 file:

#-Begin-----------------------------------------------------------------

"$($PSVersionTable.PSVersion) - $env:PROCESSOR_ARCHITECTURE"

#-End-------------------------------------------------------------------

We are responsible for our RPA processes to our customers - and its advocate, the Chief Information Security Officer (CISO). We must be aware of the use of additional libraries and know their dependencies, to ensure this aspect of security. PowerShell Core is a very powerful scripting language that can provide us with excellent support in automating business processes. Therefore, not only for security, but also for constantly improving functionality of PowerShell, the approach described here is certainly a valid one to keep PowerShell up to date.

Addendum 17.11.2022: This approach is deprecated, because it works only with Windows - Legacy compatibility mode.

5 Likes