Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logoff script to backup Outlook data 1

Status
Not open for further replies.

alanterrill

IS-IT--Management
Sep 10, 2003
27
0
0
GB
I want to automate the backup of users Outlook data which is at present held on their c drives. I want to move it to the server each night when they close down so it gets backed up. Logoff scripts seem a good idea, but I've never written a script before.
What I want to say is something like:
xcopy c:\documents and settings\local settings\application data\microsoft\outlook\outlook.pst p:\outlook
However, how do I substitute the name of each user for username? Is it %username%?
I've tried running the above just as a batch file on my PC and it says "Invalid number of parameters". I'm assuming as a dos utility it can't handle "documents and settings" -is there a better command that will handle long file names, or does the error message indicate something else?
 
try xcopy c:\docume~1\%username%\locals~1\applica~1\micros~1\outlook\outlook.pst p:\outlook
 
Many Thanks! Unfortunately it doesn't work. I'm assuming the general rule is max 8 characters between each slash -in which case applica~1 is 9, so I shortened it to applic~1, but still get "file not found -outlook.pst". Any further ideas?

I shall have a look at the synchronization idea, but I think it would take a lot longer to set up as I'd have to go to every pc and set it up, as well as manually copy the first file onto the server, so the pc had something to synchronize with.

 
Here you go this should work for you, put this intoa bat file,

c:
cd c:\docume~1\%username%\locals~1\applic~1\micros~1\outlookxcopy outlook.pst x:\outlook\%username%pause

 
You will also need to add the /Y parameters to the end of the xcopy line, this is so when you copy the file over again it just overwrites and ignores prompting to overwrite, this is what i managed to come up with in the end for what the script should look like:

c:
cd c:\docume~1\%username%\locals~1\applic~1\micros~1\outlookxcopy outlook.pst x:\outlook\%username%\ /Y

hope this helps you

 
We were moving from one server to the next, which ment we needed to recreate the profiles. The file you have listed is just thier identity. If you want to actually back up thier messages and what not you need to do a bit more.
Look at this path:

C:\Documents and Settings\Administrator\Local Settings\Application Data\Identities\{36AEBEE2-5718-4F72-B77F-431463A76037}\Microsoft\Outlook Express

This is the actual folder that the folders/messages are kept. {36AEBEE2-5718-4F72-B77F-431463A76037} is a unique ID, and is different for everyone, your best bet would be something like this:

xcopy C:\Docume~1\%username%\LocalS~1\Applic~1\Identi~1 P:\%username%\Outlook /e /i /y

/e Copys directoriies and sub directories
/i assume the destination is a directory
/y dont as for overwrite confirmation
 
If I read this completely, I would have seen this is for OUTLOOK and not OUTLOOK EXPRESS :)

Umm... PSTs are the way to go I guess for outlook.....

Well if you needed help with outlook express there you go... :)
 
Well thanks to you all for such useful answers. Thanks Faithless for the script which works. I just put it in the logoff section of group policy for the domain and then logged off. Nothing happened - so I shut down and it said running logoff scripts... then running shutdown scripts... and when I rebooted it had done the backup. So it works, but does anyone know where I set logoff scripts separately from shutdown scripts? I can find tabs for logon and logoff but nothing called shutdown. I don't need both, I just like to know what's going on!
Thanks to dwelch - the link has changed but I found it in an area of the Microsoft site I didn't know existed. It works, but only manually, so I don't my users will thank me for having to do their own backups, however simple (I deal with nurses and therapists, not IT people).
And thanks to Keefe -you may have got the wrong program, but the thought was appreciated.
 
Correction to the above -it does run the logoff script when I logoff, not just when I shutdown. It just didn't the first time for some reason...
 
It seems to take the first shutdown or login to get the logoff script to activate the first time. Does anyone know how to activate a logoff scripts without having them to login or restart their computer once?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top