# Powershell issue - interactive vs UiPath

**URL:** <https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487>\
**Category:** Studio\
**Tags:** activities-panel, question, studio, system, activities\
**Created:** [March 22, 2023, 1:40pm UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487 "2023-03-22T13:40:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gary.cobden](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gary.cobden/32/176873_2.png) [@gary.cobden](https://forum.uipath.com/u/gary.cobden)\
**Post date:** [March 22, 2023, 1:40pm UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487/1 "2023-03-22T13:40:26Z")

</div>

Afternoon folks

I have a simple Powershell script to extract information from Active Directory, which, before we upgraded our project from Windows Legacy to Windows was working without issue, and continues to work if we roll back to the original issue.

The script (saved as a .ps1 file) is as below  
Get-ADUser -Filter \* -properties EmailAddress -SearchBase $Container | Select-Object Name, SamAccountName, EmailAddress, DistinguishedName, Enabled | Export-Csv $FilePath -NoTypeInformation

with the parameters $Container and $FilePath either being included in the ps1 file or passed as parameters.

If I run the script in a Powershell window, it runs without issue

If I run it from the Invoke Powershell Activity, it fails and returns an error  
Invoke Power Shell: File C:\powershell\GetADUsersSubset1.ps1 cannot be loaded because running scripts is disabled on this system.

The execution policies are set as follows  
Scope ExecutionPolicy  
----- ---------------  
MachinePolicy Undefined  
UserPolicy Undefined  
Process Undefined  
CurrentUser Undefined  
LocalMachine Bypass

Any assistance appreciate please

Many thanks

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [March 22, 2023, 1:52pm UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487/2 "2023-03-22T13:52:11Z")

</div>

@gary.cobden

Please try running this in power shell by opening it as an admin …or run power shell in admin

Set-ExecutionPolicy RemoteSigned

Cheers

---

<div class="post-metadata">

**Author:** ![gary.cobden](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gary.cobden/32/176873_2.png) [@gary.cobden](https://forum.uipath.com/u/gary.cobden)\
**Post date:** [March 22, 2023, 2:02pm UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487/3 "2023-03-22T14:02:21Z")

</div>

Hi @Anil_G

The script runs fine if executed in Powershell directly; its running within UiPath that is the issue - thats when I get the error!

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [March 22, 2023, 2:03pm UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487/4 "2023-03-22T14:03:40Z")

</div>

@gary.cobden

Agreed…This is for checking if this remote setting would let UiPath run the power shell script

cheers

---

<div class="post-metadata">

**Author:** ![gary.cobden](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gary.cobden/32/176873_2.png) [@gary.cobden](https://forum.uipath.com/u/gary.cobden)\
**Post date:** [March 31, 2023, 9:15am UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487/5 "2023-03-31T09:15:34Z")

</div>

Following consultation with Support, turns out there is a bug in the Powershell Activity that needs to be fixed

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [April 3, 2023, 9:15am UTC](https://forum.uipath.com/t/powershell-issue-interactive-vs-uipath/528487/6 "2023-04-03T09:15:34Z")

</div>

Closed on April 3, 2023, 9:15am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
