Boris
Boris

Reputation: 8951

Create a virtual drive with PowerShell

I'm trying to create a D: drive in Windows, which points to some local directory (e.g. C:\DDrive) using PowerShell.

This code runs fine:

New-PSDrive -Name D -Root "C:\D_Drive\" -PSProvider "FileSystem"

But in the Windows Explorer no D:-drive is visible.

How does one use that command correctly? Also: the drive should be permanent, so I tried adding a "-Persist" parameter. But that leads to an error ("unknown parameter "-Persist"...").

Upvotes: 1

Views: 2731

Answers (2)

nemze
nemze

Reputation: 111

Just run:

subst D: "C:\D_Drive\"

in non-elevated PS session (don't run as Administrator).

Upvotes: 1

Mark Harwood
Mark Harwood

Reputation: 2415

The New-PSDrive command only creates a mapping that is visible in PowerShell. It's not shown in explorer at all.

Here are two other questions that ask the same thing:

https://community.spiceworks.com/topic/649234-powershell-mapped-drive-not-showing-in-my-computer

https://social.technet.microsoft.com/Forums/windowsserver/en-US/96222ba2-90f9-431d-b05a-82b804cdc76e/newpsdrive-does-not-appear-in-explorer?forum=winserverpowershell

Upvotes: 0

Related Questions