Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

New-PSdrive fails in script, works at command line

$
0
0

If I RDP to ServerA (2008R2) as userB (Domain User) and open a PS (2.0) command window, I can successfully run:

New-PSdrive -Name "X" -PSProvider FileSystem -Root "\\MYSERVER\MyShare"

But if I RDP to ServerA and launch c:\scripts\myscript.ps1 from a PS window (myscript contains the same line of code), drive X: is not mapped!

Does the script run under different permissions?  Permissions on folder c:\Scripts are wide open: Everyone = Full Control.  The Scripts folder needs to reside in a location where all users can access it.

How do I get New-PSdrive to work in myscript?

thx


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>