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.
@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
@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
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.
Thank you for your help in getting the scripting to work! you have helped me resolve issues before and are always helpful.
@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
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.