Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Get the keys from 2010:
  2.  
  3. reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Place MRU" excel_place.reg /y
  4. reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\File MRU" excel_file.reg /y
  5. reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\Place MRU" word_place.reg /y
  6. reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\File MRU" word_file.reg /y
  7. reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\Place MRU" pp_place.reg /y
  8. reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\File MRU" pp_file.reg /y
  9.  
  10.  
  11. # Get the name of the user Key hash from 2016
  12.  
  13. $Key="HKCU:\Software\Microsoft\Office\16.0\Word\User MRU"
  14. $userhash=Get-ChildItem $key -Name
  15.  
  16. # Make sure there is only one key - script exits if more than one exists
  17.  
  18. $hashcount=@(Get-ChildItem $key -Name).count
  19.  
  20. if ($hashcount -gt 1)
  21.  
  22. {
  23.  
  24. "Multiple Keys Found, cannot determine which to use"
  25.  
  26. Exit
  27.  
  28. }
  29.  
  30. # Find and replace the registry path in each reg file
  31.  
  32. (Get-Content excel_place.reg | ForEach-Object {$_ -creplace "\[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\Excel\\Place MRU\]", "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\User MRU\$userhash\Place MRU]"})| Set-Content excel_place.reg
  33. (Get-Content excel_file.reg | ForEach-Object {$_ -creplace "\[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\Excel\\File MRU\]", "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\User MRU\$userhash\File MRU]"})| Set-Content excel_file.reg
  34. (Get-Content word_place.reg | ForEach-Object {$_ -creplace "\[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\Word\\Place MRU\]", "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\User MRU\$userhash\Place MRU]"})| Set-Content word_place.reg
  35. (Get-Content word_file.reg | ForEach-Object {$_ -creplace "\[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\Word\\File MRU\]", "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\User MRU\$userhash\File MRU]"})| Set-Content word_file.reg
  36. (Get-Content pp_place.reg | ForEach-Object {$_ -creplace "\[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\PowerPoint\\Place MRU\]", "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\PowerPoint\User MRU\$userhash\Place MRU]"})| Set-Content pp_place.reg
  37. (Get-Content pp_file.reg | ForEach-Object {$_ -creplace "\[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\PowerPoint\\File MRU\]", "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\PowerPoint\User MRU\$userhash\File MRU]"})| Set-Content pp_file.reg
  38.  
  39. # Merge into one file
  40.  
  41. $header = "Windows Registry Editor Version 5.00"
  42. $header | Out-File final.reg
  43.  
  44. type excel_place.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
  45. type excel_file.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
  46. type word_place.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
  47. type word_file.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
  48. type pp_place.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
  49. type pp_file.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
  50.  
  51. # Import changes into the registry
  52.  
  53. regedit /s final.reg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement