#74231 - 2003-03-28 02:14 AM
to move your personal outlook files unattended, check this
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
wrote just a code to my friend who said he is a little busy.
some mumble: if you need to move say outlook.pst or outlook.prf from local disk to secure backed up homedrive of user this is the code to use. just place it in logonscript and it should rock just fine. also remember that it has no error checking. (my scripts newer do) I was already pointed to write this as UDF but it's not generic enough in my mind to qualify as UDF... allthough it gives me some thought how to make sreg() simpler and perhaps even faster...
code:
;what files to move: $fileExtension="pst" ;specify what should be the new location: $replacePath="u:\Exchange\" ;if file exist in new location should it be overwritten: $overwrite = "yes" ;remove old or keep: $remove="yes"
;don't change anything below this $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 0=exist($replacePath+$filename) or $overwrite="yes" copy $value $replacePath+$filename if $remove="yes" del $value endif $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
all crap and comments are welcome
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#74233 - 2003-03-28 02:27 AM
Re: to move your personal outlook files unattended, check this
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
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
|
|
Top
|
|
|
|
#74236 - 2003-03-28 02:36 AM
Re: to move your personal outlook files unattended, check this
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Jens,
I think so, so that you don't accidentally replace some other value not related to the .PST data.
I forgot to add the DIMs to my idea of the UDF.
I think Lonk may be working on it as I post.
|
|
Top
|
|
|
|
#74237 - 2003-03-28 02:44 AM
Re: to move your personal outlook files unattended, check this
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
no, I still don't like the idea of UDF... anyway, you can work on it. I just made the file-copy an option and also colorized my code
;what files to move: $fileExtension="pst" ;specify what should be the new location: $replacePath="u:\Exchange\" ;if file exist in new location should it be overwritten: $overwrite = "yes" ;remove old or keep: $remove="yes" ;copy file or just change regs if file already exists: $copyFile="yes"
;don't change anything below this $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)] $exFlag=exist($replacePath+$filename) if $exFlag or $copyFile="yes" if ($exFlag and $overwrite="yes") or ($copyFile="yes" and $exFlag=0) del $replacePath+$filename copy $value $replacePath+$filename endif if $remove="yes" del $value endif $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
_________________________
!download KiXnet
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 764 anonymous users online.
|
|
|