PowerShell Registry Update File MRU and Place MRU

Recently, as part of a data migration project and in an effort to create a seamless user experience in Microsoft Office, the recent documents and recent places needed to be updated with a new server name.  This prevented any users from using this Office feature and having problems.

Using PowerShell to make updates to the File MRU and Place MRU accomplishes this goal.

 

3 thoughts on “PowerShell Registry Update File MRU and Place MRU

  1. This is how far I got before I found your script….figured I’d share; if I end up continuing with mine, I could share it if you wanted it for diversity. I might end up using yours though….

    Param(
    [Parameter(Mandatory=$True)][switch]$computer_to,
    [Parameter(Mandatory=$True)][switch]$computer_from
    )

    Invoke-Command -ComputerName $computer_from {
    reg export “hkcu\Software\Microsoft\Office\14.0\Excel\File MRU” c:\temp\excel_pinned_files.reg
    }

  2. I’ve updated this script to work properly on latest powershell:

    $VerbosePreference = “Continue”

    # Create an empty array to contain collected data for parsing.

    $MRUArray = @()

    # Get-ChildItem recursively searches for File MRU and Place MRU. Get-Item returns

    # Name, Propery and PSPath that are used for updating the registry. The items

    # are added to the variable.

    $MRU = Get-ChildItem HKCU:\Software\Microsoft\Office\15.0 -recurse -ea SilentlyContinue

    where {$_.Name -like “*File MRU” -or $_.Name -like “*Place MRU”} | Get-Item

    # Foreach item returned above and contained in $MRU.

    foreach ($Item in $MRU) {

    # Process the current item that matches “item*” and pipe to a new foreach loop.

    $Item.property -like “item*” |

    foreach {

    # Create a new object and add PSPaath, Item, and MRUPath to the array.

    $RegObject = New-Object system.Object

    $RegObject | Add-Member -type NoteProperty -Name “PSPath” -Value $Item.PSPath

    $RegObject | Add-Member -type NoteProperty -Name “Item” -Value $_

    $RegObject | Add-Member -type NoteProperty -Name “MRUPath” -Value (Get-ItemProperty $Item.PSPath).$_

    $MRUArray += $RegObject

    }

    }

    # Foreach object in $MRUArray.

    foreach ($object in $MRUArray) {
    # Process the current object and replace server name.

    Set-ItemProperty -Path $object.PSPath -Name $object.Item -Value ([string]$object.MRUPath -replace “OLDSERVER”,”NEWSERVER”) -Verbose

    }

Leave a Reply