VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script VBS Script para administradores de sistemas - ¿Cómo hacer copia de seguridad de Outlook de correo electrónico automáticamente en una secuencia de comandos de inicio de sesión o desconectarse
Posted on March 13, 2007 at 8:11 am Enviado el 13 de marzo de 2007 a 8:11 horas
If you are a Systems Administrator for your company and everyone is using Outlook or some other desktop email program, you’ve probably run into the situation where someone has lost all of their emails due to the fact that it’s saved locally on the user’s computer and not on the main servers. Si usted es un administrador de sistemas para su empresa y todo el mundo es a través de Outlook o algún otro programa de correo electrónico de escritorio, probablemente ha llevado a la situación en la que alguien ha perdido la totalidad de sus mensajes de correo electrónico debido al hecho de que es guardado localmente en el usuario 'S ordenador, no en los servidores principales. So if you’re a small shop and can’t afford to get Exchange server, then here’s a simply way to automate the backup of user’s Outlook PST files onto your server in a login or logoff script. Así que si eres una pequeña tienda y no puede permitirse el lujo de obtener servidor de Exchange, entonces aquí es una simple manera de automatizar la copia de seguridad de Outlook del usuario PST archivos en el servidor en un script de conexión o de desconexión.
First here’s the code and then I’ll explain it: En primer lugar aquí está el código y, a continuación, voy a explicarlo:
Set shell= WScript.CreateObject(”WScript.Shell”) Set Shell = WScript.CreateObject ( "WScript.Shell")
strUserName = shell.ExpandEnvironmentStrings(”%USERNAME%”) StrUserName = shell.ExpandEnvironmentStrings ( "% USERNAME%")
Dim fso Dim fso
set fso = CreateObject(”Scripting.FileSystemObject”) Conjunto fso = CreateObject ( "Scripting.FileSystemObject")
lnDayOfWeek = weekday(now()) LnDayOfWeek = día de la semana (ahora ())
if lnDayOfWeek = 5 then Si lnDayOfWeek = 5 entonces
If fso.DriveExists(”G:”) Then Si fso.DriveExists ( "G:") Entonces
Dim lcDrive Dim lcDrive
Set lcDrive = fso.GetDrive(”G:”) Set lcDrive = fso.GetDrive ( "G:")
If lcDrive.IsReady Then Si lcDrive.IsReady Entonces
newfolderpath = “\\servername\users\” & strUserName & “\EmailBackup” Newfolderpath = "\ \ servidor \ usuarios \" & strUserName & "\ EmailBackup"
If Not fso.FolderExists(newfolderpath) Then Si No fso.FolderExists (newfolderpath) Entonces
Set newfolder = fso.CreateFolder(newfolderpath) Set newfolder = fso.CreateFolder (newfolderpath)
End If End If
Dim file Dim archivo
file = “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” Archivo = "C: \ Documents y Settings \" & strUserName & "\ Configuración local \ Datos de programa \ Microsoft \ Outlook \ Outlook.pst"
If fso.FileExists(file) Then Si fso.FileExists (archivo) Entonces
fso.CopyFile “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst”, “\\servername\users\” & strUserName & “\EmailBackup\Outlook.pst” Fso.CopyFile "C: \ Documents y Settings \" & strUserName & "\ Configuración local \ Datos de programa \ Microsoft \ Outlook \ Outlook.pst", "\ \ servidor \ usuarios \" & strUserName & "\ EmailBackup \ Outlook.pst "
set fso = nothing Conjunto fso = nada
wscript.echo “Your email has been backed up!” Wscript.echo "Su mensaje ha sido respaldada!"
end if Si fin
end if Si fin
end If Si finales
end if Si fin
Unforunately, the code is not indented very well here, so you’ll have to copy it and fix it so that you can read it correctly. Unforunately, el código no es sangrado muy bien aquí, así que tendrá que copiarlo y corregirlo de modo que usted pueda leer correctamente. Basically, it starts off creating a FileSystem object that will take care of copying the file to the server. Básicamente, se inicia la creación de un FileSystem objeto que se encargará de copiar el archivo en el servidor. Then I do a check to see which day of the week it is and I use 5 (Friday), so that the script only runs once a week. A continuación, hago un control para ver qué día de la semana que es y me uso 5 (viernes), a fin de que el script se ejecuta sólo una vez por semana. I also do a check to make sure the G drive is available (the network drive I’m going to be copying the data to) before I get to the copying. También hacer una comprobación para asegurarse de que la unidad G está disponible (la unidad de red que voy a ser la copia de los datos) antes de llegar a la copia.
Then I check to see if the folder exists that I want to copy to and if not, I go ahead and create that folder in the user’s folder on the server. Entonces compruebe si existe la carpeta que desea copiar y si no, seguir adelante y crear esa carpeta en la carpeta del usuario en el servidor. I also check to make sure the file exists and if so, I then copy it to the user’s folder on the network. También compruebe que el archivo existe y si es así, ¿entonces copiarlo a la carpeta del usuario en la red. I use the shell.ExpandEnvironmentStrings(”%USERNAME%”) method to get the current user’s username. Yo uso la shell.ExpandEnvironmentStrings ( "% USERNAME%") el método para obtener el nombre de usuario del usuario actual.
You can then apply this as either a logon or logoff script using Group Policy! A continuación, puede aplicar este bien como un script de inicio de sesión o de sesión utilizando la política de grupo!
Related Posts: Related Posts:
Bookmark, Share or Email this article. Bookmark, Compartir o Email este artículo.
If you enjoyed this post, make sure you Si gozan de este puesto, asegúrese subscribe to my RSS feed Suscribirse a mi feed RSS ! !
» Filed Under »Presentadas en virtud del IT Job Stuff IT Empleo Stuff
Related Posts Related Puestos
- Is Google really coming out with their own mobile phone? Google es realmente saliendo con su propio teléfono móvil?
- Listen to thousands of free Internet radio stations online using TUN3R Escuchar miles de estaciones de radio por Internet gratuitos en línea utilizando TUN3R
- Search for local business listings, maps and directions on your mobile for free Búsqueda de empresas locales, mapas y direcciones en tu móvil gratis
- Website Grader - A free search engine optimization (SEO)/marketing tool - Un Sitio Web Grader libre optimización de motores de búsqueda (SEO) / herramienta de marketing
- DriveWay - Upload and share multiple large files up to 500 MB each for free DriveWay - Subir y compartir múltiples archivos de gran tamaño de hasta 500 MB cada uno de forma gratuita

























Like your script, for home user how can I modify it to do a backup to external hard drive on a daily basis. Al igual que su script, para el usuario doméstico, ¿cómo puedo modificarlo para que se haga una copia de seguridad de disco duro externas a diario. Thanks Gracias