UNC path New-PSDrive script with -Credential not working

Sarath,

Welcome to the forums.
when you post code, error messages, sample data or console output format it as code, please.

Here you can read how that works: Guide to Posting Code.

You can go back and edit your existing post. You don’t have to create a new one. :wink:

Thanks in advance.

If that’s a daily task I’d consider to set up a scheduled task and set it up to run this task with the credentials you need to access the remote server. This way you don’t need to care about the credentials inside the script and you can use UNC paths instead of error prone drive letters.

Regardless of that: Windows Server 2008R2 is out of support for more than 1 year. You should urgently update to a supported version.

1 Like