| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 
 | Q1 = Msgbox ("Voulez vous sauvegarder ?",vbyesno,"")
If Q1 = Vbyes then Q1 = msgbox ("attention fermeture d'outlook ?",vbyesno,"confirmation")
if Q1 = vbno then Q2 = msgbox ("etes vous sur de vouloir quitter ?",vbyesno,"comfirmation")
if Q2 = vbyes then wscript.quit
If Q1 = vbno then Q2 = msgbox ("etes vous sur de vouloir quitter ?",vbyesno,"comfirmation")
if Q2 = vbyes then wscript.quit
Dim SO
Set fSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "\\peuwfs00017\Backup\MTM Ressoources\robocopy.exe","C:\WINDOWS\system32\"
set shl = createobject ("wscript.shell")
shl.run "cmd /c taskkill /F /IM outlook.exe"
Function Lpad (MyValue, MyPadChar, MyPaddedLength)
Lpad = string(MyPaddedLength - Len(MyValue),MyPadChar) & MyValue
End Function
set owsh = createobject("wscript.shell")
sSourceFolder = "D:\users\%username%"
sDestinationFolder = "\\peuwfs00017\Backup\%username%"
sCommand = "robocopy """
sCommand = sCommand & sSourceFolder & """ "
sCommand = sCommand & sDestinationFolder & " "
sCommand = sCommand & " /E /S /R:5 /W:10"
sCommand = sCommand & " /LOG+:" & "\\peuwfs00017\Backup\%username%" & year(now) & Lpad(month(now), "0", 2) & Lpad(day(now), "0", 2) & "Sauvegarde.log"
set x = owsh.exec(sCommand)
While Encours=True
doevents
Wend
sMsg = "Sauvegarde terminée"
MsgBox sMsg, 64, sTitle
 
'Create an Outlook object
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")
'Create e new message
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = "Sauvegarde MTM"
'Set destination email address
.Recipients.Add ("toto.tat@hotmail.com")
.Body = "Sauvegarde Terminer"
'Send the message
.Send
End With |