Solved get reg below HKEY_CURRENT_USER\Identities

Netgear / Dg834g
February 18, 2013 at 15:30:48
Specs: Windows XP SP3, HexaCore AMD FX-6100, 1400 MHz (7 x 200) / 4gb DDR
I have written a batch file to make backups of my OUTLOOK EXPRESS EMAIL rules, the problem is I often forget to modify it after a clean install of windows ALSO it can be very tedious having to constantly edit the user profile ID section in it can someone give me a solution so that my REG backup and restore function can cir cum navigate the user ID part so it will work regardless on any of my PC's without having to do search and replace of the user profile ID's ?

reg export "HKEY_USERS\somekey\Identities\{someuser}\Software\Microsoft\Outlook Express\5.0\Rules" %email-rules%

I have searched hi and lo for a solution to this if anyone can help please ?

Thanks xxx

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


See More: get reg below HKEY_CURRENT_USER\Identities

Report •


✔ Best Answer
February 20, 2013 at 18:05:15
Hi michelle: glad you caught the error (I'm usually left looking very poorly when my errors are implemented prior to close scrutiny).
I was uneasy about using batch for this, due to it's "prickly" nature, so I should have listened to my instincts. Here's a vbscript solution that is much more reliable, but still uses batch for in-feeds:
::====== first the batch: begin batchscript
@echo off>newreg& setlocal
:: load current security and id values from current reg
for /f "tokens=7 delims=\" %%a in ('reg query "HKLM\software\microsoft\windows nt\currentversion\profilelist"') do set s1=%%a
for /f "tokens=3 delims=\" %%a in ('reg query "HKcu\identities"') do set id=%%a
find /v "" < old.reg > oleg
echo punching in the following values
echo security profile: %s1%
echo primary id: %id%
echo output will be in "newreg"
pause
cscript olrules.vbs %s1% %id%
::===== end batchscript
'===== begin vbscript olrules
set fso=createobject("scripting.filesystemobject")
'this reads the entire file content into one variable, including crlfs
reg=fso.opentextfile("oleg").readall
'split the file, based on delim. "\", into array z. we only want elements
'1 and 3, corr. to the security and identity values (array is base zero)
z=split(reg,"\")
'try to isolate the identity val, always delim by {}
p=instr(z(3),"}")
if p>0 then z(3)=left(z(3),p)
'here's the replacement operation - it replaces every instance in the file
'since reg contains the entire file. first, sec.profile, then main.id
reg=replace(reg,z(1),wscript.arguments(0))
reg=replace(reg,z(3),wscript.arguments(1))
'open newreg for ouput
set newreg=fso.opentextfile("newreg",2,true)
'this writes the whole gob out to the new file
newreg.write(reg)
newreg.close
'===== end vbscript

this is much better because it preserves the spacing in the original export. I don't think that affects the import - it's cosmetic for readability - but for comparison purposes it will help you find any discrepancies that shouldn't be there. Plus it's just more reliable for handling text which batch really suffers from. vbscript can also work with unicode, but for now I skipped that option.
ps: I was confused myself, in my first resp., about what gets swapped with what and where, so I probably confused you with my confusion. :D



#1
February 18, 2013 at 15:46:02
Hello,

When it comes to Outlook Express, I know there is a tool within that program that can create full backups of your data, including rules. Also, truth be told, I would not rely on a registry entry for this purpose, this could create serious problems down the line.

With OE being in a sense, an obsolete email program, I would recommend downloading Windows Live Mail and setting things up that. I know for a fact that program has solid tools for completely backing up your email profile.

I hope this helps :)

Jonas "Jackal" Lear
http://www.sbccrew.com
Serving the South Bay Since 1999


Report •

#2
February 18, 2013 at 16:57:47
gestohlenseele
I think you are mistaken. Using the registry is the only way to backup OE email rules.

Ortorea
I do the same. Sorry I don't know any way to achieve what you are asking but keep watching for new inputs on here.

Always pop back and let us know the outcome - thanks


Report •

#3
February 18, 2013 at 17:35:27
Dear gestohlenseele thanks for your suggestion, but I prefer not to use live mail, I try to avoid as much online stuff as I can I have seen problems with live mail on other systems, I guess I am showing my age a bit as I just like old school stuff O.E. is fine for my purpose as long as I use it with open attachments turned off by default its quite safe and is backwards compatible with my old email archives I have on disk which I often open up for reference, it would just be inconvenient for me to start swapping to other clients, I have tried other third party email clients and just don't like them. I am aware that BEFORE importing older email rules it is important in a clean windows install to first create ONE rule at least to initialise the rules in O.E. otherwise importing using a REG file will cause problems, it because of my years of experience with outlook express I prefer to stick with it.

I have a somewhat bad memory which is why I use batch to run at start up certain backup and restore processes.

Regards Michelle

below is my batch so far!

:: BEGIN

@echo off && setlocal enabledelayedexpansion
:: SETTING VARIABLES FOR TIME AND DATE
@For /F "tokens=1,2,3,4 delims=: " %%A in ('Time /t') do @(
Set Hours=%%A
Set Minutes=%%B
)

echo %Hours%:%Minutes%
sleep 5
cls
:: -----------------------------------------------------------
@For /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do @(
Set Days=%%A
Set Months=%%B
Set Years=%%C
)

:: #####################################
set regrules="D:\# BackUp Settings Progs\Mail-Rules\mail-rules-new.reg"
set arcrules="D:\# BackUp Settings Progs\Mail-Rules\mail-rules.reg"
:: -----------------------------------------------------
:: #####################################
echo BACKING UP RECENT EMAIL RULES FOR LATER IMPORT
reg export "HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\Software\Microsoft\Outlook Express\5.0\Rules" %regrules%
goto chkrr
::
:restor
echo RESTORING MAIL RULES
reg import %arcrules%
:chkrr
:: --------------------------------------
for %%a in (%regrules%) do set RR1s=%%~Za
:: --------------------------------------
for %%a in (%arcrules%) do set AR2s=%%~Za
:: --------------------------------------
echo VALUE OF RR1s = %RR1s% : AR2s = %AR2s%
echo.
if %AR2s% GTR %RR1s% goto restor
if %RR1s% GTR %AR2s% copy %regrules% %arcrules%
:: END EMAIL BACKUP OR RESTORE
sleep 3
cls

endlocal
cls
:done
echo BATCH COMPLETED SUCCESFULLY
sleep 5
CLS


:: END

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

Related Solutions

#4
February 18, 2013 at 17:40:49
Thanks Derek Yes I will keep hoping because it drives me crazy, theirs other registry keys also below USER keys I would like to be able to backup and restore, I run a server PC aswell and it often has to be restored from an image and theirs nothing worse than losing all my months of customisations so tedious, batch is a live saver if it can be made more functional, I always have the belief that computers are supposed to do all the work and save us time sadly it is often the other way around if you know what I mean, we spend hours trying to keep the dam things running lol

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#5
February 18, 2013 at 21:33:07
Hi Or:
If my understanding is correct, you just need to swap two values across system-reloads? This might pull the current values:
@ECHO OFF
for /f "tokens=2,4 DELIMS=\" %%a in ('reg query "HKEY_USERS" /S 2^>nul ^| find /i "identities"') do (
if "%%b" neq "" (
echo %%a %%b
>hold echo %%a %%b
pause
goto :eof
)
)
::==== end snippet
Once those are saved (into a simple text file, i guess) you can replace the current registry values with the saved ones by replacing the current keys with these saved keys. Reg Import will suffer an ascii import, and "find" can be used to convert the unicode export to ascii, to facilitate an easy text replacement of key-arch with key-new. I hope this helps...

Report •

#6
February 18, 2013 at 22:53:14
Dear nbrane so nice to see you again :D Yes that seemed to pull the value very well, I suppose these values could then be pulled from the text file into variables then ?

I run your code and this is what was in the hold file!

S-1-5-21-117609710-1770027372-682003330-1004 {E42B4525-63EE-4E3E-9AFB-B371156FB02D}

Must get some sleep am wiped out but will play around with this tomorrow thanks nbrane.

Michelle xxx

PS Before going for sleep I just ran the same script on my server pc and it pulled all the right code, I verified in regedit so works thanks again :)

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#7
February 19, 2013 at 12:35:35
Hello again Or! Been awhile.
Here's a prototype, but I haven't tried the import of the "doctored" material (scary thing, messing about in the registry! I don't need to advise but will anyway: "proceed with utmost caution".)
::===== begin batchscript
@echo off>new.reg& setlocal
::first load the values saved exported from the current {"new"} registry
call :loadnew
echo preparing to punch in the following values:
echo s-1-5-21: %s1%
echo id: %id%
pause
::optional: convert the old reg export from unicode to ascii (couldn't pass up "oleg"!)
find /v "" < old.reg > oleg
:: now punch them in to the "old" registry export
for /f "tokens=*" %%a in (oleg) do (
set test=%%a
call :xx
)
goto :eof

:xx
:: left debugging displays in place
echo %test%
set tq=%test:"=%
echo %tq%
::pause
set t9=%tq:~0,9%
echo :%t9%:
if "%t9%" equ "[HKEY_USE" (
for /f "tokens=1-4* delims=\" %%a in ("%test%") do >>new.reg echo %%a\%s1%\%%c\%id%\%%d
goto :eof
)
if /i "%t9%" equ "User ID={" (
>>new.reg echo "User ID"="{%id%}"
goto :eof
)
>>new.reg echo %test%
goto :eof

:loadnew
for /f "tokens=2,4 DELIMS=\" %%a in ('reg query "HKEY_USERS" /S 2^>nul ^| find /i "identities"') do (
if "%%b" neq "" (
echo %%a %%b
set s1=%%a
set id=%%b
goto :eof
)
)
:fastload
:: less delay, if it works ok. assumed last item is target.
for /f "tokens=7 delims=\" %%a in ('reg query "HKLM\software\microsoft\windows nt\currentversion\profilelist"') do set s1=%%a
::echo security profile: %s1%
for /f "tokens=3 delims=\" %%a in ('reg query "HKcu\identities"') do set id=%%a
::echo main id:%id%
::===== end batch
since it doesn't directly affect the registry, it is safe up to this point. The import is where the registry will be affected. Being batch, this strips out all the blank lines and leading spaces.
ps: couldn' resist using poor Oleg for a variable: oldreg and oleg were too similar! ;-)


Report •

#8
February 20, 2013 at 01:36:43
Dear nbrane, YES AGREED messing with the registry can be risky, which is why I guess the restore part must not be silent but prompt the used to also backup the entire registry first for safety so I will make sure a full backup is done prior to a prompt message. thanks <3

It also occurs to me would it not be safer and less complicated to just export each variable to a seperate txt file ? like:
>hold1.txt echo %%a
>hold2.txt echo %%b

that way it is much easier to get the values later like:

:: set /p oleg1=<hold1.txt
:: set /p oleg2=<hold2.txt

Michelle

PS I am sure Oleg will be happy lol to have his consciousness part of an algorithm almost living hehe

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#9
February 20, 2013 at 02:27:47
WOW thats a lot of code nbrane just reading through it now !!!!

I just ran the script to see what it does it only works upto the first PAUSE after pressing a key the batch just closes after:
convert the old reg export from unicode to ascii


Not sure about the need to convert to unicode I am on older windows XP system SP3 perhaps this is for windows 7 or something ?

Well your way ahead of me I just realized that my OLD registry backups of my email RULES would have the OLD S1 codes and ID so I guess this new code is to substitute the old invalid code for the new system code :D well I did just wake up thats my excuse lol

Just for reference here is just a snippet of the top 2 lines of my email rules reg backup file.

Windows Registry Editor Version 5.00

[HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\Software\Microsoft\Outlook Express\5.0\Rules]
"Messenger Auto logon"=dword:00000001

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#10
February 20, 2013 at 04:22:35
Dear nbrane, I made a copy of my email reg file put the copy in a temp folder, then renamed the copy to old.reg in the same folder as your batch file then I did a search and replace to manually change some of the values in the old.reg file LIKE SO:
S-1-5-21-137609710-2770027372-582003330-1006
{F42B4525-63EE-4E3E-9AFB-B371156FB02F}

Then ran your batch, it does work, it was my error earlier of not realizing what your code does that made it fail lol, the end result was all the values were corrected to the right one's although noticed all the blank lines were stripped out making the NEW.REG file much smaller in size, guess this is not a problem ?

your script is amazing just wow :)

Below is a sample of the first few lines of NEW.REG after your batch completed.

Windows Registry Editor Version 5.00
[HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\{D42B4525-63EE-4E3E-9AFB-B371156FB02E}
"Messenger Auto logon"=dword:00000001
[HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\{D42B4525-63EE-4E3E-9AFB-B371156FB02E}
"Version"=dword:00050000
"Order"="FFA FFB FFC FFF"
[HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\{D42B4525-63EE-4E3E-9AFB-B371156FB02E}
"Name"="Show All Messages"
"Enabled"=dword:00000001
"Version"=dword:0000032c

I made a diff report but its very big so here is a screen shot http://www.book-stores.com/pics/dif...

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#11
February 20, 2013 at 05:28:46
Dear nbrane, so what we have so far is a way to export a new reg file which can be matched to a new system reload, so by doing a compare on new reg S-1 VALUES AND NEW ID to older values stored in text files I can make my batch determine if these values are the same BUT if different can force a prompt to restore the NEW reg if desired, perhaps theirs a way to put back the blank lines before each [HKEY_USERS\

so as to keep the reg file in line with the standard windows reg format ? That is the only thing concerning me just now, I have no immediate concerns about re-importing the NEW.reg file as my entire boot drive is backed up into an image file. Still it is quite messy when I do a compare using examdiff to compare my before and after reg files as the lack of blank lines changes all the line numbers.

I will wait for you to come back on all my comments as I am rambling on a bit lol

Michelle xxxx

AHHHH found some errors, I put back a few blank lines so that I could do a proper EXAMDIFF of the first few lines it seems theirs a few bits of code missing:

"\Software\Microsoft\Outlook Express\5.0\Rules]"

Original line: [HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\Software\Microsoft\Outlook Express\5.0\Rules]
"Messenger Auto logon"=dword:00000001

NEW.REG SAME LINE: [HKEY_USERS\S-1-5-21-117609710-1770027372-682003330-1004\Identities\{E42B4525-63EE-4E3E-9AFB-B371156FB02D}\{D42B4525-63EE-4E3E-9AFB-B371156FB02E}
"Messenger Auto logon"=dword:00000001

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#12
February 20, 2013 at 18:05:15
✔ Best Answer
Hi michelle: glad you caught the error (I'm usually left looking very poorly when my errors are implemented prior to close scrutiny).
I was uneasy about using batch for this, due to it's "prickly" nature, so I should have listened to my instincts. Here's a vbscript solution that is much more reliable, but still uses batch for in-feeds:
::====== first the batch: begin batchscript
@echo off>newreg& setlocal
:: load current security and id values from current reg
for /f "tokens=7 delims=\" %%a in ('reg query "HKLM\software\microsoft\windows nt\currentversion\profilelist"') do set s1=%%a
for /f "tokens=3 delims=\" %%a in ('reg query "HKcu\identities"') do set id=%%a
find /v "" < old.reg > oleg
echo punching in the following values
echo security profile: %s1%
echo primary id: %id%
echo output will be in "newreg"
pause
cscript olrules.vbs %s1% %id%
::===== end batchscript
'===== begin vbscript olrules
set fso=createobject("scripting.filesystemobject")
'this reads the entire file content into one variable, including crlfs
reg=fso.opentextfile("oleg").readall
'split the file, based on delim. "\", into array z. we only want elements
'1 and 3, corr. to the security and identity values (array is base zero)
z=split(reg,"\")
'try to isolate the identity val, always delim by {}
p=instr(z(3),"}")
if p>0 then z(3)=left(z(3),p)
'here's the replacement operation - it replaces every instance in the file
'since reg contains the entire file. first, sec.profile, then main.id
reg=replace(reg,z(1),wscript.arguments(0))
reg=replace(reg,z(3),wscript.arguments(1))
'open newreg for ouput
set newreg=fso.opentextfile("newreg",2,true)
'this writes the whole gob out to the new file
newreg.write(reg)
newreg.close
'===== end vbscript

this is much better because it preserves the spacing in the original export. I don't think that affects the import - it's cosmetic for readability - but for comparison purposes it will help you find any discrepancies that shouldn't be there. Plus it's just more reliable for handling text which batch really suffers from. vbscript can also work with unicode, but for now I skipped that option.
ps: I was confused myself, in my first resp., about what gets swapped with what and where, so I probably confused you with my confusion. :D


Report •

#13
February 20, 2013 at 18:21:33
Thanks nbrane, I must study this because I know very little about vbscript.

Michelle xxx

PS, Just ran the new scripts everything seems perfect in my side by side compare, I am just a little bit puzzled though both files have almost exactly the same content the line numbers match but the newreg file is half the file size ? How can that be !!! very strange indeed lol, the Original file oldreg is 315kb and the newreg is 158kb (scratches head) apart from that all looks great. Will run some more tests tomorrow thanks nbrane xxx

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#14
February 20, 2013 at 18:32:18
I would suggest download "script56.chm", for basics. I'll add commentation to the vbscript in resp 12. It really is much preferable for this application.

Report •

#15
February 20, 2013 at 19:09:48
Cool ahh you just responded see my amendments above to my last reply.... I am just making a little video to show what my results are it will be unlisted just for reference nbrane

Michelle

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#16
February 20, 2013 at 19:38:40
Hi again:
That would most likely be the unicode-to-ascii conversion, since unicode uses two bytes for each character. ("reg export" is delivered in unicode, "reg query" in ascii.)
So, converting to ascii shrinks the file by roughly half. You don't see this (unicode) unless you look at it "raw" form. F/e: look at a registry export in notepad, it looks "normal". Go to command prompt, type EDIT xxxx.reg
then you will see those zero-bytes between every letter. Or, "copy xxxx.reg con" will also show these "ghost" bytes. "type" and "more" will not. "type xxxx.reg > xxxy.reg" will remove these ghosts, rendering the export into ascii in the output file.
Well, glad it is (so far) working. The vbscript output will make it much easier to compare (DIFF) the two files, which is important! Feel free to P-mail me any time.

Report •

#17
February 20, 2013 at 19:55:14
Well it was so fast I could not believe I thought maybe something did not work at first lol, it was in a split second :D Anyway thought I would include a short UNLISTED video just so you can see the results I got here, in fact I do not always have to reload my PC from a clean install as I have TRUEIMAGE of my boot drive, so most often when I restore my PC it is to a backup I made several months ago, however I am considering a clean install soon because I have an inherent bug that keeps coming back with Interrupts hogging me out, usually caused by some new software that seems to mess things up, specifically with the new Firestorm Phoenix viewer so have to avoid that for now until I get up the courage from a complete fresh reload of my OS.

nbrane here is my video for you: http://youtu.be/bKh69EsPD68

all the best Michelle xxx

PPS Thanks nbrane just saw your last reply :D now it makes sense yes I have seen those strange box like characters before must be the Unicode then and thank you, will be getting some sleep soon and will integrate this into my batch later, is it safe to amend the vbs script to output the newreg with the file extension of REG ? or should I just do a rename later ?

Michelle xxx

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#18
February 20, 2013 at 20:50:01
"is it safe to amend the vbs script to output the newreg with the file extension of REG ? or should I just do a rename later ?"
there's no problem with that, filenames are always considered "up for grabs". :-)

Report •

#19
March 9, 2013 at 12:17:00
Dear nbrane, sorry to pester you again, I noticed some problems with my email backup and restore basically I compare the sizes rather than the dates of previously saved email rules, when I create a new registry backup because of the new way your script works the new export registry backup is always much bigger than the compressed one having gone through the vbs filter.

I managed to work around that a bit by passing the NEW registry backup through another variation on your vbs script, however their is some very slight differences in the sizes so sometimes my batch will restore from my backup EMAIL-RULES.REG, file even though new rules had been added theirby over writing newer fuller registry email rules.

I am trying to do a compare to ignore SLIGHT differences but not quite managing it, rather than post the whole thing as it has gotten quite complicated here is what I am trying to do below.

if var1 gtr var2+var3 goto restore

here is my actual code from that line!

if %NRGs% GTR %NXPs%+500000 goto restor

I am using a numerical value in bytes basically to IGNORE slight differences in file sizes, because I noticed some email rules might actually use less space than others, also windows dynamically makes changes in the registry anyway that can cause slight file size differences. I want to maintain a progressive backup with my batch files but sometimes it is falling backwards and basically over writing new rules, so I get stuck where new rules are not staying in my registry lol

I will paste part of my email backup batch file below!

:backup
:: -----------------------------------------------------
echo BACKING UP RECENT EMAIL RULES FOR LATER IMPORT
call email.bat
if not exist %arcrules% if exist %newxprt2% copy %newxprt2% %arcrules%
> %backupflag% echo %Years%%Months%%Days%%Hours%%Minutes%
echo DATE: %Days%/%Months%/%Years% Time: %Hours%:%Minutes%
sleep 7
cls
goto chkrr
::
:restor
:: *****************************************************
echo RESTORING MAIL RULES
sleep 7
reg import %newreges%
copy %newreges% %arcrules%
del %newxport%
cls
:: *****************************************************
:chkrr
if exist newreg copy newreg %newreges%
if exist newreg del newreg
if not exist %newxport% goto endemb
:: newreges are taken from current registry mail Rules
:: newxport = RAW tmp DATA backup registry mail Rules
:: newxprt2 = Reformatted Compressed registry mail Rules
:chkrr2
:: ######################################
for %%a in (%newreges%) do set NRGs=%%~Za
:: --------------------------------------
for %%a in (%newxprt2%) do set NXPs=%%~Za
:: --------------------------------------
for %%a in (%arcrules%) do set AR2s=%%~Za
:: --------------------------------------
:: BACKING UP CURRENT NEWER REGISTRY DATA
echo ################################################
echo.
echo VAL NRGs=%NRGs% : NXPs=%NXPs% : AR2s=%AR2s%
echo.
echo ################################################
sleep 10
cls
:: if %NXPs% GTR %AR2s% copy %newxprt2% %arcrules%
if %NRGs% GTR %AR2s% copy %newreges% %arcrules%
if %NXPs% GTR %NRGs% copy %newxprt2% %newreges%
if %NRGs% GTR %NXPs%+500000 goto restor
:: --------------------------------------
:endemb
sleep 3
cls
if exist %newxport% del %newxport%
:: #####################################
:: END EMAIL BACKUP OR RESTORE

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#20
March 9, 2013 at 21:57:27
I think I solved it :D

set /A NXPss = %NXPs% + 166

if %NRGs% GTR %NXPss% goto restor

Michelle

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#21
March 9, 2013 at 23:43:39
I had to make a few changes now have 2 vbs things going see below!

'===== begin vbscript olrules
set fso=createobject("scripting.filesystemobject")
reg=fso.opentextfile("oleg.tmp").readall
z=split(reg,"\")
p=instr(z(3),"}")
if p>0 then z(3)=left(z(3),p)
reg=replace(reg,z(1),wscript.arguments(0))
reg=replace(reg,z(3),wscript.arguments(1))
set newreg=fso.opentextfile("newreg",2,true)
newreg.write(reg)
newreg.close
'===== end vbscript


and also


'===== begin vbscript nwrules
set fso=createobject("scripting.filesystemobject")
reg=fso.opentextfile("oleg2.tmp").readall
z=split(reg,"\")
p=instr(z(3),"}")
if p>0 then z(3)=left(z(3),p)
reg=replace(reg,z(1),wscript.arguments(0))
reg=replace(reg,z(3),wscript.arguments(1))
set newreg=fso.opentextfile("D:\# BackUp Settings Progs\Mail-Rules\mail-xport-sm.reg",2,true)
newreg.write(reg)
newreg.close
'===== end vbscript

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#22
March 9, 2013 at 23:45:19
My email.bat file has been changed a bit

:: ====== first the batch: begin email rules batchscript
@echo off>newreg& setlocal
set newxport="D:\# BackUp Settings Progs\Mail-Rules\mail-xport.reg"
set newxprt2="D:\# BackUp Settings Progs\Mail-Rules\mail-xport-sm.reg"
set arcrules="D:\# BackUp Settings Progs\Mail-Rules\mail-compr.reg"
:: load current security and id values from current reg
for /f "tokens=7 delims=\" %%a in ('reg query "HKLM\software\microsoft\windows nt\currentversion\profilelist"') do set s1=%%a
for /f "tokens=3 delims=\" %%a in ('reg query "HKcu\identities"') do set id=%%a
reg export "HKEY_USERS\%s1%\Identities\%id%\Software\Microsoft\Outlook Express\5.0\Rules" %newxport%
find /v "" < %arcrules% > oleg.tmp
echo punching in the following values
echo security profile: %s1%
echo primary id: %id%
echo output will be in "newreg" aka newreges
sleep 8
cls
cscript olrules.vbs %s1% %id%
:: ######################## PART 2 ############################
find /v "" < %newxport% > oleg2.tmp
echo punching in the following values
echo security profile: %s1%
echo primary id: %id%
echo output will be in %newxprt2%
sleep 8
cls
cscript nwrules.vbs %s1% %id%
:: ===== end email rules batchscript
del oleg*.tmp

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#23
March 9, 2013 at 23:48:35
Part of My Main Mail Rules Backup and Restore is below because its incorporated into a multi tak batch this is just the email parts.

:: #################### EMAIL BACKUP - RESTORE #################
set newxport="D:\# BackUp Settings Progs\Mail-Rules\mail-xport.reg"
set newxprt2="D:\# BackUp Settings Progs\Mail-Rules\mail-xport-sm.reg"
set arcrules="D:\# BackUp Settings Progs\Mail-Rules\mail-compr.reg"
set newreges="D:\# BackUp Settings Progs\Mail-Rules\mailnewreg.reg"
:: -----------------------------------------------------
:: if exist %newxprt2% goto chkrr
:backup
:: -----------------------------------------------------
echo BACKING UP RECENT EMAIL RULES FOR LATER IMPORT
call email.bat
if not exist %arcrules% if exist %newxprt2% copy %newxprt2% %arcrules%
> %backupflag% echo %Years%%Months%%Days%%Hours%%Minutes%
echo DATE: %Days%/%Months%/%Years% Time: %Hours%:%Minutes%
sleep 7
cls
goto chkrr
:restor
if exist Saystatic.exe Saystatic Restoring Email Rules
:: *****************************************************
echo RESTORING MAIL RULES
sleep 7
cls
reg import %newreges%
copy %newreges% %arcrules%
del %newxport%
cls
:: *****************************************************
:chkrr
if exist newreg copy newreg %newreges%
if exist newreg del newreg
if not exist %newxport% goto endemb
:: newxport = unicode tmp DATA registry mail Rules
:: newreges ascii taken from current REG-FILE mail Rules
:: newxprt2 = ascii Compressed registry mail Rules
:chkrr2
:: ######################################
for %%a in (%newreges%) do set NRGs=%%~Za
:: --------------------------------------
for %%a in (%newxprt2%) do set NXPs=%%~Za
:: --------------------------------------
for %%a in (%arcrules%) do set AR2s=%%~Za
:: --------------------------------------
:: OFFSET TO AVOID SMALL DIPS IN SIZE OF NXPs
:: For example when purposfully deleting unwanted
:: Email rules from the Email Client reg
set /A NXPss = %NXPs% + 5525
echo ------------------------------------------------
echo NRGs %NRGs% and NXPss %NXPss%
echo ------------------------------------------------
echo.
echo ################################################
echo.
echo VAL NRGs=%NRGs% : NXPs=%NXPs% : AR2s=%AR2s%
echo.
echo ################################################
sleep 10
cls
:: BACKING UP LARGER REGISTRY DATA TO REG FILES
if %NXPs% GTR %AR2s% copy %newxprt2% %arcrules%
if %NRGs% GTR %AR2s% copy %newreges% %arcrules%
if %NXPs% GTR %NRGs% copy %newxprt2% %newreges%
if %NRGs% GTR %NXPss% goto restor
if exist Saystatic.exe Saystatic End Email Rule Back Up
:: --------------------------------------
:endemb
sleep 3
cls
if exist %newxport% del %newxport%
:: #####################################
:: ################## END EMAIL BACKUP - RESTORE ###############

NEEDLESS TO SAY I AM GETTING RATHER CONFUSED AT THIS POINT :p

Michelle xxx

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#24
March 10, 2013 at 17:18:17
Just a little NOTE here, I ALSO HAVE DUAL BOOTING this email backup also keeps BOTH BOOT PARTITIONS email rules in SYNC so if one boot drive has older email rules installed on it my batch can migrate the fullest email rules over to my other boot drive, I mention this because I am sure someone is wondering why have an automated batch to import email rules on a newly installed windows system since the batch won't yet be installed well that is why :)

Michelle

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#25
March 18, 2013 at 01:40:19
OK due to some errors in my last MAIN EMAIL BACKUP BATCH FILE above and I can't edit it now as its more than 5 days old here is my amended one and it works fairly well: is linked to above files including the vbs file's, the SayStatic is a TTS speech engine driver most won't need this I use it for audio notification debugging.


:: begin batch outlook express backup
@echo off && setlocal enabledelayedexpansion
:: ############### EMAIL BACKUP - RESTORE ################
set newxport="D:\# BackUp Settings Progs\Mail-Rules\mail-xport.reg"
set newxprt2="D:\# BackUp Settings Progs\Mail-Rules\mail-xport-sm.reg"
set arcrules="D:\# BackUp Settings Progs\Mail-Rules\mail-compr.reg"
set newreges="D:\# BackUp Settings Progs\Mail-Rules\mailnewreg.reg"
:: -----------------------------------------------------
:: if exist %newxprt2% goto chkrr
:backup
:: -----------------------------------------------------
echo BACKING UP RECENT EMAIL RULES FOR LATER IMPORT
call email.bat
if not exist %arcrules% if exist %newxprt2% copy %newxprt2% %arcrules%
> %backupflag% echo %Years%%Months%%Days%%Hours%%Minutes%
echo DATE: %Days%/%Months%/%Years% Time: %Hours%:%Minutes%
if exist Saystatic.exe Saystatic End Email Rule Back Up
sleep 7
cls
goto chkrr
:restor
if exist Saystatic.exe Saystatic Restoring Email Rules
:: *****************************************************
echo RESTORING MAIL RULES
sleep 7
cls
reg import %arcrules%
del %newxport%
if exist Saystatic.exe Saystatic End Email Rule Restore
cls
:: *****************************************************
:chkrr
if exist newreg copy newreg %newreges%
if exist newreg del newreg
if not exist %newxport% goto endemb
:: newxport = unicode tmp DATA registry mail Rules
:: newreges ascii taken from current REG-FILE mail Rules
:: newxprt2 = ascii Compressed registry mail Rules
:chkrr2
:: ######################################
for %%a in (%newreges%) do set NRGs=%%~Za
:: --------------------------------------
for %%a in (%newxprt2%) do set NXPs=%%~Za
:: --------------------------------------
for %%a in (%arcrules%) do set AR2s=%%~Za
:: --------------------------------------
:: OFFSET TO AVOID SMALL DIPS IN SIZE OF NXPs
:: For example when purposfully deleting unwanted
:: Email rules from the Email Client reg
:: set /A NXPss = %NXPs% + 2525
set /A NXPss = %NXPs% + 1196
echo ------------------------------------------------
echo NRGs %NRGs% and NXPss %NXPss%
echo ------------------------------------------------
echo.
echo ################################################
echo.
echo VAL NRGs=%NRGs% : NXPs=%NXPs% : NXPss=%NXPss%
echo ------------------------------------------------
echo VAL NRGs=%NRGs% : AR2s=%AR2s% : NXPss=%NXPss%
echo.
echo ################################################
sleep 10
cls
:: BACKING UP LARGER REGISTRY DATA TO REG FILES
if %NXPs% GTR %AR2s% copy %newxprt2% %arcrules%
if %NRGs% GTR %AR2s% copy %newreges% %arcrules%
if %NRGs% LSS %NXPss% goto restor
:: --------------------------------------
:endemb
sleep 3
cls
if exist %newxport% del %newxport%
endlocal
cls
:: ###################################################
:: ########## END EMAIL BACKUP - RESTORE ###########
:: ###################################################
:: ###################################################
:: end batch outlook express backup

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://www.book-stores.com/angels-


Report •

#26
November 6, 2014 at 20:08:05
Sorry to come back again after all this time, but Nvidia Video updates for some reason is breaking my email export rules again, I am basically being messed up by other programs changing my registry I have come across this and wonder if this could be a solution ?

http://ezinearticles.com/?Backup-Yo...

Michelle

If Dreams Come True Oleg Would be Famous so far he's very shy, so much for Being Famous ;) http://tinyurl.com/pnenqgb


Report •


Ask Question