1
00:00:02,140 --> 00:00:07,520
Removing a PS drive is quite easy. You can do so by just running the

2
00:00:07,520 --> 00:00:13,330
Remove‑PSDrive command and enter the name of the drive. First, I'll run

3
00:00:13,330 --> 00:00:20,450
Get‑PSDrive command, and we can see that apart from default drives, there

4
00:00:20,450 --> 00:00:24,240
are custom PS drives that we created earlier.

5
00:00:24,240 --> 00:00:30,110
I'll remove K drive using Remove‑PSDrive command. You can also mention

6
00:00:30,110 --> 00:00:37,240
multiple PS drives separated by comma. I'll now run Remove‑PSDrive command

7
00:00:37,240 --> 00:00:45,040
followed by drive names. I'll enter RootCA and PowershellCoreRegistry drives

8
00:00:45,040 --> 00:00:52,530
that we created and hit Enter. Next, I'll try to remove S drive that was

9
00:00:52,530 --> 00:00:55,940
created from PowerShell profile.

10
00:00:55,940 --> 00:00:59,010
We can see that the K drive, the rootCA drive,

11
00:00:59,010 --> 00:01:06,840
and the PowershellCoreRegistry drive got removed, but S drive still persists,

12
00:01:06,840 --> 00:01:09,960
that's because this drive was created from PowerShell

13
00:01:09,960 --> 00:01:13,840
profile, and hence, it won't be removed.

14
00:01:13,840 --> 00:01:19,150
Likewise, you cannot remove Windows physical and logical drives, so

15
00:01:19,150 --> 00:01:24,640
if I try to remove D and E drive and run Get‑PSDrive command, we

16
00:01:24,640 --> 00:01:27,740
can see these drives are still intact.

17
00:01:27,740 --> 00:01:32,440
You can also remove default drives using Remove‑PSDrive command.

18
00:01:32,440 --> 00:01:48,000
So when I try to remove alias HKCU and Temp drive, these drives will be removed. We can verify this by running Get‑PSDrive command.

