title: Powershell Find-And-Replace on registry values?
body: <p>In <code>'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders'</code> I have some paths set to an old server. e.g.:</p>
  
  <p>'My Pictures' is set to <code>'\\DeadServer\RedirectedFolders\%UserName%\My Documents\My Pictures'</code></p>
  
  <p>I'd like to replace <code>"\\DeadServer\RedirectedFolders"</code> with <code>"C:\Users"</code></p>
  
  <p>How can this be done in <code>powershell</code>?
  <hr />
  I got as far as trying</p>
  
  <pre>Get-ItemProperty -path "Microsoft.PowerShell.Core\Registry::HKEY_USERS\*\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" | ? {$_.PSObject.Properties -like "*DeadServer*"} </pre>
  
  <p>But I think I'm getting confused with how the entry I want to change is a 'Property', and not an 'Item', and I don't know how to iterate through properties like I'd do Items.
  <hr />
  Before you ask, I've already made this change with Group Policy, but it's not taking. Users are getting a message</p>
  
  <blockquote>
    <p>The Recycle Bin on \DeadServer\RedirectedFolders\%UserName%\My Documents\My Pictures` is corrupted. Do you want to empty the Recycle Bin for this drive?     </p>
  </blockquote>
  
  <p>upon login which is keeping Folder Redirection from applying.<br>
   This is my attempt to force the change back to local storage manually. </p>