VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script VBS Script para System Administrators - Como fazer um backup Outlook e - mail automaticamente em um login ou sessão scripts

Posted on March 13, 2007 at 8:11 am Postado em 13 de março de 2007, 8h11

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. Se você é um Systems Administrator para sua empresa e toda a gente está usando o Outlook ou algum outro programa mesa e - mail, você provavelmente executado em uma situação em que alguém tem de perder todos os seus e - mails, devido ao fato de que ele é guardado localmente sobre o usuário , O computador, e não sobre os principais servidores. 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. Portanto, se você for uma pequena loja e não se pode permitir obter servidor Exchange, então simplesmente nossa maneira de automatizar o apoio do utilizador do Outlook PST em seu servidor numa sessão login ou scripts.

First here’s the code and then I’ll explain it: Primeiro aqui está o código e então eu vou explicar isso:

Set shell= WScript.CreateObject(”WScript.Shell”) Set casca = WScript.CreateObject ( "WScript.Shell")
strUserName = shell.ExpandEnvironmentStrings(”%USERNAME%”) StrUserName = shell.ExpandEnvironmentStrings ( "% USERNAME%")

Dim fso Dim FSO
set fso = CreateObject(”Scripting.FileSystemObject”) Definir fso = CreateObject ( "Scripting.FileSystemObject")

lnDayOfWeek = weekday(now()) LnDayOfWeek = dias da semana (agora ())

if lnDayOfWeek = 5 then Se lnDayOfWeek = 5, em seguida,

     If fso.DriveExists(”G:”) Then Se fso.DriveExists ( "G:") Then

          Dim lcDrive Dim lcDrive
          Set lcDrive = fso.GetDrive(”G:”) Set lcDrive = fso.GetDrive ( "G:")

          If lcDrive.IsReady Then Se lcDrive.IsReady Então

               newfolderpath = “\\servername\users\” & strUserName & “\EmailBackup” Newfolderpath = "\ \ servername \ usuários \" & strUserName & "\ EmailBackup"

               If Not fso.FolderExists(newfolderpath) Then If Not fso.FolderExists (newfolderpath) Then
                    Set newfolder = fso.CreateFolder(newfolderpath) Set newfolder = fso.CreateFolder (newfolderpath)
               End If End If

                Dim file Dim arquivo
               file = “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” Arquivo = "C: \ Documentos e configurações \" & strUserName & "\ Local Settings \ Application Data \ Microsoft \ Outlook \ Outlook.pst"

               If fso.FileExists(file) Then If fso.FileExists (arquivo) Then
                    fso.CopyFile “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst”, “\\servername\users\” & strUserName & “\EmailBackup\Outlook.pst” Fso.CopyFile "C: \ Documentos e configurações \" & strUserName & "\ Local Settings \ Application Data \ Microsoft \ Outlook \ Outlook.pst", "\ \ servername \ usuários \" & strUserName & "\ EmailBackup \ Outlook.pst "

                    set fso = nothing Definir FSO = nada
                    wscript.echo “Your email has been backed up!” Wscript.echo "Seu email foi backup!"
               end if Fim se
          end if Fim se
     end If Se final
end if Fim se

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, o código não é indentada muito bem aqui, por isso você precisará copiá - lo e resolvê - lo de modo que você pode lê - lo corretamente. Basically, it starts off creating a FileSystem object that will take care of copying the file to the server. Basicamente, ela arranca criando um FileSystem objeto que cuidará de copiar o arquivo para o 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. Então eu faço uma verificação para ver que dia da semana é e eu uso 5 (sexta), a fim de que o script é executado apenas uma 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. Eu também fazer uma verificação para certificar - se de que o carro está disponível G (a rede de carro vou ser copiar os dados a) antes de eu chegar à cópia.

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. Então eu verifique se existe a pasta que deseja copiar para e se não, eu vá em frente e crie essa pasta na pasta do usuário no 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. Também verifique se o arquivo existe e, em caso afirmativo, I, em seguida, copiá - lo para a pasta do usuário na rede. I use the shell.ExpandEnvironmentStrings(”%USERNAME%”) method to get the current user’s username. Eu uso o shell.ExpandEnvironmentStrings ( "% USERNAME%") método para obter o usuário atual do usuário.

You can then apply this as either a logon or logoff script using Group Policy! Em seguida, você pode aplicar este logon ou como quer uma sessão usando o script Group Policy!

Related Posts: Related Posts:

More VBS Scripts for System Administrators Mais VBS Scripts para administradores de sistema

Office Ergonomics - Risks of working at a desktop workstation and how to avoid them Office Ergonomics - Riscos de trabalho em um ambiente de trabalho e como evitá - las

Gliffy - Online tool to create and share diagrams for free Gliffy - Online ferramenta para criar e compartilhar diagramas de graça

Great tool for Help Desk/System Admintrator Professionals - Change Analysis Diagnostic tool Grande ferramenta para Help Desk / Sistema Admintrator Professionals - Change Analysis ferramenta de Diagnóstico de

If you enjoyed this post, make sure you Caso você tenha este cargo, certifique - se de subscribe to my RSS feed Inscrever - se em meu feed RSS ! !

» Filed Under »Filed Under IT Job Stuff IT Job Stuff

Related Posts Related Posts

One Response to “VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script” One Response para "VBS Script para System Administrators - Como fazer um backup Outlook e - mail automaticamente em um login ou sessão scripts"

  1. Jemas said on : Jemas disse sobre:

    Like your script, for home user how can I modify it to do a backup to external hard drive on a daily basis. Assim como seu script, para casa usuário como posso modificá - lo para fazer um backup de disco rígido externo numa base diária. Thanks


    Please post your comments/suggestions! Please postar seus comentários e sugestões!