Invoke power shell issue, want to map network drive with credentials


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

$driveLetter $drivePath and $userName are String
$password is SecureString

“New-PSDrive -Name $driveLetter -PSProvider FileSystem -Root $drivePath -Credential (New-Object -TypeName System.Management.Automation.PSCredential $userName,$password) -Persist”

Error i get is : Invoke Power Shell: Cannot process argument transformation on parameter ‘Credential’. userName

looks like it works in Legacy project but not in windows project, can you provide support ?

Not a PowerShell expert, but are you missing open and close parenthesis for the PSCredential object?

 ... System.Management.Automation.PSCredential($userName,$password)) -Persist

not better, i also tried with -ArgumentList as we can see on the web.
It works in legacy project that’s an issue from UiPath side for me

Found another topic, where a PowerShell query did not work in Windows compatibility but does on Legacy: Windows Remote Connection from UiPath - Help / Activities - UiPath Community Forum -

@loginerror This on your radar?


to help other:
I’ve created a ticket and this is a known issue by UiPath team.
Planned to be solved for the 2023.10 version of UiPath ( coming for october)

Have a nice day

1 Like

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