{"id":361,"date":"2013-09-10T12:00:53","date_gmt":"2013-09-10T11:00:53","guid":{"rendered":"http:\/\/hamsterhirn.de\/?p=361"},"modified":"2018-08-31T11:40:21","modified_gmt":"2018-08-31T10:40:21","slug":"geoeffnete-outlook-pst-dateien-sichern-how-to-backup-open-pst-files","status":"publish","type":"post","link":"https:\/\/hamsterhirn.de\/index.php\/2013\/09\/geoeffnete-outlook-pst-dateien-sichern-how-to-backup-open-pst-files\/","title":{"rendered":"ge\u00f6ffnete Outlook PST Dateien sichern | how to backup open PST files"},"content":{"rendered":"<p>Es ist nicht ganz trivial PST Dateien zu sichern, die gerade bei Outlook ge\u00f6ffnet sind. Windows l\u00e4sst das nat\u00fcrlich nicht zu, was auch Sinn macht in Bezug auf Datenkonsistenz und so weiter.<br \/>\nNur was ist wenn auf Laptops immer Outlook ge\u00f6ffnet ist und allerh\u00f6chstens am Abend in den Standy Modus versetzt wird um dann am morgen weiter betrieben zu werden und niemals Outlook geschlossen wird? Also fallen Hilfswerkzeuge wie <a href=\"http:\/\/www.microsoft.com\/de-de\/download\/details.aspx?id=9003\" target=\"_blank\" rel=\"noopener\">pfbackup<\/a> weg. Dieses erm\u00f6glicht es bei schlie\u00dfen von Outlook die Sicherung der Dateien. Auch muss bei dem Tool die PST Dateien ausgew\u00e4hlt werden die gesichert werden sollen.<\/p>\n<p>Das vorgestellte Skript sucht auf dem ganzen Laufwerk(en) nach PST Dateien und speichert diese in einen vorgegebenen Backup Ordner auf der eigenen Festplatte. In unserer Umgebung ist dies ein Truecrypt Container der immer als S: gemountet wird.<br \/>\nUm ein Backup von einer ge\u00f6ffneten Datei anzulegen ist es n\u00f6tig eine Shadow Copy von der Festplatte anzulegen. Dies f\u00fchrt dazu, dass der aktuelle Stand gespeichert wird und ein kopieren m\u00f6glich wird da die Datei dann nicht mehr mit einem <em>lock<\/em> versehen ist.<br \/>\nAls Hilfswerkzeug kommt <a title=\"Volume Shadow Copy Simple Client\" href=\"http:\/\/vscsc.sourceforge.net\/\" target=\"_blank\" rel=\"noopener\"><em>vscsc<\/em><\/a> und <a href=\"http:\/\/sourceforge.net\/projects\/vscsc\/files\/utilities\/dosdev.zip\/download\" target=\"_blank\" rel=\"noopener\"><em>dosdev<\/em><\/a> (in einem <a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=24745\" target=\"_blank\" rel=\"noopener\">Microsoft Toolset<\/a> enthalten) zum Einsatz.<\/p>\n<p>In meinem Fall sind alle Dateien in C:\\vscsc.<br \/>\nDiese w\u00e4ren:<\/p>\n<ul>\n<li>dosdev.exe<\/li>\n<li>vscsc.exe<\/li>\n<li>findPST.vbs<\/li>\n<li>script_c.bat<\/li>\n<li>script_s.bat<\/li>\n<\/ul>\n<p><em>dosdev.exe<\/em> erlaubt einen so seltsame Windows Laufwerksnamen wie <em>\\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy15 <\/em> auf ein Laufwerksbuchstaben zu mounten. Damit kann man dann auch in Skripten auf das Laufwerk zugreifen.<\/p>\n<p><em>vscsc.exe<\/em> erstellt die tempor\u00e4re Shadow Copy vom Laufwerk. Ist das Skript durch verf\u00e4llt die Shadow Copy.<\/p>\n<p><em>findPST.vbs<\/em> sucht alle PST Dateien auf dem Laufwerk das gerade als Shadow Copy existiert (Laufwerk B:) und kopiert diese ans Backupziel.<\/p>\n<p><em>script_c.bat<\/em> nimmt als Argument den Laufwerksnamen der Shadow Copy an und mountet es als Laufwerk B. Es ruft dann die findPST.vbs auf mit dem Laufwerksbuchstaben der Festplatte, die gerade also Shadow Copy vorliegt.<br \/>\nMan kann dem Skript leider keine Argumente \u00fcbergeben, deswegen ein Skript f\u00fcr jedes Laufwerk.<\/p>\n<p>Hier die Inhalte der Dateien. Denke diese sind selbsterkl\u00e4rend.<\/p>\n<p><em>script_c.bat<\/em>:<br \/>\n<pre><code class=\"preserve-code-formatting\">@echo off\nDOSDEV B: %1\nrem At this point B: is an immutable snapshot of C:, and you can copy from it.\nrem You just need to write some stuff that actually copies data from B:\nrem My favourite is rdiff-backup, but only robocopy can operate in backup mode\nrem as a member of the Backup Operators group (\/B switch), therefore bypassing\nrem file permissions and security. This might be required sometimes.\nrem .ost files are forbidden to appear in a snapshot\nrem see HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\BackupRestore\\FilesNotToSnapshot\nwscript findPST.vbs C:\nDOSDEV \/D B:\n<\/code><\/pre><\/p>\n<p><em>script_s.bat<\/em>:<br \/>\n<pre><code class=\"preserve-code-formatting\">@echo off\nDOSDEV B: %1\nwscript findPST.vbs S:\nDOSDEV \/D B:\n<\/code><\/pre><\/p>\n<p><em>findPST.vbs<\/em>:<br \/>\n<pre><code class=\"preserve-code-formatting\">\nlaufwerksbuchstaben = WScript.Arguments.Item(0)\nbackupFolder = &quot;S:\\Secure Daten\\Backup Outlook\\&quot;\nbackupFolderPart = &quot;S:\\Secure Daten&quot;\nstrComputer = &quot;.&quot;\nConst OverwriteExisting = True\nSet objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)\nSet objWMIService = GetObject(&quot;winmgmts:\\\\&quot; &amp;amp; strComputer &amp;amp; &quot;\\root\\cimv2&quot;)\nQueryString = &quot;Select * from CIM_DataFile Where Extension = &#039;pst&#039; AND Drive = &#039;&quot; &amp;amp; laufwerksbuchstaben &amp;amp; &quot;&#039;&quot;\n&#039;Wscript.Echo QueryString\nSet re = New RegExp\nSet re2 = New RegExp\nWith re\n&nbsp;&nbsp;.Pattern = &quot;.*recycle.bin.*&quot;\n&nbsp;&nbsp;.Global = True\n&nbsp;&nbsp;.IgnoreCase = True\nEnd With \nWith re2\n&nbsp;&nbsp;.Pattern = &quot;.*S:\\Secure Daten\\Backup Outlook.*&quot;\n&nbsp;&nbsp;.Global = True\n&nbsp;&nbsp;.IgnoreCase = True\nEnd With \n\nSet colFiles = objWMIService.ExecQuery (QueryString)\n&nbsp;&nbsp;\n&#039; if there are no pst files found just exit the script\nIf colFiles.Count = 0 Then\n&nbsp;&nbsp;&nbsp;&nbsp;Wscript.Quit\nEnd If\n&#039; if our secure drive is not mounted exit the script\nIf Not (objFSO.DriveExists(&quot;S:&quot;)) Then\n&nbsp;&nbsp;Wscript.Quit\nEnd If\n\nFor Each objFile in colFiles\n&nbsp;&nbsp;filePathAndName = &quot;B:&quot; &amp;amp; objFile.Path &amp;amp; objFile.FileName &amp;amp; &quot;.&quot; &amp;amp; objFile.Extension\n&nbsp;&nbsp;&#039;filePathAndName = objFile.Drive &amp;amp; objFile.Path &amp;amp; objFile.FileName &amp;amp; &quot;.&quot; &amp;amp; objFile.Extension\n&nbsp;&nbsp;&#039;Wscript.Echo filePathAndName\n&nbsp;&nbsp;If Not re.Test(filePathAndName) And Not re2.Test(filePathAndName) Then &#039; check if pst is in recycle.bin or in backup folder\n&nbsp;&nbsp;&nbsp;&nbsp;&#039; create folders if they dont exist\n&nbsp;&nbsp;&nbsp;&nbsp;If Not (objFSO.FolderExists(backupFolderPart)) Then objFSO.CreateFolder(backupFolderPart)\n&nbsp;&nbsp;&nbsp;&nbsp;If Not (objFSO.FolderExists(backupFolder)) Then objFSO.CreateFolder(backupFolder)\n&nbsp;&nbsp;&nbsp;&nbsp;&#039;Wscript.Echo &quot;copy &quot; &amp;amp; filePathAndName &amp;amp; &quot; to &quot; &amp;amp; backupFolder\n&nbsp;&nbsp;&nbsp;&nbsp;objFSO.CopyFile filePathAndName , backupFolder, OverwriteExisting\n&nbsp;&nbsp;End If\n&#039;Wscript.Echo objFile.FileSize\nNext\n<\/code><\/pre><br \/>\n&nbsp;<\/p>\n<p>Um alle PST Dateien auf C: zu sichern wird der folgender Befehl ausgef\u00fchrt:<br \/>\n<code class=\"preserve-code-formatting\">vscsc.exe -exec=script_c.bat C:<\/code><\/p>\n<p>F\u00fcr Laufwerk S:<br \/>\n<code class=\"preserve-code-formatting\">vscsc.exe -exec=script_s.bat S:<\/code><\/p>\n<p>Nachtrag:<br \/>\nIch wollte auch f\u00fcr das Laufwerk S: eine Shadow Copy anlegen. Es handelt sich dabei aber um ein Truecrypt Container und das ist von TrueCrypt nicht unterst\u00fctzt. Ich zitiere aus der TrueCrypt <a href=\"http:\/\/www.truecrypt.org\/docs\/issues-and-limitations\" target=\"_blank\" rel=\"noopener\">&#8222;Known Issues &amp; Limitations&#8220;<\/a>:<\/p>\n<blockquote><p>The Windows Volume Shadow Copy Service is currently supported only for partitions within the key scope of active system encryption (e.g. a system partition encrypted by TrueCrypt, or a non-system partition located on a system drive encrypted by TrueCrypt, mounted when the encrypted operating system is running). Note: For other types of volumes, the Volume Shadow Copy Service is not supported because the documentation for the necessary API is not available.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Es ist nicht ganz trivial PST Dateien zu sichern, die gerade bei Outlook ge\u00f6ffnet sind. Windows l\u00e4sst das nat\u00fcrlich nicht zu, was auch Sinn macht in Bezug auf Datenkonsistenz und so weiter. Nur was ist wenn auf Laptops immer Outlook ge\u00f6ffnet ist und allerh\u00f6chstens am Abend in den Standy Modus versetzt wird um dann am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[197,181,82,174,185,175,176,171,173,179,172,180,187,170,182,177,195,196,178,198,183,186,199,184],"class_list":["post-361","post","type-post","status-publish","format-standard","hentry","category-it","tag-automatisch","tag-backup","tag-batch","tag-cant-be-copied","tag-dosdev","tag-error","tag-fehler-beim-kopieren","tag-geoeffnete-datei","tag-kann-nicht-kopiert-werden","tag-microsoft","tag-open-file","tag-outlook","tag-pfbackup","tag-pst","tag-script","tag-shadow-copy","tag-sicherung","tag-skript","tag-snapshot","tag-tool","tag-vba","tag-vscsc","tag-werkzeug","tag-wscript"],"_links":{"self":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/comments?post=361"}],"version-history":[{"count":10,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":667,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/361\/revisions\/667"}],"wp:attachment":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}