I tried this for a long time – here my solution. If you have a NAS Drive with its owns NAS Users and Rights. You need to give the Credentials with your Powershell script to get your NAS Drive mapped to your Fileexplorer.

With Command Prompt you achive this with:

With Powershell its more complicated:

Execute this with your Normal User not elevated Rights (Run as Admin)

I have tested this Script with Windows 10 Pro, it should work with Server 2012 R2 and Server 2016