The script below is tested against Outlook 2010, but has been successful in my testing. Set the $oldpath and $newpath to fit your environment. Test it against a few accounts before deploying. I take no responsibility for the use of this in any org. :D
$encodingType = [Text.Encoding]::Default.HeaderName $oldPath = "" #Old fileserver/path name here $newPath = "" #New fileserver/path name here function bin2string{ Param( $thispath, #Path to the Key [string]$thisProperty #Name of the property (typically in HEX) ) $binary = Get-ItemProperty -path $thisPath.pspath | select -expand $thisProperty $string = [Text.Encoding]::GetEncoding($encodingType).GetString( $binary ) return $string } function string2bin{ param( [string]$thisString ) $newBinary = [Text.Encoding]::GetEncoding($encodingType).GetBytes( $thisString ) return $newBinary } set-location "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Default Outlook Profile" $path = get-location $keys = get-childitem $path foreach($key in $keys){ #write-host $key -ForegroundColor DarkCyan $properties = get-itemproperty -path $key.pspath #$properties | where {$_ -match "01020fff"} if (($properties | where {$_ -match "01020fff"}).count -ne 0 -AND ($properties | where {$_ -match "001f3006"}).count -ne 0){ #Make sure this is an Outlook Data File Key if ((bin2string $key "001f3006") -match "O\WU\WT\WL\WO\WO\WK\W+D\WA\WT\WA\W+F\WI\WL\WE"){ Write-Host "Found $(bin2string $key "001f3006") in $Key" -ForegroundColor Yellow #Get string from Property 01020fff, the functional Path property $nowString = bin2string $key "01020fff" #Fix string in Property 01020fff, the functional Path property $nowString = $nowString -replace $oldPath,$newPath #Convert Fixed String Back into Binary $newBinary = string2bin $nowString #Set the Bin as the Value of Property 01020fff, the functional Path property Set-ItemProperty -path $key.pspath -name "01020fff" -value $newBinary #Get string from Property 001f6700 $nowString2 = bin2string $key "001f6700" $nowString2 #Fix string in Property 001f6700 $nowString2 = $nowString2 -replace ($oldPath.ToCharArray() -join "\W"),($newPath.ToCharArray() -join " ") $nowString2 #Convert Fixed String Back into Binary $newBinary2 = string2bin $nowString2 #Set the Bin as the Value of Property 001f6700 Set-ItemProperty -path $key.pspath -name "001f6700" -value $newBinary2 } } }