Powershell

How to Use the Copy-ItemProperty Cmdlet to Copy an Item’s Property in PowerShell?

In PowerShell, the cmdlet “Copy-ItemProperty” is used to copy a property and its values from one location to another. For instance, it helps the users to copy a specific registry key to another. When a property is copied from one location, it does not get deleted from its original location. However, it is added to another location. The standard alias of the standard cmdlet is the “cpp”.

This guide will overview the “Copy-ItemProperty” cmdlet with the help of various practical examples.

How to Use the Copy-ItemProperty Cmdlet to Copy an Item’s Property in PowerShell?

To copy an item’s property, first, use the “Copy-ItemProperty” cmdlet. Then, specify the item’s path using the “-Path” parameter. Next, use the “-Destination” parameter and provide the target path where you want to copy an item’s property. Lastly, use the “-Name” parameter and specify the property to be copied.

Let’s overview the provided example to learn more.

Example: Use the “Copy-ItemProperty” Cmdlet to Copy an Item’s Property via a Registry Key to Another

In PowerShell, to copy an item’s property simply execute the following command:

Copy-ItemProperty -Path "HKLM:\Software\NewCompany\NewApp" -Destination "HKLM:\Software\NewSoftware" -Name "Users"

According to the above code:

  • Initially, utilize the cmdlet “Copy-ItemProperty” alongside the parameter “-Path” and specify it as a stated path.
  • Next, use the “-Destination” parameter and specify a target path where you want to copy the desired item.
  • Lastly, use the “-Name” parameter and provide it with an item’s name:

Execute the given command to verify whether the item’s property was copied or not:

Get-ItemProperty "HKLM:\Software\NewSoftware"

That’s it! We have elaborated on the usage of the “Copy-ItemProperty” cmdlet in PowerShell.

Conclusion

The cmdlet “Copy-ItemProperty” copies a property and its values from one provided location path to another. Its standard alias is the “cpp”. When a property is copied, it does not get deleted from its original location. This tutorial illustrated the usage of PowerShell’s “Copy-ItemProperty” cmdlet.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.