VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script VBS Script per amministratori di sistema - Come fare il backup di Outlook automaticamente in una email di accesso o di logoff di script
Posted on March 13, 2007 at 8:11 am Postato il 13 marzo 2007 a 8h11
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. Se sei un amministratore Sistemi per la vostra azienda e tutti sono utilizzando Outlook o qualche altro programma di posta elettronica del desktop, è probabile che tu abbia gestito in una situazione in cui qualcuno ha perso tutti i loro messaggi a causa del fatto che è salvato localmente sulla utente 'Computer e non sul server principale. 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. Quindi, se sei un piccolo negozio e non può permettersi di avere server Exchange, semplicemente Ecco quindi la possibilità di automatizzare il backup di utente di Outlook file PST sul vostro server, in uno script di accesso o di logoff.
First here’s the code and then I’ll explain it: Primo ecco il codice e poi mi spiego:
Set shell= WScript.CreateObject(”WScript.Shell”) Imposta di shell = WScript.CreateObject ( "WScript.Shell")
strUserName = shell.ExpandEnvironmentStrings(”%USERNAME%”) StrUserName = shell.ExpandEnvironmentStrings ( "% USERNAME%")
Dim fso Dim FSO
set fso = CreateObject(”Scripting.FileSystemObject”) Impostare fso = CreateObject ( "Scripting.FileSystemObject")
lnDayOfWeek = weekday(now()) LnDayOfWeek = giorno della settimana (ora ())
if lnDayOfWeek = 5 then Se lnDayOfWeek = 5 allora
If fso.DriveExists(”G:”) Then Se fso.DriveExists ( "G:") Quindi
Dim lcDrive Dim lcDrive
Set lcDrive = fso.GetDrive(”G:”) Imposta lcDrive = fso.GetDrive ( "G:")
If lcDrive.IsReady Then Se lcDrive.IsReady Poi
newfolderpath = “\\servername\users\” & strUserName & “\EmailBackup” Newfolderpath = "\ \ nomeserver \ utenti \" & strUserName & "\ EmailBackup"
If Not fso.FolderExists(newfolderpath) Then Se non fso.FolderExists (newfolderpath) Poi
Set newfolder = fso.CreateFolder(newfolderpath) Imposta newfolder = fso.CreateFolder (newfolderpath)
End If Se fine
Dim file Dim atto
file = “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” Atto = "C: \ Documents and Settings" & strUserName & "\ Impostazioni locali \ Dati applicazioni \ Microsoft \ Outlook \ Outlook.pst"
If fso.FileExists(file) Then Se fso.FileExists (atto) Poi
fso.CopyFile “C:\Documents and Settings\” & strUserName & “\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst”, “\\servername\users\” & strUserName & “\EmailBackup\Outlook.pst” Fso.CopyFile "C: \ Documents and Settings" & strUserName & "\ Impostazioni locali \ Dati applicazioni \ Microsoft \ Outlook \ Outlook.pst", "\ \ nomeserver \ utenti \" & strUserName & "\ EmailBackup \ Outlook.pst "
set fso = nothing Impostare FSO = niente
wscript.echo “Your email has been backed up!” Wscript.echo "La tua e-mail è stata sostenuta!"
end if Fine se
end if Fine se
end If Se fine
end if Fine se
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, il codice non è rientrata molto bene qui, per cui dovrete copiarlo e di risolvere il problema in modo che sia in grado di leggere correttamente. Basically, it starts off creating a FileSystem object that will take care of copying the file to the server. Fondamentalmente, si inizia la creazione di un FileSystem oggetto che si prenderà cura di copiare il file su 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. Allora faccio una verifica per vedere quali giorni della settimana si e uso 5 (venerdì), in modo che lo script viene eseguito solo una volta a settimana. 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. Ho anche fare un controllo per accertarsi che l'unità è disponibile G (la rete ho intenzione di essere la copia dei dati a) prima di arrivare alla copiatura.
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. Poi ho controllare per vedere se esiste la cartella che voglio copiare e se non, vado avanti e di creare la cartella nella cartella utente sul 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. Ho anche verificare che il file esiste e, in caso affermativo, ho poi copiarlo per l'utente della cartella sulla rete. I use the shell.ExpandEnvironmentStrings(”%USERNAME%”) method to get the current user’s username. Io uso il shell.ExpandEnvironmentStrings ( "% USERNAME%"), il metodo per ottenere l'attuale nome dell'utente.
You can then apply this as either a logon or logoff script using Group Policy! È quindi possibile applicare questo sia uno script di accesso o di logoff utilizzando i Criteri di gruppo!
Related Posts: Altre post:
More VBS Scripts for System Administrators Più VBS script per gli amministratori di sistema
If you enjoyed this post, make sure you Se goduto di questo post, assicuratevi di subscribe to my RSS feed Iscriviti al mio feed RSS ! !
» Filed Under Ordinata Pagina » IT Job Stuff È roba di posti di lavoro
Related Posts Altre post
- Quickly hide windows and programs in the taskbar using Zhider Rapidamente nascondere le finestre ei programmi nella barra delle applicazioni utilizzando Zhider
- Is Google really coming out with their own mobile phone? Google è veramente uscire con la propria cellulare?
- Listen to thousands of free Internet radio stations online using TUN3R Ascoltare le migliaia di stazioni radio Internet gratuita online utilizzando TUN3R
- Search for local business listings, maps and directions on your mobile for free Cerca elenchi di attività commerciali locali, mappe e indicazioni sul tuo telefonino gratis
- Website Grader - A free search engine optimization (SEO)/marketing tool - Un sito web Motolivellatrice libera ottimizzazione dei motori di ricerca (SEO) / strumento di marketing

























Like your script, for home user how can I modify it to do a backup to external hard drive on a daily basis. Come il vostro script, per utente domestico come posso modificarlo a fare un backup di disco rigido esterno su base giornaliera. Thanks Grazie