- July 26, 2016 at 5:16 am #48231
I am trying to create a new-psdrive to http location, if I use net use there is no problem but when using
new-psdrive -name p -psprovider FileSystem 'http://fqdn/site' I get an error:
New-PSDrive : The specified drive root "http://fqdn/site" either does not exist, or it is not a folder.
how can I map to this location?
note: I had trouble connecting using net use while I was on an operating system other than client until I installed the desktop experience feature
gadlaJuly 26, 2016 at 12:26 pm #48246
I think that might be a bug (or intentional design) of the FileSystem provider in PowerShell. I've been poking through the code a bit with ILSpy, and it looks like it will only recognize UNC paths as network drives at the moment. (Technically it's using the Win32 function PathIsNetworkPath.)
I suspect that the "net use" command has some more capabilities that haven't made it into the PowerShell providers. I'll send a link to this thread to the MVP mailing list, see if anyone else knows more about it. In the meantime, just use "net use". 🙂 If it works, no problem! If it's not auto-mounting as a PSDrive after you use "net use", try this:
New-PSDrive -Name P -Provider FileSystem -Root 'P:\'
You must be logged in to reply to this topic.