Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get the keys from 2010:
- reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Place MRU" excel_place.reg /y
- reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\File MRU" excel_file.reg /y
- reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\Place MRU" word_place.reg /y
- reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\File MRU" word_file.reg /y
- reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\Place MRU" pp_place.reg /y
- reg export "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\File MRU" pp_file.reg /y
- # Get the name of the user Key hash from 2016
- $Key="HKCU:\Software\Microsoft\Office\16.0\Word\User MRU"
- $userhash=Get-ChildItem $key -Name
- # Make sure there is only one key - script exits if more than one exists
- $hashcount=@(Get-ChildItem $key -Name).count
- if ($hashcount -gt 1)
- {
- "Multiple Keys Found, cannot determine which to use"
- Exit
- }
- # Find and replace the registry path in each reg file
- (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
- (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
- (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
- (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
- (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
- (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
- # Merge into one file
- $header = "Windows Registry Editor Version 5.00"
- $header | Out-File final.reg
- type excel_place.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
- type excel_file.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
- type word_place.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
- type word_file.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
- type pp_place.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
- type pp_file.reg | find /v "Windows Registry Editor Version 5.00">>final.reg
- # Import changes into the registry
- regedit /s final.reg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement