VBS劇本為系統管理員-怎麼對自動備用外型電子郵件在註冊或註銷劇本

張貼在2007年3月13日在8:11上午

如果您是系統管理員為您的公司,并且大家使用外型或某一其他桌面電子郵件程序,您大概跑了入情況,某人丟失了所有他們的電子郵件由於這樣的事實它當地保存了在用戶的計算機和不在主要服務器。 如此,如果您是一家小商店,并且不可能得到交換服務器,然後這簡單地一個方式自動化用戶的外型PST文件備份您的服務器在註冊或註銷劇本。

首先這代碼我然後將解釋它:

設置shell= WScript.CreateObject (」 WScript.Shell」)
strUserName = shell.ExpandEnvironmentStrings (」 %USERNAME%」)

昏暗的fso
設置fso = CreateObject (」 Scripting.FileSystemObject」)

lnDayOfWeek =週日(現在())

如果lnDayOfWeek = 5然後

如果fso.DriveExists (」 G :」)然後

昏暗lcDrive
集合lcDrive = fso.GetDrive (」 G :」)

如果然後lcDrive.IsReady

newfolderpath = 「\ \ servername \用戶\」 & strUserName & 「\ EmailBackup」

如果不fso.FolderExists (newfolderpath)然後
設置newfolder = fso.CreateFolder (newfolderpath)
結束,如果

昏暗的文件
文件= 「C:\Documents and Settings\」 & strUserName & 「\地方設置\應用數據\微軟\外型\ Outlook.pst」

如果fso.FileExists (文件)然後
fso.CopyFile 「C:\Documents and Settings\」 & strUserName & 「\地方設置\應用數據\微軟\外型\ Outlook.pst」, 「\ \ servername \用戶\」 & strUserName & 「\ EmailBackup \ Outlook.pst」

設置fso =沒什麼
wscript.echo 「您的電子郵件支持!」
結束,如果
結束,如果
結束,如果
結束,如果

Unforunately,代碼這裡沒有很好凹進,因此您將必須複製它和固定它,以便您能正確地讀它。 基本上,它開始創造照料複製文件對服務器的文件系統對象。 然後我做支票看哪星期它是,并且我使用5 (星期五),因此劇本每周一次只跑。 我也做支票確定G驅動是可利用的(聯網驅動器我複製數據),在我有複製之前。

然後我檢查看文件夾是否存在我在用戶的文件夾在服務器想要複製如果不,我繼續并且創造那個文件夾。 我也檢查確定如果那樣文件在網絡存在,我然後複製它對用戶的文件夾。 我使用shell.ExpandEnvironmentStrings (」 %USERNAME%」)方法得到當前用戶的用戶名。

您能然後申請此作為註冊或註銷劇本使用小組政策!

相關崗位:

更多VBS劇本為系統管理員

辦公室人體工程學-工作的風險在一個小規模工作站和如何避免他們

Gliffy -創造和分享圖的網上工具為自由

為詢問臺或系統Admintrator專家的偉大的工具-更換分析診斷器械

享受這個崗位? 訂閱到網上技術技巧通過 RSS飼料 或通過 電子郵件 and receive free daily productivity tips.

» Filed Under IT Job Stuff

Add to Delicious Save this page Mixx it Stir it up on Mixx
Reddit Add to Reddit StumbleUpon Stumble this page

Related Posts

6 Responses to “VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script”

  1. Jemas said on :

    Like your script, for home user how can I modify it to do a backup to external hard drive on a daily basis. Thanks


  2. Ameneh said on :

    very useful post, i was wondering if there is code to do the same thing every night?

    Many thanks
    Ameneh


  3. Arunodaya Parkash said on :

    How can I implement when the user is log off from the system?

    Is there any possible thatI could take backup of any folder on daily basis on LAN environment?


  4. George said on :

    what happens if some paths contains international characters.. ?

    for example c:\documents and settings\george\?? ??????? ???\


  5. Yvonne said on :

    Need to know how to set it up to run everyday monday thur Friday. I also would like to know if I can directed to copy the users profile instead of just their pst. That is what I need to run the srcipt for thanks.


    Pingbacks
  1. Backup Outlook, Outlook Express email using Amic Email backup Says:

    [...] next release as Thunderbird is quite popular! I had also written a post way back about how you can write a script in Windows to automatically backup your email. Source: Ghacks Technorati Tags: email backup, backup email, backup outlook email, email backup [...]

Please post your comments/suggestions!