mapping new-psdrive to http location

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 4 months, 1 week ago.

  • Author
    Posts
  • #48231
    Profile photo of gad lev-ari
    gad lev-ari
    Participant

    hello,

    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

    thanks,

    gadla

  • #48246
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    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.