How to map network drive using credentials in windows using UiPath.
Hi @Arun_Singh
The following thread contains some information aligned with your requirement:
You can also refer this video:
Hope this helps,
Best Regards.
I have referred the same video, however I didnât received any exception and the network drive was also not mapped.
Please give the following a try:
- Use a âInvoke PowerShellâ activity.
- In the properties, set the following values:
CommandText: "New-PSDrive -Name Z -PSProvider FileSystem -Root \\server\share -Credential mydomain\myusername"
IsScript: True
- Use another âInvoke PowerShellâ activity & in the properties panel, set the following values:
CommandText: "Exit-PSSession"
IsScript: True
- Save and run the workflow. The network drive should be mapped with the specified credentials.
Hope this helps,
Best Regards.
Getting this error message:
22.10.4+Branch.support-v22.10.Sha.b4be88e3b45fb05c4bcd71885c763d4f2095f959 Source: Invoke Power Shell (Throw) Message: Cannot process argument transformation on parameter âCredentialâ. A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials. Exception Type: System.Management.Automation.ParameterBindingArgumentTransformationException System.Management.Automation.ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter âCredentialâ. A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials. â> System.Management.Automation.Host.HostException: A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials. at System.Management.Automation.Internal.Host.InternalHostUserInterface.ThrowPromptNotInteractive(String promptMessage) at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForCredential(String caption, String message, String userName, String targetName, PSCredentialTypes allowedCredentialTypes, PSCredentialUIOptions options) at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForCredential(String caption, String message, String userName, String targetName) at System.Management.Automation.CredentialAttribute.Transform(EngineIntrinsics engineIntrinsics, Object inputData) at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags) â End of inner exception stack trace â at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Looks like PowerShell command being invoked requires user interaction to provide credentials, but the process is running in a non-interactive mode, so it cannot provide the credentials.
Can you try modifying your PowerShell command to accept credentials in a non-interactive mode.
Best Regards.
- Assign UserName, Password, DriveLetter, and DrivePath to separate variables.
- Password must come within a single quote while assigning. eg - âWelsome$123â since PowerShell will restrict the â$â symbol.
- Invoke a power shell activity and include ânet use â+ DriveLetter +â: â+ DrivePath +â /user:itape"+ UserName +â "+ Password in CommandText property.
- IsScript property must be checked.
- TypeArgument property must be a string.
@Janet_Caroline1 Thank you. Itâs working for me
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.