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. 그래서 작은 상점의 경우와 교류를 얻을 감당할 수없는 서버, 그런 다음 여기를 자동화하는 방법으로 간단하게 사용자의 outlook 태평양 표준시 파일의 백업은 귀하의 서버에 로그인 또는 로그오프 스크립트를 놓습니다.

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 dim 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 dim lcdrive
          Set lcDrive = fso.GetDrive(”G:”) 세트 lcdrive = fso.getdrive ( "g :")

          If lcDrive.IsReady Then 만약 lcdrive.isready 다음

               newfolderpath = “\\servername\users\” & strUserName & “\EmailBackup” newfolderpath = "\ \ 서버 이름 \ 사용자 \"& strusername & "\ emailbackup"

               If Not fso.FolderExists(newfolderpath) Then 그렇지 않을 fso.folderexists (newfolderpath) 그 다음
                    Set newfolder = fso.CreateFolder(newfolderpath) 세트 newfolder = fso.createfolder (newfolderpath)
               End If 최종 경우

                Dim file dim 파일
               file = “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” 파일 = "c : \ 문서 및 설정 \"& strusername & "\ 로컬 설정 \ 응용 프로그램 데이터 \ microsoft \ outlook \ 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 & "\ 로컬 설정 \ 응용 프로그램 데이터 \ microsoft \ outlook \ outlook.pst", "\ \ 서버 이름 \ 사용자 \"& 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 일 (금요일), 그래서 일주일에 한번은 스크립트에서만 실행됩니다. 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” 하나의 응답으로 "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! 귀하의 의견을 게시하시기 바랍니다 / 제안합니다!