get-psdrive not listing network drives in admin mode

Welcome Forums General PowerShell Q&A get-psdrive not listing network drives in admin mode

This topic contains 3 replies, has 3 voices, and was last updated by

1 year ago.

  • Author
  • #89290

    Points: 0
    Rank: Member

    If I use PowerShell with get-psdrive or even the good old Net Use command it works fine and lists the local PC's network drives.
    If I Run PowerShell as Administrator neither command lists the network drives and get-psdrive only lists the local drives.
    Tested this with Windows 10 (10.0.14393 LTSB) and Windows Server 2012 R2 (6.3.9600) with GPO mapped drives.
    Just tested on Windows 10 pro insider preview (10.0.17046.1000) this is in a workgroup and drives mapped through file explorer with same issue when PowerShell elevated.

  • #89296

    Points: 270
    Helping Hand
    Rank: Contributor

    Are you really sure that you have a network drive in your administrative session? If I'm not wrong you will have to map a network drive before you're able to use it. I would recommend to use unc paths anyway.

  • #89303

    Points: 0
    Rank: Member

    From the help file

    Get-PSDrive cmdlet gets the following types of drives in the current session:
    – Windows logical drives on the computer, including drives mapped to network shares.
    – Drives exposed by Windows PowerShell providers (such as the Certificate:, Function:, and Alias: drives) and the HKLM: and HKCU: drives that are exposed by the Windows PowerShell Registry provider.
    – Session-specified temporary drives and persistent mapped network drives that you create by using the New-PSDrive cmdlet.

    From PowerShell v3 onwards if you use the -Persist parameter with New-PsDrive then mapped network drives will be visible between PowerShell sessions

    How did you create the mapped drives?

  • #89309

    Points: 0
    Rank: Member

    Thanks for quick response.
    Network drives are already mapped via group policy and accessible from file explorer and cmd prompt.
    Network drives can be listed from PowerShell console and ISE but not if either Run as Administrator. If PowerShell console or ISE run as administrator neither get-psdrive or "Net User" list the network drives.
    "Welcome to the Twilight Zone"

The topic ‘get-psdrive not listing network drives in admin mode’ is closed to new replies.