Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between new-itemproperty and set-itemproperty?

Tags:

powershell

Both appear to create or change an item property.

What's the difference between the two? Under what circumstances do they perform differently?

like image 646
Andrew J. Brehm Avatar asked Dec 19 '11 14:12

Andrew J. Brehm


2 Answers

For me the difference is that if you use new for an item property that exists you'll receive an error, you can use set-itempropoperty in all cases.

So new is for creation, and set is for modification or creation. New will not create if the property exists.

like image 148
JPBlanc Avatar answered Nov 16 '22 00:11

JPBlanc


Besides what @JPBlanc mentioned, there is another important difference. Note that only New-ItemProperty has the parameter -PropertyType, which can be used to specify the registry value type (like REG_DWORD etc.).

like image 23
Just a learner Avatar answered Nov 16 '22 01:11

Just a learner