# \#invoke-powershell

**URL:** https://forum.uipath.com/tag/invoke-powershell/1568.md

[Últimos](https://forum.uipath.com/latest.md) · [Categorias](https://forum.uipath.com/categories.md) · [Tags](https://forum.uipath.com/tags.md)

---

## [Invocar PowerShell - Um erro ocorreu que o PowerShell não consegue lidar. Uma sessão remota pode ter terminado](https://forum.uipath.com/t/invoke-power-shell-an-error-occured-with-powershell-cannot-handle-a-remote-session-might-have-ended/5764707)

<div class="topic-metadata">

**Author:** [@maziz17j](https://forum.uipath.com/u/maziz17j)\
**Respostas:** 1\
**Última atualização:** [Julho 28, 2026, 6:19pm UTC](https://forum.uipath.com/t/invoke-power-shell-an-error-occured-with-powershell-cannot-handle-a-remote-session-might-have-ended/5764707 "2026-07-28T18:19:23Z")

</div>

Olá a todos. Desde a noite passada, alguns dos meus projetos que usam a mesma atividade de invocação do PowerShell no início falharam ao serem executados pelo Assistant, e após investigar hoje, parece que é um i…

---

## [Mapeando Unidade de Rede - Problemas Consistentes](https://forum.uipath.com/t/mapping-network-drive-consistent-issues/5759045)

<div class="topic-metadata">

**Author:** [@chowden](https://forum.uipath.com/u/chowden)\
**Respostas:** 3\
**Última atualização:** [Julho 7, 2026, 2:54pm UTC](https://forum.uipath.com/t/mapping-network-drive-consistent-issues/5759045 "2026-07-07T14:54:30Z")

</div>

Na nossa configuração, o robô faz login em uma máquina virtual Win11 com sua conta principal e, em seguida, possui credenciais específicas do processo para realizar as automações. Para mapear unidades de rede que podem ser acessadas apenas pelo processo…

---

## [Como executar uma consulta do PowerShell no Studio](https://forum.uipath.com/t/how-to-run-powershell-query-in-studio/5724528)

<div class="topic-metadata">

**Author:** [@Mathkar\_kunal](https://forum.uipath.com/u/Mathkar_kunal)\
**Respostas:** 2\
**Última atualização:** [Fevereiro 27, 2026, 2:32pm UTC](https://forum.uipath.com/t/how-to-run-powershell-query-in-studio/5724528 "2026-02-27T14:32:21Z")

</div>

Olá, tenho a seguinte consulta do cmd - dsquery \* domainroot -filter “(&(objectCategory=User)(sAMAccountName=“kmathkar”))” -attr cn que funciona no cmd e também funciona ao abrir o cmd usando o UiPath, mas o problema é quando estou s…

---

## [Como escrever o comando /pass no Invoke PowerShell](https://forum.uipath.com/t/how-to-write-pass-command-in-invoke-power-shell/5724334)

<div class="topic-metadata">

**Author:** [@Mathkar\_kunal](https://forum.uipath.com/u/Mathkar_kunal)\
**Respostas:** 5\
**Última atualização:** [Fevereiro 27, 2026, 6:05am UTC](https://forum.uipath.com/t/how-to-write-pass-command-in-invoke-power-shell/5724334 "2026-02-27T06:05:16Z")

</div>

Olá, não quero abrir o cmd e digitar o comando usando o UiPath. Em vez disso, preciso executá-lo diretamente usando o Invoke PowerShell e obter a saída. Suponha que meu comando seja -xyz. Então, como posso passá-lo diretamente para o Invoke PowerShell?

---

## [Como executar um script Python no UiPath usando a atividade Invoke Code?](https://forum.uipath.com/t/how-to-invoke-a-python-script-in-uipath-using-invoke-code-activity/2856425)

<div class="topic-metadata">

**Author:** [@voranir](https://forum.uipath.com/u/voranir)\
**Respostas:** 10\
**Última atualização:** [Junho 19, 2025, 8:57pm UTC](https://forum.uipath.com/t/how-to-invoke-a-python-script-in-uipath-using-invoke-code-activity/2856425 "2025-06-19T20:57:45Z")

</div>

Olá, Quero invocar um script Python com parâmetros de entrada (string, int etc.). Como faço para invocá-lo usando a atividade Invoke Powershell no UiPath? Estou usando a versão mais recente do Python e não quero usar Invoke Python s…

---

## [Powershell command to choose default apps by file type?](https://forum.uipath.com/t/powershell-command-to-choose-default-apps-by-file-type/716202)

<div class="topic-metadata">

**Author:** [@rishiathawale](https://forum.uipath.com/u/rishiathawale)\
**Respostas:** 2\
**Última atualização:** [Março 18, 2025, 7:13am UTC](https://forum.uipath.com/t/powershell-command-to-choose-default-apps-by-file-type/716202 "2025-03-18T07:13:05Z")

</div>

Hi All, By default the .CSV file is getting opened in Excel file. I want to change the by default app for .CSV to Notepad and vice versa Want to perform this action at the start of bot and end of bot using powershe…

---

## [「PowerShellの呼び出し」アクティビティのエラー](https://forum.uipath.com/t/powershell/716237)

<div class="topic-metadata">

**Author:** [@furukawa\_h](https://forum.uipath.com/u/furukawa_h)\
**Respostas:** 5\
**Última atualização:** [Fevereiro 8, 2024, 2:47am UTC](https://forum.uipath.com/t/powershell/716237 "2024-02-08T02:47:10Z")

</div>

OSバージョンを「Windows-レガシ」から「Windows」に変換する機能を利用したのですが、 以下のエラーが発生してしまいます。 対処方法についてご存じの方がいらっしゃいましたら、教えてください。 ■事象 レガシープロジェクトからWindowsプロジェクトに変換後、「PowerShellの呼び出し」アクティビティでエラーが発生する。 ■エラー内容 “message”: “PowerShell を呼び出し: The ‘E…

---

## [Invoke power shell issue, want to map network drive with credentials](https://forum.uipath.com/t/invoke-power-shell-issue-want-to-map-network-drive-with-credentials/569172)

<div class="topic-metadata">

**Author:** [@Matt67](https://forum.uipath.com/u/Matt67)\
**Respostas:** 6\
**Última atualização:** [Janeiro 8, 2024, 2:55pm UTC](https://forum.uipath.com/t/invoke-power-shell-issue-want-to-map-network-drive-with-credentials/569172 "2024-01-08T14:55:57Z")

</div>

Hello, I try to map network drive dynamically with credentials taken from orchestrator ( Get Credential activity ) for security purposes. I have Invoke Power shell activity in Windows project and put this inside $dri…

---

## ["Invoke Power Shell: Cannot retrieve the dynamic parameters for the cmdlet."](https://forum.uipath.com/t/invoke-power-shell-cannot-retrieve-the-dynamic-parameters-for-the-cmdlet/671571)

<div class="topic-metadata">

**Author:** [@pere](https://forum.uipath.com/u/pere)\
**Respostas:** 1\
**Última atualização:** [Janeiro 4, 2024, 11:05am UTC](https://forum.uipath.com/t/invoke-power-shell-cannot-retrieve-the-dynamic-parameters-for-the-cmdlet/671571 "2024-01-04T11:05:13Z")

</div>

I’m attaching a project with a whole number of different commands that will fail. The last one, “Set-PSRepository”, that will throw a "Invoke Power Shell: Cannot retrieve the dynamic parameters for the cmdlet. The t…

---

## [Invoke Power Shell with command "Get-PSRepository" throws unrelated? error](https://forum.uipath.com/t/invoke-power-shell-with-command-get-psrepository-throws-unrelated-error/671545)

<div class="topic-metadata">

**Author:** [@pere](https://forum.uipath.com/u/pere)\
**Respostas:** 1\
**Última atualização:** [Janeiro 4, 2024, 10:57am UTC](https://forum.uipath.com/t/invoke-power-shell-with-command-get-psrepository-throws-unrelated-error/671545 "2024-01-04T10:57:22Z")

</div>

Look at the attached screenshot. Trying to run “Get-PSRepository” without any parameters trows this error: Invoke Power Shell: The term ‘PackageManagement\\Get-PackageSource’ is not recognized as a name of a cmdlet, fu…

---

## [Invoke Power Shell activity randomly missing buttons on the command input text box](https://forum.uipath.com/t/invoke-power-shell-activity-randomly-missing-buttons-on-the-command-input-text-box/649511)

<div class="topic-metadata">

**Author:** [@pere](https://forum.uipath.com/u/pere)\
**Respostas:** 1\
**Última atualização:** [Janeiro 4, 2024, 10:47am UTC](https://forum.uipath.com/t/invoke-power-shell-activity-randomly-missing-buttons-on-the-command-input-text-box/649511 "2024-01-04T10:47:17Z")

</div>

At least in this activity (in could be happening with other activities, also), some controls for opening the big text editor (“\<\>”) or for choosing a variable (“+”) for the “Command” input text box randomly are present o…

---

## [Invoke PowerShell with ActiveDirectory module not working](https://forum.uipath.com/t/invoke-powershell-with-activedirectory-module-not-working/497509)

<div class="topic-metadata">

**Author:** [@Daniel\_Caldararu](https://forum.uipath.com/u/Daniel_Caldararu)\
**Respostas:** 6\
**Última atualização:** [Dezembro 19, 2022, 1:48pm UTC](https://forum.uipath.com/t/invoke-powershell-with-activedirectory-module-not-working/497509 "2022-12-19T13:48:14Z")

</div>

Hello, I’m trying to interrogate a user on AD by using the activity Invoke Power Shell but without any luck. If I try to apply this command under PowerShell directly it will work (after I import or will auto-import once…

---

## [Invoke Powershell Activity stays in Running state](https://forum.uipath.com/t/invoke-powershell-activity-stays-in-running-state/615361)

<div class="topic-metadata">

**Author:** [@Tusharkanta\_Panda](https://forum.uipath.com/u/Tusharkanta_Panda)\
**Respostas:** 1\
**Última atualização:** [Outubro 2, 2023, 9:02am UTC](https://forum.uipath.com/t/invoke-powershell-activity-stays-in-running-state/615361 "2023-10-02T09:02:34Z")

</div>

I am using this script below to imitate a flexible save file scenario and the code works fine in PowerShell console, but when I am trying to run it through invoke PowerShell activity it keeps on running without any outpu…

---

## [Casting Type Error](https://forum.uipath.com/t/casting-type-error/534140)

<div class="topic-metadata">

**Author:** [@john.mari](https://forum.uipath.com/u/john.mari)\
**Respostas:** 9\
**Última atualização:** [Julho 31, 2023, 3:25pm UTC](https://forum.uipath.com/t/casting-type-error/534140 "2023-07-31T15:25:14Z")

</div>

Hi, I am using Invoke Powershell activity to Connect Teams and retrieve unassigned telephone number. But, while running the code I am facing a type casting error says: Invoke Power Shell: Unable to cast object of type…

---

## [Set automatic reply on mailbox using Powershell set-mailboxautoreplyconfiguration cmdlet](https://forum.uipath.com/t/set-automatic-reply-on-mailbox-using-powershell-set-mailboxautoreplyconfiguration-cmdlet/562879)

<div class="topic-metadata">

**Author:** [@r.wall](https://forum.uipath.com/u/r.wall)\
**Respostas:** 0\
**Última atualização:** [Julho 13, 2023, 12:33am UTC](https://forum.uipath.com/t/set-automatic-reply-on-mailbox-using-powershell-set-mailboxautoreplyconfiguration-cmdlet/562879 "2023-07-13T00:33:20Z")

</div>

Hello, I’m trying to set and out of office reply on a mailbox using the following powershell script in UiPath: import module exchange online try { Import-Module ExchangeOnlineManagement $Message = “ExchangeOnline m…

---

## [Invoke Power Shell: Unable to cast object to type 'System.IO.FileInfo' to type 'System.String'](https://forum.uipath.com/t/invoke-power-shell-unable-to-cast-object-to-type-system-io-fileinfo-to-type-system-string/547336)

<div class="topic-metadata">

**Author:** [@Suraj\_Soman](https://forum.uipath.com/u/Suraj_Soman)\
**Respostas:** 1\
**Última atualização:** [Maio 23, 2023, 4:33am UTC](https://forum.uipath.com/t/invoke-power-shell-unable-to-cast-object-to-type-system-io-fileinfo-to-type-system-string/547336 "2023-05-23T04:33:16Z")

</div>

Hi, I was using ‘Invoke Power Shell’ activity, it works fine most of the times, but sometimes it throws any of the below three error messages. Invoke Power Shell: Unable to cast object to type ‘System.IO.FileInfo’ to …

---

## [How to install and call Powershell Module in 2023.4 vs older version?](https://forum.uipath.com/t/how-to-install-and-call-powershell-module-in-2023-4-vs-older-version/545045)

<div class="topic-metadata">

**Author:** [@tomas.monsen.mtg](https://forum.uipath.com/u/tomas.monsen.mtg)\
**Respostas:** 1\
**Última atualização:** [Maio 15, 2023, 3:11pm UTC](https://forum.uipath.com/t/how-to-install-and-call-powershell-module-in-2023-4-vs-older-version/545045 "2023-05-15T15:11:18Z")

</div>

Hello I have recently upgraded to Studio 2023.4. After this, my Invoke-Powershell does not work. I have Powershell 5.x on my machine. In this version I have installed module PnP.PowerShell using “Install-Module” and s…

---

## [Invoke Power Shell returns wrong encoding value](https://forum.uipath.com/t/invoke-power-shell-returns-wrong-encoding-value/543110)

<div class="topic-metadata">

**Author:** [@PythonDev85](https://forum.uipath.com/u/PythonDev85)\
**Respostas:** 10\
**Última atualização:** [Maio 15, 2023, 9:42am UTC](https://forum.uipath.com/t/invoke-power-shell-returns-wrong-encoding-value/543110 "2023-05-15T09:42:19Z")

</div>

Hi, I’m using an Invoke Power Shell activity to run a Python script. This script outputs multiple values that I have to use in a For Each activity later on. Everything works fine, except one detail : I get the wrong en…

---

## [Issue with Writing Logs to File Using the 'Invoke PowerShell' Activity in UiPath](https://forum.uipath.com/t/issue-with-writing-logs-to-file-using-the-invoke-powershell-activity-in-uipath/525106)

<div class="topic-metadata">

**Author:** [@Tuannna1](https://forum.uipath.com/u/Tuannna1)\
**Respostas:** 4\
**Última atualização:** [Março 11, 2023, 7:27am UTC](https://forum.uipath.com/t/issue-with-writing-logs-to-file-using-the-invoke-powershell-activity-in-uipath/525106 "2023-03-11T07:27:12Z")

</div>

Hi everyone, @Yoichi I am trying to write logs to a file when using the “Invoke PowerShell” activity, but I have not been successful so far. $logFilePath = "E:\\Test\\log.txt" $FolderPath = "E:\\UiPath" Start-Transcript…

---

## [How To Execute PowerShell Script with Dynamic Variables](https://forum.uipath.com/t/how-to-execute-powershell-script-with-dynamic-variables/493391)

<div class="topic-metadata">

**Author:** [@Zehra](https://forum.uipath.com/u/Zehra)\
**Respostas:** 3\
**Última atualização:** [Dezembro 2, 2022, 6:30am UTC](https://forum.uipath.com/t/how-to-execute-powershell-script-with-dynamic-variables/493391 "2022-12-02T06:30:33Z")

</div>

Hello everyone, I have two dynamic variables, I want to use invoke powershell activity as an anternative way of active directory acitivities how can I run this script in UiPath invoke powershell activity? Do you have a…

---

## [Getting following error while trying to run the process (Process attached). This was working fine when I created it, after reopening it is giving error. Anyone faced such issue before?](https://forum.uipath.com/t/getting-following-error-while-trying-to-run-the-process-process-attached-this-was-working-fine-when-i-created-it-after-reopening-it-is-giving-error-anyone-faced-such-issue-before/489232)

<div class="topic-metadata">

**Author:** [@Harsha\_Tiwari](https://forum.uipath.com/u/Harsha_Tiwari)\
**Respostas:** 4\
**Última atualização:** [Novembro 11, 2022, 8:14am UTC](https://forum.uipath.com/t/getting-following-error-while-trying-to-run-the-process-process-attached-this-was-working-fine-when-i-created-it-after-reopening-it-is-giving-error-anyone-faced-such-issue-before/489232 "2022-11-11T08:14:07Z")

</div>

Error ERROR Validation Error System.ArgumentException: Property ‘System.String ServiceName’ is not defined for type ‘System.ServiceProcess.ServiceController’ (Parameter ‘property’) Invoke PS.zip (2.5 KB)

---

## [Invoke Power Shell Windows long path prefix Bug](https://forum.uipath.com/t/invoke-power-shell-windows-long-path-prefix-bug/451288)

<div class="topic-metadata">

**Author:** [@MarekBruna](https://forum.uipath.com/u/MarekBruna)\
**Respostas:** 11\
**Última atualização:** [Setembro 3, 2022, 9:29am UTC](https://forum.uipath.com/t/invoke-power-shell-windows-long-path-prefix-bug/451288 "2022-09-03T09:29:20Z")

</div>

Windows has a path length limit of 260 characters a workaround for this is to use a \\\\?\\ prefix. Such a prefix works when using a regular PowerShell however using it in UiPath’s Invoke Power Shell activity it doesn’t see…

---

## [Run Powershell in UiPath by Oauth 2.0 to perform actions in Exchange online](https://forum.uipath.com/t/run-powershell-in-uipath-by-oauth-2-0-to-perform-actions-in-exchange-online/460670)

<div class="topic-metadata">

**Author:** [@ShekharRPA](https://forum.uipath.com/u/ShekharRPA)\
**Respostas:** 0\
**Última atualização:** [Julho 29, 2022, 8:28am UTC](https://forum.uipath.com/t/run-powershell-in-uipath-by-oauth-2-0-to-perform-actions-in-exchange-online/460670 "2022-07-29T08:28:30Z")

</div>

Hi Everyone, As we all know, Basic oauth 2.0 authentication is soon disable by Microsoft. Some of the projects i am using it to run in PowerShell. Now i want to use Oauth 2.0 to replace the basic auth. I extracted Clien…

---

## [PowerShell acticity does not return out Argument](https://forum.uipath.com/t/powershell-acticity-does-not-return-out-argument/443892)

<div class="topic-metadata">

**Author:** [@loirdiahmed](https://forum.uipath.com/u/loirdiahmed)\
**Respostas:** 2\
**Última atualização:** [Maio 30, 2022, 7:21pm UTC](https://forum.uipath.com/t/powershell-acticity-does-not-return-out-argument/443892 "2022-05-30T19:21:07Z")

</div>

Hi Everyone, I try to get a status from my script by calling the variable in Invoke PowerShell activity in PowerShellVariables pannel. In Powershell script the variable is named “Status” and in UiPath it is named “Stat…

---

## [Running powershell script as different user](https://forum.uipath.com/t/running-powershell-script-as-different-user/385568)

<div class="topic-metadata">

**Author:** [@Aditi\_Pareek1](https://forum.uipath.com/u/Aditi_Pareek1)\
**Respostas:** 2\
**Última atualização:** [Dezembro 27, 2021, 5:29am UTC](https://forum.uipath.com/t/running-powershell-script-as-different-user/385568 "2021-12-27T05:29:48Z")

</div>

How can I run powershell script as different user in UiPath

---

## [HOw to run power query from uipath](https://forum.uipath.com/t/how-to-run-power-query-from-uipath/381058)

<div class="topic-metadata">

**Author:** [@bpt.teja1996](https://forum.uipath.com/u/bpt.teja1996)\
**Respostas:** 1\
**Última atualização:** [Dezembro 22, 2021, 4:02pm UTC](https://forum.uipath.com/t/how-to-run-power-query-from-uipath/381058 "2021-12-22T16:02:44Z")

</div>

Hi all i have a Powerquery which will be executed manually now i need to execute that poer query using uipath how can we execute power query using uipath on excel

---

## [How to kill a process for current user with one line power shell code](https://forum.uipath.com/t/how-to-kill-a-process-for-current-user-with-one-line-power-shell-code/362602)

<div class="topic-metadata">

**Author:** [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Respostas:** 0\
**Última atualização:** [Novembro 18, 2021, 12:56pm UTC](https://forum.uipath.com/t/how-to-kill-a-process-for-current-user-with-one-line-power-shell-code/362602 "2021-11-18T12:56:28Z")

</div>

SCENARIO KILL PROCESS - plays a major role in all the enterprise level workflows especially with the process built using REFramework template, where we have a separate workflow either to kill all the open application. I…

---

## [Invoke Power Shell: This command cannot be run due to the error: The directory name is invalid](https://forum.uipath.com/t/invoke-power-shell-this-command-cannot-be-run-due-to-the-error-the-directory-name-is-invalid/327506)

<div class="topic-metadata">

**Author:** [@Mitchal\_Brown\_OMG](https://forum.uipath.com/u/Mitchal_Brown_OMG)\
**Respostas:** 3\
**Última atualização:** [Julho 6, 2021, 10:49pm UTC](https://forum.uipath.com/t/invoke-power-shell-this-command-cannot-be-run-due-to-the-error-the-directory-name-is-invalid/327506 "2021-07-06T22:49:52Z")

</div>

Hi all, I’m currently writing an automation that pulls data from a queue (an email address) and uses it as a parameter in a PowerShell script to update a security group. The PowerShell script needs to be run as a servic…

---

## [Unable to connect to remote server - HTTps activity or invoke powershell activity](https://forum.uipath.com/t/unable-to-connect-to-remote-server-https-activity-or-invoke-powershell-activity/314519)

<div class="topic-metadata">

**Author:** [@vikaram\_viki](https://forum.uipath.com/u/vikaram_viki)\
**Respostas:** 0\
**Última atualização:** [Maio 12, 2021, 12:27pm UTC](https://forum.uipath.com/t/unable-to-connect-to-remote-server-https-activity-or-invoke-powershell-activity/314519 "2021-05-12T12:27:57Z")

</div>

For few URls getting response as unable to connect to remote server using HTTps activity or invoke powershell activity in UiPath why?? how to handle this issue
