# Invoke PowerShell issues

**URL:** <https://forum.uipath.com/t/invoke-powershell-issues/167733>\
**Category:** Help\
**Tags:** powershell, studio, activities, error, system\
**Created:** [November 13, 2019, 5:22pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733 "2019-11-13T17:22:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![covcreo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/covcreo/32/65373_2.png) [@covcreo](https://forum.uipath.com/u/covcreo)\
**Post date:** [November 13, 2019, 5:22pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/1 "2019-11-13T17:22:40Z")

</div>

I have created a PowerShell script that does the renaming of files in folder. It works in PowerShell but, when I set it to invoke in UiPath I get an error. Again I am using this in PowerShell \> `(GCI \\my-server-name\d_box_1$\A0\*.pdf) | Rename-Item -NewName {$_.Name -replace "^","A0-"}` When I place it in UiPath Invoke PowerShell i get the error below.

 ![image](https://global.discourse-cdn.com/uipath/original/3X/c/9/c923fa8922c8fbbb836b7f03b122b329dc881b59.png)

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [November 13, 2019, 5:30pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/2 "2019-11-13T17:30:56Z")

</div>

@covcreo  
Have a try on this:  
“(GCI \my-server-name\d\_box\_1$\A0\*.pdf) | Rename-Item -NewName {$\_.Name -replace ‘^’,‘A0-’}”

Inner " were just replace with ’ so surrounding “” is kept

---

<div class="post-metadata">

**Author:** ![covcreo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/covcreo/32/65373_2.png) [@covcreo](https://forum.uipath.com/u/covcreo)\
**Post date:** [November 13, 2019, 5:49pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/3 "2019-11-13T17:49:32Z")

</div>

Does this mean I am missing a package?

 ![image](https://global.discourse-cdn.com/uipath/original/3X/8/a/8a68671ff1b992ae369a669baa815c4bc0ebcaf1.png)

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [November 13, 2019, 7:37pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/4 "2019-11-13T19:37:20Z")

</div>

@covcreo  
Lets Sort Out one by one.  
So First the Change from inner " to ’ was working, right?  
Now next Powershell does result with an Error. So my Interpretation would be that the Powershell does Not know the Commandlet and request to get it imported

---

<div class="post-metadata">

**Author:** ![covcreo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/covcreo/32/65373_2.png) [@covcreo](https://forum.uipath.com/u/covcreo)\
**Post date:** [November 13, 2019, 7:45pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/5 "2019-11-13T19:45:24Z")

</div>

Sorry I spoke too soon I did some digging and somehow stumbled across the fact that the default type argument needed to be changed thanks to the “”.

It works after changing to this.  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/6/a/6a6460e1e6d2983ec46e269021b918cdec42403a.png)

---

<div class="post-metadata">

**Author:** ![covcreo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/covcreo/32/65373_2.png) [@covcreo](https://forum.uipath.com/u/covcreo)\
**Post date:** [November 13, 2019, 7:47pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/6 "2019-11-13T19:47:09Z")

</div>

Thank you for your help in getting the scripting to work! you have helped me resolve issues before and are always helpful.

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [November 13, 2019, 7:55pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/7 "2019-11-13T19:55:36Z")

</div>

@covcreo  
Great news and Happy automation 🙂 . May i ask you to flag the solution post so Others from the Forum can IT identify more easy

---

<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:** [November 16, 2019, 7:55pm UTC](https://forum.uipath.com/t/invoke-powershell-issues/167733/8 "2019-11-16T19:55:37Z")

</div>

Closed on November 16, 2019, 7:55pm UTC

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