1
00:00:02,240 --> 00:00:03,340
In this demo,

2
00:00:03,340 --> 00:00:06,260
we will create new registry key and properties using

3
00:00:06,260 --> 00:00:09,240
New‑Item and New‑ItemProperty command.

4
00:00:09,240 --> 00:00:12,840
We will then modify these registry keys and values.

5
00:00:12,840 --> 00:00:17,000
We will see how to change the value of property using Set‑ItemProperty

6
00:00:17,000 --> 00:00:21,240
command and how we can rename registry keys and values.

7
00:00:21,240 --> 00:00:24,970
We will now see how we can create new registry key and values.

8
00:00:24,970 --> 00:00:26,430
For this.

9
00:00:26,430 --> 00:00:30,580
I'll use New‑Item command to create a new registry key.

10
00:00:30,580 --> 00:00:35,260
Note that a registry is equivalent to a file or a folder that

11
00:00:35,260 --> 00:00:38,540
acts as a container to hold properties.

12
00:00:38,540 --> 00:00:42,630
So just like we use New‑Item command to create a file or a folder,

13
00:00:42,630 --> 00:00:45,200
I'll use it to create a registry key.

14
00:00:45,200 --> 00:00:50,540
Under HKLM:\Software I'll create App1 registry key.

15
00:00:50,540 --> 00:00:55,440
I'll hit Enter, and we can see the message that shows registry details.

16
00:00:55,440 --> 00:00:59,840
Now to create the property under this newly created registry key,

17
00:00:59,840 --> 00:01:05,170
I can either navigate to App1 key or create the property from here itself.

18
00:01:05,170 --> 00:01:07,850
For creating properties and their values,

19
00:01:07,850 --> 00:01:11,640
we must make use of New‑ItemProperty command.

20
00:01:11,640 --> 00:01:17,840
I'll enter the complete path, which is, in our case, .\SOFTWARE\App1.

21
00:01:17,840 --> 00:01:20,140
We will have to give it a name.

22
00:01:20,140 --> 00:01:23,240
For testing purpose, you can give any valid name.

23
00:01:23,240 --> 00:01:26,140
I'll name this property as InstallPath.

24
00:01:26,140 --> 00:01:29,140
I will then have to provide a value for this property,

25
00:01:29,140 --> 00:01:35,550
hence, I'll enter C:\ProgramFiles\App1, and hit Enter.

26
00:01:35,550 --> 00:01:40,940
This will create the registry property with its values.

27
00:01:40,940 --> 00:01:44,140
It's not mandatory that you enter the value of a property,

28
00:01:44,140 --> 00:01:46,690
as this value can also be set to null.

29
00:01:46,690 --> 00:01:48,340
To test this,

30
00:01:48,340 --> 00:01:54,740
I'll create another property named NewInstallPath and set it to null.

31
00:01:54,740 --> 00:01:59,040
Now, I'll open the Registry Editor and do a refresh,

32
00:01:59,040 --> 00:02:02,940
then navigate to SOFTWARE and then App1.

33
00:02:02,940 --> 00:02:07,340
Here we can see App1 key, and the properties got created.

34
00:02:07,340 --> 00:02:11,040
The InstallPath property shows the value that we set.

35
00:02:11,040 --> 00:02:17,140
Also note that the NewInstallPath property that we set as null is showing blank.

36
00:02:17,140 --> 00:02:20,730
This is how you can create a registry key and value using

37
00:02:20,730 --> 00:02:24,040
New‑Item and New‑ItemProperty commands.

38
00:02:24,040 --> 00:02:28,590
Next, we will see how we can modify existing registry keys and values.

39
00:02:28,590 --> 00:02:33,440
To do so, we'll use the same key that we created a while ago.

40
00:02:33,440 --> 00:02:35,880
First, I'll go into the SOFTWARE folder.

41
00:02:35,880 --> 00:02:41,180
To change the name of the registry key, you must use Rename‑Item command.

42
00:02:41,180 --> 00:02:43,330
In the Path parameter,

43
00:02:43,330 --> 00:02:47,320
I will enter the name of the registry of which I want to change the name.

44
00:02:47,320 --> 00:02:52,270
In the NewName parameter, I'll enter the NewName and hit Enter.

45
00:02:52,270 --> 00:02:56,800
This will change the name of the registry key from App1 to App2.

46
00:02:56,800 --> 00:03:00,880
To change the name of a property, I'll use Rename‑ItemProperty.

47
00:03:00,880 --> 00:03:05,680
In the Path parameter, I'll enter the path, which has now

48
00:03:05,680 --> 00:03:10,600
changed to App2. In the Name parameter, I'll enter the name of

49
00:03:10,600 --> 00:03:13,440
the property that I wish to change.

50
00:03:13,440 --> 00:03:17,540
I will change one of the properties that we created earlier.

51
00:03:17,540 --> 00:03:22,240
I will change the name from NewInstallPath to OldInstallPath.

52
00:03:22,240 --> 00:03:26,940
I'll enter a new name and NewName parameter and hit Enter.

53
00:03:26,940 --> 00:03:32,360
Now when I go to registry snap‑in and do a refresh, you will notice that

54
00:03:32,360 --> 00:03:37,330
the registry key name changed from App1 to App2, and property name changed

55
00:03:37,330 --> 00:03:41,990
from NewInstallPath to OldInstallPath. Next, you can modify the registry

56
00:03:41,990 --> 00:03:45,040
values using Set‑ItemProperty command.

57
00:03:45,040 --> 00:03:50,940
We will set the value of OldInstallPath property from null to some value.

58
00:03:50,940 --> 00:03:56,500
I'll enter Set‑ItemProperty command. In the Path parameter, I'll enter

59
00:03:56,500 --> 00:04:01,500
App2. In the Name parameter, I'll mention the name of the property of

60
00:04:01,500 --> 00:04:06,830
which I wish to change the value. Next, in the Value parameter, I'll

61
00:04:06,830 --> 00:04:09,540
enter the value that I wish to set.

62
00:04:09,540 --> 00:04:13,940
I'll enter C:\Temp and hit Enter.

63
00:04:13,940 --> 00:04:22,000
Now, when we check the value from registry console, we can see that the value of the property has been modified.

