VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script vbsスクリプトを、システム管理者-どのように電子メールを自動的にバックアップする見通しログインまたはログオフスクリプト

Posted on March 13, 2007 at 8:11 am投稿され2007年3月13日、 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.システム管理者の場合は、お客様の会社との見通しを使って、だれもが電子メールやその他のデスクトッププログラムでは、たぶん実行されてきたという状況が失われたすべてのメールの設定を変更することにより、実際には、ユーザーのローカルに保存のコンピュータではなく、メインのサーバーにします。 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.だからもしあなたが小さな店や余裕を取得することはできませんexchangeサーバー、そして次の方法を自動化するだけで、ユーザーの『アウトルックpstファイルのバックアップをお客様のサーバーにログインまたはログオフスクリプトです。

First here’s the code and then I’ll explain it:ここで、最初のコードとそれじゃあ説明しましょう:

Set shell= WScript.CreateObject(”WScript.Shell”)シェルセット= wscript.createobject ( " wscript.shell " )
strUserName = shell.ExpandEnvironmentStrings(”%USERNAME%”) strusername = shell.expandenvironmentstrings ( "ユーザー名% " )

Dim fso薄暗いfso
set fso = CreateObject(”Scripting.FileSystemObject”)セットfso = createobject ( " scripting.filesystemobject " )

lnDayOfWeek = weekday(now()) lndayofweek =平日(現在( ) )

if lnDayOfWeek = 5 thenもしlndayofweek = 5その後

     If fso.DriveExists(”G:”) Thenもしfso.driveexists (の" g : " )それから

          Dim lcDrive薄暗いlcdrive
          Set lcDrive = fso.GetDrive(”G:”)セットlcdrive = fso.getdrive (の" g : " )

          If lcDrive.IsReady Thenもしlcdrive.isreadyそれから

               newfolderpath = “\\servername\users\” & strUserName & “\EmailBackup” newfolderpath = " \ \ servernameを\ユーザー\ " & strusername & " \ emailbackup "

               If Not fso.FolderExists(newfolderpath) Then次にない場合はfso.folderexists ( newfolderpath )
                    Set newfolder = fso.CreateFolder(newfolderpath)セットnewfolder = fso.createfolder ( newfolderpath )
               End Ifエンド場合

                Dim file薄暗いファイル
               file = “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst”ファイル= " c : \文書や設定\ " & strusername & " \ローカル設定名\ application data \マイクロソフト\見通し\ outlook.pst "

               If fso.FileExists(file) Then次に場合fso.fileexists (ファイル)
                    fso.CopyFile “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst”, “\\servername\users\” & strUserName & “\EmailBackup\Outlook.pst” fso.copyfile " c : \文書や設定\ " & strusername & " \ローカル設定名\ application data \マイクロソフト\見通し\ outlook.pst " 、 " \ \ servernameを\ユーザー\ " & strusername & " \ emailbackup \ outlook.pst "

                    set fso = nothing何も設定fso =
                    wscript.echo “Your email has been backed up!” wscript.echo "お客様の電子メールのバックアップをしました! "
               end ifエンド場合
          end ifエンド場合
     end Ifエンド場合
end ifエンド場合

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 、このコードではありませんインデントとてもよくここで、これをコピーしていただく必要があり修正して読むことができますので、それを正しくします。 Basically, it starts off creating a FileSystem object that will take care of copying the file to the 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.それから私は、これを確認してくださいの曜日のことは、私の使用5 (金曜日)ので、このスクリプトを実行するだけで、週に1度です。 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.私もチェックを行うことを確認したgドライブが入手可能です(私は、ネットワークドライブにデータをコピーしてになるだろう)の前に私のコピーを取得しています。

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.それから、フォルダが存在するかどうかを確認したいのをコピーしてない場合は、思い切って、私のフォルダを作成して、ユーザーのサーバー上のフォルダにします。 I also check to make sure the file exists and if so, I then copy it to the user’s folder on the network.私もチェックしてファイルが存在していることを確認した場合は、それから、ユーザーのファイルをコピーして、ネットワーク上のフォルダにします。 I use the shell.ExpandEnvironmentStrings(”%USERNAME%”) method to get the current user’s username.私を使用してshell.expandenvironmentstrings ( "ユーザー名% " )を取得する方法を、現在のユーザーのユーザー名。

You can then apply this as either a logon or logoff script using Group Policy!次に、このいずれかを適用することができ、グループポリシーのログオンやログオフのスクリプトを使用!

Related Posts:関連記事:

More VBS Scripts for System Administrators vbsスクリプトをより多くのシステム管理者

Office Ergonomics - Risks of working at a desktop workstation and how to avoid themオフィスエルゴノミクス-デスクトップワークステーションでの作業の危険性を回避する方法と

Gliffy - Online tool to create and share diagrams for free gliffy -オンラインツールを無料で作成して共有ダイアグラム

Great tool for Help Desk/System Admintrator Professionals - Change Analysis Diagnostic tool偉大なツールをヘルプデスク/システムadmintratorプロフェッショナル-変化解析診断ツール

If you enjoyed this post, make sure you この投稿を楽しんでいる場合は、必ず subscribe to my RSS feed 私のフィードを購読して !

» Filed Under下に提出» IT Job Stuff仕事のこともの

Related Posts関連記事

One Response to “VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script” 1つの反応を" vbsスクリプトを、システム管理者-どのように電子メールを自動的にバックアップする見通しログインまたはログオフスクリプト"

  1. Jemas said on : jemasによると:

    Like your script, for home user how can I modify it to do a backup to external hard drive on a daily basis.スクリプトのようにして、ホームユーザはどうすればよいの変更を行うことを外部にハードドライブのバックアップを日常的にします。 Thanksおかげで


    Please post your comments/suggestions!コメントを投稿してください/ご提案!