Hi All,
From my research it appears that Powershell can't rename a registry key natively? Very strange (if this is true, then someone in a Redmond based office needs a slap).
I dropped to .net and found a similar issue. I dropped down even further to Reg.exe which doesn't seem to have any problems at all! Sometimes the old tech is still best eh?
Anyway. I'm trying to automate the refresh of a Win7 profile. Part of that refresh involves removing the user's profile reg key located at HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList.
I've been in IT at ground level for many years now, and one thing you learn is never to delete anything if you can help it. Better to rename if you can, so the old data is still present if you need it later.
However, we now get to the issue. If I use the following, I see no issues:
$computer="CC-0579"
$key="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
$SID="S-1-5-21-746134567-324567852-833466555-498436"
$KeyFrom="\\$computer\$key\$SID"
$KeyTo="\\$computer\$key\old $SID $RandomNumber"
reg copy $KeyFrom$KeyTo/s /f
However, what I want to use is the following; and when I do, all appears to be well, but nothing changes on the remote computer!
Help!