VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script VBS Script für Systemadministratoren - Wie zur Unterstützung von Outlook E-Mails automatisch in eine Anmeldung oder Logoff Script

Posted on March 13, 2007 at 8:11 am Erschienen am 13. März 2007 8:11

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. Wenn Sie ein Systemadministrator für Ihr Unternehmen und jeder ist mit Outlook oder anderen Desktop E-Mail Programm, haben Sie wahrscheinlich die in die Situation, wenn jemand verloren hat, alle ihre E-Mails auf die Tatsache zurückzuführen, dass es lokal auf dem Rechner des Benutzers 'N Computer und nicht auf den Servern. 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. Also, wenn Sie ein kleines Geschäft und können es sich nicht leisten, Exchange Server erhalten, dann ist hier eine einfache Art und Weise zu automatisieren, die Sicherung der Benutzer Outlook PST Dateien auf Ihrem Server in einem Login oder Logoff Script.

First here’s the code and then I’ll explain it: Zuerst hier ist der Code, und dann werde ich es erklären:

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”) Set fso = CreateObject ( "Scripting.FileSystemObject")

lnDayOfWeek = weekday(now()) LnDayOfWeek = Wochentag (jetzt ())

if lnDayOfWeek = 5 then Wenn lnDayOfWeek = 5 dann

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

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

          If lcDrive.IsReady Then Wenn lcDrive.IsReady Dann

               newfolderpath = “\\servername\users\” & strUserName & “\EmailBackup” Newfolderpath = "\ \ Servername \ Benutzer \" & strUserName & "\ EmailBackup"

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

                Dim file Dim Datei
               file = “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” Datei = "C: \ Dokumente und Einstellungen \" & strUserName & "\ Lokale Einstellungen \ Application Data \ Microsoft \ Outlook \ Outlook.pst"

               If fso.FileExists(file) Then Wenn fso.FileExists (Datei) 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: \ Dokumente und Einstellungen \" & strUserName & "\ Lokale Einstellungen \ Application Data \ Microsoft \ Outlook \ Outlook.pst", "\ \ Servername \ Benutzer \" & strUserName & "\ EmailBackup \ Outlook.pst "

                    set fso = nothing Set fso = nichts
                    wscript.echo “Your email has been backed up!” Wscript.echo "Ihre E-Mail wurde gesichert!"
               end if Ende, wenn
          end if Ende, wenn
     end If Ende Wenn
end if Ende, wenn

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, der Code ist nicht eingerückt sehr gut hier, so you'll have to kopieren Sie sie und zu beheben, so dass Sie es korrekt lesen können. Basically, it starts off creating a FileSystem object that will take care of copying the file to the server. Grundsätzlich, so beginnt die Schaffung eines FileSystem Objekt, kümmern Kopieren Sie die Datei auf dem Server. 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. Dann bin ich ein überprüfen, um zu sehen, die Tag in der Woche ist und ich verwende 5 (Freitag), so dass das Skript läuft nur einmal in der Woche. 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. Ich auch ein überprüfen Sie, ob das Laufwerk vorhanden ist (das Netzlaufwerk ich werde Kopieren der Daten zu), bevor ich den Kopiervorgang.

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. Dann habe ich zu überprüfen, um zu sehen, ob der Ordner vorhanden ist, ich möchte eine Kopie an, und wenn nicht, gehe ich vor, und erstellen Sie Ordner, in dem Anwender die Ordner auf dem Server. I also check to make sure the file exists and if so, I then copy it to the user’s folder on the network. Ich bin auch überprüfen, um sicherzustellen, dass die Datei existiert, und wenn ja, ich dann kopieren Sie sie an den Benutzer, Ordner im Netzwerk. I use the shell.ExpandEnvironmentStrings(”%USERNAME%”) method to get the current user’s username. Ich verwende die shell.ExpandEnvironmentStrings ( "% USERNAME%") Methode, um den aktuellen Benutzernamen.

You can then apply this as either a logon or logoff script using Group Policy! Anschließend können Sie diese entweder als eine Anmeldung oder Logoff Script per Gruppenrichtlinie!

Related Posts: Verwandte Beiträge:

More VBS Scripts for System Administrators Mehr VBS Scripts für Systemadministratoren

Office Ergonomics - Risks of working at a desktop workstation and how to avoid them Office Ergonomie - Risiken der Arbeit an einem Desktop Workstation und wie sie vermieden werden können

Gliffy - Online tool to create and share diagrams for free Gliffy - Online Tool zum Erstellen von Diagrammen, und teilen kostenlos

Great tool for Help Desk/System Admintrator Professionals - Change Analysis Diagnostic tool Großes Werkzeug für die Help Desk / System Admintrator Professionals - Ändern Analyse Diagnostic Tool

If you enjoyed this post, make sure you Wenn Ihnen dieser Post, machen Sie sicher, dass Sie subscribe to my RSS feed Abonnieren meinem RSS-Feed ! !

» Filed Under »Unter Abgelegt IT Job Stuff IT-Arbeitsmarkt Stuff

Related Posts Verwandte Beiträge

One Response to “VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script” Eine Antwort auf "VBS Script für Systemadministratoren - Wie zur Unterstützung von Outlook E-Mails automatisch in eine Anmeldung oder Logoff Script"

  1. Jemas said on : Jemas sagte am:

    Like your script, for home user how can I modify it to do a backup to external hard drive on a daily basis. Wie Ihr Skript für Heimanwender, wie kann ich es ändern zu tun, ein Backup auf externe Festplatte auf einer täglichen Basis. Thanks Vielen Dank


    Please post your comments/suggestions! Bitte stellen Sie Ihre Kommentare und Anregungen!