1
00:00:02,540 --> 00:00:06,940
In this demo we will see how to clear registry keys and values without

2
00:00:06,940 --> 00:00:11,740
deleting it using Clear‑Item and Clear‑ItemProperty command.

3
00:00:11,740 --> 00:00:12,100
Next,

4
00:00:12,100 --> 00:00:15,790
we will see how to completely delete registry keys and values

5
00:00:15,790 --> 00:00:19,530
using Remove‑Item and Remove‑ItemProperty command.

6
00:00:19,530 --> 00:00:24,430
In this demo we will see how to clear the registry keys and values.

7
00:00:24,430 --> 00:00:25,240
First,

8
00:00:25,240 --> 00:00:30,640
I'll show you how to clear a property value using Clear‑ItemProperty command.

9
00:00:30,640 --> 00:00:31,490
Before that,

10
00:00:31,490 --> 00:00:34,980
I'll run get ItemProperty command to check the value of

11
00:00:34,980 --> 00:00:41,040
OldInstallPath property that resides under App2 registry key.

12
00:00:41,040 --> 00:00:45,040
We can see that the value is set to C:\Temp.

13
00:00:45,040 --> 00:00:48,740
Now, I'll run Clear‑ItemProperty command.

14
00:00:48,740 --> 00:00:53,440
Here you will have to provide the path in the Path parameter.

15
00:00:53,440 --> 00:00:59,840
I'll enter App2, as the property that we are clearing resides under this key.

16
00:00:59,840 --> 00:01:03,260
In the Name parameter, I'll enter property name which

17
00:01:03,260 --> 00:01:06,740
is, in our case, is OldInstallPath.

18
00:01:06,740 --> 00:01:12,190
I'll hit Enter and execute the command. Again when I can Get‑ItemProperty

19
00:01:12,190 --> 00:01:17,640
command, we can see that the value has been cleared.

20
00:01:17,640 --> 00:01:22,340
Next, I will delete this property using Remove‑ItemProperty command.

21
00:01:22,340 --> 00:01:26,060
This will not only remove the value but will completely delete the

22
00:01:26,060 --> 00:01:30,760
property from the registry key. Since the command syntax is same,

23
00:01:30,760 --> 00:01:33,590
I'll just replace Clear‑ItemProperty command with

24
00:01:33,590 --> 00:01:37,740
Remove‑ItemProperty and execute the command.

25
00:01:37,740 --> 00:01:41,960
Now when I run Get‑ItemProperty command we get an error stating

26
00:01:41,960 --> 00:01:45,340
that OldInstallPath property does not exist.

27
00:01:45,340 --> 00:01:48,840
That's because it was deleted in the previous step.

28
00:01:48,840 --> 00:01:52,740
We will now see how we can clear and delete the registry key.

29
00:01:52,740 --> 00:01:55,810
Clear‑ltem will not delete the registry key, but it

30
00:01:55,810 --> 00:01:58,140
will just remove its content.

31
00:01:58,140 --> 00:02:00,920
I'll first run Clear‑Item command.

32
00:02:00,920 --> 00:02:05,640
I need to provide the complete path of the registry that I wish to clear.

33
00:02:05,640 --> 00:02:10,340
Here I'll enter .\App2\ and hit Enter.

34
00:02:10,340 --> 00:02:14,740
When I switch to registry console and do a refresh, we can see

35
00:02:14,740 --> 00:02:18,830
that all the contents of App2 registry key are cleared, and

36
00:02:18,830 --> 00:02:22,040
only the default entry remains.

37
00:02:22,040 --> 00:02:25,540
I will now show you how we can delete the registry key.

38
00:02:25,540 --> 00:02:30,490
We will delete the App2 registry key using Remove‑Item command. In

39
00:02:30,490 --> 00:02:35,410
the Path parameter I'll enter App2. You can also add Confirm

40
00:02:35,410 --> 00:02:38,540
parameter while deleting the registry key.

41
00:02:38,540 --> 00:02:41,940
This will prompt you to confirm before deleting.

42
00:02:41,940 --> 00:02:47,440
As of now, I'll remove the Confirm parameter and proceed with deleting the key.

43
00:02:47,440 --> 00:02:51,220
As soon as I had to Enter, the registry key gets deleted.

44
00:02:51,220 --> 00:03:02,000
When we switch to registry console and do a refresh, we can see that the App2 key, along with its properties, is now deleted.

