Here is an example of how I envision the UDF could be used.



Break On
UpdatePSTFileToUDrive("pst",u:\Exchange\)

Function UpdatePSTFileToUDrive($fileExtension,$replacePath)
$Profilesroot="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\"
$Profile=-1
do
 if len($basekey)
  $keyIndex=-1
  do
   if len($subkey)
    $valueIndex=-1
    do
     if "."+$fileExtension=right($value,4)
      if exist($value)
       $filename=split($value,"\"
       $filename=$filename[ubound($filename)]
  if exist($replacePath+$filename)
        $nul=writevalue($Profilesroot+$basekey+"\"+$subkey,$valuename,$replacePath+$filename,"REG_SZ")
       endif
      endif
     endif
     $valueIndex=$valueIndex+1
     $valuename=enumvalue($Profilesroot+$basekey+"\"+$subkey,$valueIndex)
     $value=readvalue($Profilesroot+$basekey+"\"+$subkey,$valuename)
    until $value=259 or @error
  endif
   $keyIndex=$keyIndex+1
   $subkey=enumkey($Profilesroot+$basekey,$keyIndex)
  until $subkey=259 or @error
 endif
 $Profile=$Profile+1
 $basekey=enumkey($Profilesroot,$Profile)
until $basekey=259 or @error
EndFunction