Invoke Powershell issue after update to 22.4

Hi all,

At the moment we are experiencing some issues with invoke Powershell after updating Studio to 22.4. Before the update all scripts were working fine. It only occurs on Studio, the QA machine that is updated to 22.4 has no problem.

Does anyone have an idea how to fix this issue? We have tried updating dependencies, restarting machines and reinstalling Studio.

One or more errors occurred

1 Like

Hi @Robin123

Any chance you could share the problematic workflow, or a zip of the dummy project that reproduces the issue?

Hi @loginerror ,

We use the following:

The sp_url is : “
The sp_path is: “Shared Documents/General/XXX Files/XXX/XX XX XXX”
The temp_directory is: C:\Users\XXXXX\Documents\UiPath\xxxxx\xxxxx\Data\Temp"

It could be due to some spaces in the Sharepoint paths, but we can’t find what is the issue. They were working fine in 21.4.


$sp_url = “URL”
$sp_path = “FOLDER”
$temp_directory = “TEMP”
$DownloadorUpload = “DOWNORUPLOAD”
$FileName = “FILENAME”

#Connecting to Sharepoint online through Client secrete key & Application ID
Connect-PnPOnline -Url $sp_url -ClientId “CLIENTID” -ClientSecret “SECRET” -warningAction ignore

#Checking for Download from sharepoint

If ($DownloadorUpload.ToUpper() -eq “DOWNLOAD”)

                    #Get the folder from sharePoint
		$Files = Get-PnPFolderItem -FolderSiteRelativeUrl $sp_path -ItemType File
                    #Get the each file from sharePoint folder
		foreach($File in $Files) 
                         Try {   
			#Downloading the files from  sharepoint
			  	Get-PnPFile -Url $File.ServerRelativeUrl -Path $temp_directory -FileName $File.Name -AsFile
    		    #Setting the Status as false if not able to download 
    		    $Status = "False"


We use the Invoke Powershell as following:

Same issue now also on QA that was moved to 22.4 @loginerror

Windows event viewer gives the following last error: Engine state is changed from Available to Stopped.

update: tried without spaces in the paths, does not matter and gives the same error

Can you please check the behaviour by following the below steps?

  1. Invoke PowerShell 64bit using Invoke Process activity
  2. Once the PowerShell instance opens try running the PowerShell script manually in the PowerShell instance opened via UiPath.


Thank you for the extra context. Could you still confirm the version of the System activity package (and whether downgrading/upgrading this package fixes the faulty behaviour)?

Hi @Prashant_08 thanks for the reply, that is working fine with the script that is not working in UiPath directly

I have tried 21.4, 21.10 and 22.4 , all does not fix the behavior.

update: We know that the error is in: Get-PnPFile -Url $File.ServerRelativeUrl -Path $temp_directory -FileName $File.Name -AsFile

Wrote all variables as output and they look good (they work in ISE). One more thing we noticed, is when we ran the script twice, it was giving write errors in ISE. After putting -force behind the get-pnpfile command it was working fine , and then tried the same in UiPath where it is failing with and without -force

1 Like

Thanks for the detailed info. Our development team will look into this.

Thank you @alexandru

Please let me know in case you need more info.

After juggling a bit with the Pnp Powershell versions (were on 1.0.9, now 1.0.10 and 1.0.35 implemented) we get the following again:

Invoke Power Shell DownloadAll: PowerShell command errors:
Could not load type ‘Microsoft.Extensions.Logging.Abstractions.Internal.NullScope’ from assembly ‘Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60’.
Could not load type ‘Microsoft.Extensions.Logging.Abstractions.Internal.NullScope’ from assembly ‘Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60’.

@alexandru @loginerror We have compared the 22.4 dll with the 21.4 dll (where the scripts still work) and see there is a difference,


is there a way to replace the dll to try if that works?

update: tried to create a nupkg package from the “old” dll and implemented that in the project. gives the same error. Going back to 21.4 studio version solves the issue,moving to 22.4 again gives the error

Could it be related to this post, because the powershell command is trying to save the file to the temp folder? : UiPath Studio 2022.4.1 breaks local file access on my local robot through Assistant - #2 by Yoichi

1 Like

Hi @Robin123

Our team tested it out and came back with some extra information that might help you execute the script, please see below:

We managed to execute the script with the following changes:

  1. Authenticate with username and password.

    $SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force $Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword Connect-PnPOnline -Url $sp_url -Credentials $Cred

  2. After it finishes and the files are copied, an error is thrown (see below). The fix is to set the TypeArgument to String . This might be the error that occurs.

    Invoke Power Shell: Unable to cast object of type 'System.String' to type 'System.Management.Automation.PSObject'.

If the above doesn’t fix your problem:

  1. Make sure that the PS module used is compatible with the SharePoint version, the available modules are SharePointPnPPowerShellOnline, SharePointPnPPowerShell2019, SharePointPnPPowerShell2016, and SharePointPnPPowerShell2013.
  2. Install SharePoint Server 20xx Client Components SDK on the running machine.
  3. Send us both the Event Tracing file and the Studio Desktop log file so that we know exactly what the error is. Also, we need all the details about the context, e.g.: the SharePoint version, the complete script, any of the files that were copied, etc.
1 Like

Hi @loginerror ,

Thanks for the update.
Unfortunately we receive the same error with that script as well.

We use PnP.Powershell (last version 1.10.0) as the module because we are working with Sharepoint Online. Tried to install the Sharepoint Server 20XX client components but no luck.

The exact error is:
Invoke Power Shell: Could not load type ‘Microsoft.Extensions.Logging.Abstractions.Internal.NullScope’ from assembly ‘Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60’.

We are using Sharepoint Online and try to download some Excel files (cannot share them because they are confidential, but it can be any file).

See the code below (disabled everything except connecting, and that is giving the error.

$sp_url = "URL"
$sp_path = "FOLDER"
$temp_directory ="TEMP"
$DownloadorUpload = "DOWNORUPLOAD"
$FileName = "FILENAME"
$Password = "SECRET"
$UserName = "CLIENTID"

#Connecting to Sharepoint online through Client secrete key & Application ID
$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force 
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword 
Connect-PnPOnline -Url $sp_url -Credentials $Cred

#Checking for  Download from sharepoint

 If ($DownloadorUpload.ToUpper() -eq "DOWNLOAD")

                        #Get the folder from sharePoint
			#$Files = Get-PnPFolderItem -FolderSiteRelativeUrl $sp_path -ItemType File
                        #Get the each file from sharePoint folder
			#foreach($File in $Files) 
                             Try {   
				#Downloading the files from  sharepoint
    			  	#Get-PnPFile -Url $File.ServerRelativeUrl -Path $temp_directory -FileName $File.Name -AsFile
        		    #Setting the Status as false if not able to download 
        		    $Status = "False"

Last event properties in event viewer before it is stopped:

ProviderName=SharePoint NewProviderState=Started SequenceNumber=25 HostName=Default Host HostVersion=5.1.18362.2212 HostId=0e7807e9-1d0b-4a6d-9670-ab303d80d095 HostApplication=C:\Program Files\UiPath\Studio\net461\UiPath.Executor.exe 5ea11fda-1888-4e8e-b124-3be83d42ed41 _ _ PROCESSNAME.False.prf EngineVersion=5.1.18362.2212 RunspaceId=bc9e46d6-0094-4fbb-a4ec-e6366f25b4b8 PipelineId=2 CommandName= CommandType= ScriptName= CommandPath= CommandLine=

One more error I can see in the studio.project.log:

[WARN] [UiPath.Studio.Project.exe] [1] System.IO.IOException: Cannot locate resource ‘themes/icons.xaml’.
at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.get_ContentType()
at MS.Internal.WpfWebRequestHelper.GetContentType(WebResponse response)
at MS.Internal.WpfWebRequestHelper.GetResponseStream(WebRequest request, ContentType& contentType)
at System.Windows.ResourceDictionary.set_Source(Uri value)
at UiPath.Studio.Plugin.Workflow.Services.ActivityIconFinder.TryGetThemedActivitiesIconDictionary(String assemblyName)

1 Like

Update: we moved all invoke powershell scripts to a start process solution with using PowerShell directly so we are not dependent anymore on the activity itself


Just to close this topic, even though it was a while ago and a workaround was already found.

We’ve done some research and these are our findings:

PnP.PowerShell is a open-source, community supported module with no official documentation. The minimum version required to run the module is 7.2 of PowerShell Core. Importing the module does not cause an error, but due to cmdlets in the module including unapproved verbs, the module will not load any cmdlets.

Moreover, the module has known dependency conflicts with multiple required modules of PowerShell and even with the SharePoint Server Client Components SDK, causing the module to not be loaded.

Suggestion on the official community forum would be to use:

Install-Module -Name PnP.PowerShell -AllVersions -Force

This should allow PowerShell to choose a compatible version if it exists.

More information can be found at:


Also, on our end, the Invoke PowerShell activity will soon gain the option to select PowerShell execution mode, which might help here (but it is unfortunately not a guaranteed fix to this particular issue).

1 Like