I have an application which can execute a powershell script on remote windows machine. I am trying to map a network drive using a powershell script. When the same script executed at the endpoint, script works fine and able to map a network drive. But when the same script executed from my application, mapping a network drive done but as a disconnected network drive.
Now, my observations:
I found that My application is executing the script with NT Authority\System
account. May be because of this, mapped network drive is visible to a specific user as a disconnected drive. am I correct!!?
Now, the problem: What I can do to map a network drive available for all users? or Can I run my powershell script as a specific user, sothat drive will be mapped to that user only?
Anyhow, I have already tried running my powershell script as a different user from my application using Start-Process
and Invoke-Command
, it throws an error, says run winrm quickconfig
which also did not work.
Any help? Appreciated!!