Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Managing Windows PowerShell Drives
In this articleA Windows PowerShell drive is a data store location that you can access like a file system drive in Windows PowerShell. The Windows PowerShell providers create some drives for you, such as the file system drives (including C: and D:), the registry drives (HKCU: and HKLM:), and the certificate drive (Cert:), and you can create your own Windows PowerShell drives. These drives are very useful, but they are available only within Windows PowerShell. You cannot access them by using other Windows tools, such as File Explorer or Cmd.exe. Windows PowerShell uses the noun, PSDrive, for commands that work with Windows PowerShell drives. For a list of the Windows PowerShell drives in your Windows PowerShell session, use the
Although the drives in the display vary with the drives on your system, the listing will look similar to the output of the File system drives are a subset of the Windows PowerShell drives. You can identify the file system drives by the FileSystem entry in the Provider column. (The file system drives in Windows PowerShell are supported by the Windows PowerShell FileSystem provider.) To see the syntax of the
The PSProvider parameter lets you display only the Windows PowerShell drives that are supported by a particular provider. For
example, to display only the Windows PowerShell drives that are supported by the Windows PowerShell FileSystem provider, type a
To view the Windows PowerShell drives that represent registry hives, use the PSProvider parameter to display only the Windows PowerShell drives that are supported by the Windows PowerShell Registry provider:
You can also use the standard Location cmdlets with the Windows PowerShell drives:
Adding New Windows PowerShell Drives (New-PSDrive)You can add your own Windows PowerShell drives by using the
To create a new Windows PowerShell drive, you must supply three parameters:
For example, you can create a drive named "Office" that is mapped to the folder that contains the Microsoft Office applications on your computer, such as
Note In general, paths are not case-sensitive. You refer to the new Windows PowerShell drive as you do all Windows PowerShell drives -- by its name followed by a colon ( A Windows PowerShell drive can make many tasks much simpler. For example, some of the most important keys in the Windows registry have extremely long paths, making them cumbersome to access and difficult to remember. Critical configuration information resides under
You can then change location to the cvkey: drive as you would any other drive:
or:
The New-PsDrive cmdlet adds the new drive only to the current Windows PowerShell session. If you close the Windows PowerShell window, the new drive is lost. To save a Windows PowerShell drive, use the Export-Console cmdlet to export the current Windows PowerShell session, and then use the PowerShell.exe PSConsoleFile parameter to import it. Or, add the new drive to your Windows PowerShell profile. Deleting Windows PowerShell Drives (Remove-PSDrive)You can delete drives from Windows PowerShell by using the For example, if you added the Office: Windows PowerShell drive, as shown in the
To delete the cvkey: Windows PowerShell drive, also shown in the
It's easy to delete a Windows PowerShell drive, but you can't delete it while you are in the drive. For example:
Adding and Removing Drives Outside Windows PowerShellWindows PowerShell detects file system drives that are added or removed in Windows, including network drives that are mapped, USB drives that are attached, and drives that are deleted by using either the net use command or the WScript.NetworkMapNetworkDrive and RemoveNetworkDrive methods from a Windows Script Host (WSH) script. FeedbackSubmit and view feedback for Which of the following items are likely to be displayed in the Notification Area of the computer running the Windows operating system?The notification area displays the programs running in the background and information such as the time and date, notifications, Internet connection status, and the current volume level. The notification area is also sometimes referred to as the system tray, systray, shell notification area, or taskbar status area.
Which Windows operating system include apps that use the Windows Store feature?Which operating system(s) include the following features? Windows 10 has the following new features: - Customizable Start Menu-- :Let's you organize your apps and shortcuts. - Microsoft Store-- Allows you to purchase music, videos, games, and apps.
Which of the following Windows files is the core of the operating system?The kernel is the core of the operating system that is loaded into memory when the system boots up. The kernel is responsible for controlling security, managing the file system, and providing a platformfor applications to run on.
Which component of Windows prompts the user for credentials or permission to minimize the dangers of unintended software installations?User Account Control (UAC) prompts the user for credentials or permissions in an effort to minimize the dangers of unwanted actions or unintended software installations. Windows firewall protects the system from network attacks.
|