I need help with copy registry key with sub from one location to another and replace if exist

I want to run PSADT script via sccm deployment to read computers registry and copy NetworkConfig Registry with sub keys from one location to another location for each machine on the network.
I need to do this because every machine has different client data source.
I tried couple of option i was not able to do that can someone help i put an example.

Copy-Item -KeyPath-Recurse “HKLM\SOFTWARE\WOW6432Node\Bentley\ProjectWise\10.00\NetworkConfig” -Destination “HKLM\SOFTWARE\WOW6432Node\Bentley\ProjectWise” -Passthru
Or,
Copy-Item -Recurse “HKLM\SOFTWARE\WOW6432Node\Bentley\ProjectWise\10.00\NetworkConfig” -Destination “HKLM\SOFTWARE\WOW6432Node\Bentley\ProjectWise” -Passthru

This really isn’t a Powershell help forum, so you may have better results elsewhere.

However, I do see that you’re not referencing HKLM as a drive. IOW, instead of :
HKLM\SOFTWARE\WOW6432Node\Bentley\ProjectWise\10.00\NetworkConfig
you should have:
HKLM:\SOFTWARE\WOW6432Node\Bentley\ProjectWise\10.00\NetworkConfig

Note the colon (:) after HKLM

1 Like