1 2 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
|
<html>
<body>
<span style="color:#00000;font-family: Verdana;font-size: 13pt">Bienvenue dans l'utilitaire de sauvegarde de vos données personnelles.</span>
<br><br>
Sélectionnez le dossier à sauver :
<br>
<br>
<span style="color:red;font-family: Berlin Sans FB Demi">
/!\ Avant de commencer, Veuillez sauvegarder vos documents et fermer Outlook /!\</span>
<br>
<br>
<input type="checkbox" ID="Doc" name="Doc"> : Sauvegarde de Mes Documents (Tous les fichiers)
<br>
<input type="checkbox" ID="Bur" name="Bur"> : Sauvegarde du Bureau (Tous les fichiers)
<br>
<input type="checkbox" ID="PST" name="PST"> : Sauvegarde UNIQUEMENT le/les PST
<script type="text/javascript">
function fermer()
{
self.close();
}
</script>
<SCRIPT LANGUAGE="VBScript">
ResizeTo 700,400
'==================================================================================================================
'Fenêtre pour choisir repertoire cible de sauvegarde
'==================================================================================================================
Const WINDOW_HANDLE = 0
BIF_editbox = &H0010
titre="Sélectionner la destination de la sauvegarde"
Set objShell = CreateObject("Shell.Application" )
Set objFolder = objShell.BrowseForFolder _
(WINDOW_HANDLE, titre , BIF_editbox)
On Error Resume Next
Set objFolderItem = objFolder.Self
If Err <> 0 Then
msgbox "Annulation de la sauvegarde"
fermer()
Else
objPath = objFolderItem.Path
arobrescence
end if
'==================================================================================================================
' Création de l'arobrescence Sauvegarde_donnée=> Mes Documents / Bureau / PST dans le repertoire cible sélectionné
'==================================================================================================================
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = CreateObject("WScript.Network")
UserEnCours = WshNetwork.UserName
Racine = objPath & "\" & UserEnCours & "\" & "Sauvegarde_données"
sub arobrescence
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = CreateObject("WScript.Network")
UserEnCours = WshNetwork.UserName
'Dim objSysInfo, objUser
'Set objSysInfo = CreateObject("ADSystemInfo")
'Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
'NomComplet = objUser.displayName
Racine = objPath & "\" & UserEnCours & "\" & "Sauvegarde_données"
Rep_exist_user = oFSO.FolderExists(objPath & "\" & UserEnCours)
Rep_exist_racine = oFSO.FolderExists(objPath & "\" & UserEnCours & "\" & "Sauvegarde_données")
Rep_exist_MesDoc = oFSO.FolderExists(objPath & "\" & UserEnCours & "\" & "Sauvegarde_données" & "\" & "Mes documents")
Rep_exist_Bureau = oFSO.FolderExists(objPath & "\" & UserEnCours & "\" & "Sauvegarde_données" & "\" & "Bureau")
Rep_exist_PST = oFSO.FolderExists(objPath & "\" & UserEnCours & "\" & "Sauvegarde_données" & "\" & "Mes PST")
if Rep_exist_user = true then
if Rep_exist_racine = true then
if Rep_exist_MesDoc = true then
Else
MesDocuments=oFSO.CreateFolder (Racine & "\" & "Mes documents")
End If
if Rep_exist_Bureau = true then
Else
Bureau=oFSO.CreateFolder (Racine & "\" & "Bureau")
End If
if Rep_exist_PST = true then
Else
Pst_Folder=oFSO.CreateFolder (Racine & "\" & "Mes PST")
End If
else
objPath = objPath & "\" & UserEnCours
Racine=oFSO.CreateFolder (objPath & "\" & "Sauvegarde_données")
MesDocuments=oFSO.CreateFolder (Racine & "\" & "Mes documents")
Bureau=oFSO.CreateFolder (Racine & "\" & "Bureau")
Pst_Folder=oFSO.CreateFolder (Racine & "\" & "Mes PST")
End If
else
objPath=oFSO.CreateFolder(objPath & "\" & UserEnCours)
Racine=oFSO.CreateFolder (objPath & "\" & "Sauvegarde_données")
MesDocuments=oFSO.CreateFolder (Racine & "\" & "Mes documents")
Bureau=oFSO.CreateFolder (Racine & "\" & "Bureau")
Pst_Folder=oFSO.CreateFolder (Racine & "\" & "Mes PST")
End if
End sub
'==================================================================================================================
'Fonction pour backuper le Bureau
'==================================================================================================================
Sub VerifProcessBUR(objProcess)
For Each Process In GetObject("winmgmts:").InstancesOf("Win32_process")
If UCase(Process.Name) = UCase(objProcess) Then
msgbox "Annulation de la sauvegarde : " & Process.Name & " est actif..."& Chr(13) &"Fermer Outlook puis relancer l'outils de sauvegarde"
Exit Sub
End If
Next
backup_Bur()
MsgBox "Sauvegarde terminée"
End Sub
sub backup_Bur
Set WshShell = CreateObject("WScript.Shell")
MonBur = WShShell.SpecialFolders("Desktop")
Dim objFSO, objSourceFolder, objDestinationFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
objSourceFolder = MonBur
objDestinationFolder = Bureau
Set oFSO = CreateObject("Scripting.FileSystemObject")
Bureau = Racine & "\" & "Bureau"
set fd=oFSO.getfolder(objSourceFolder)
Fd.Copy Bureau,true
End sub
'==================================================================================================================
'Fonction pour backuper mes documents
'==================================================================================================================
Sub VerifProcessDOC(objProcess)
For Each Process In GetObject("winmgmts:").InstancesOf("Win32_process")
If UCase(Process.Name) = UCase(objProcess) Then
msgbox "Annulation de la sauvegarde : " & Process.Name & " est actif..."& Chr(13) &"Fermer Outlook puis relancer l'outils de sauvegarde"
Exit Sub
End If
Next
backup_Doc()
MsgBox "Sauvegarde terminée"
End Sub
sub backup_Doc
Set WshShell = CreateObject("WScript.Shell")
Mesdoc = WShShell.SpecialFolders("MyDocuments")
Dim objFSO, objSourceFolder, objDestinationFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
objSourceFolder = Mesdoc
objDestinationFolder = MesDocuments
Set oFSO = CreateObject("Scripting.FileSystemObject")
MesDocuments = Racine & "\" & "Mes documents"
set fd=oFSO.getfolder(objSourceFolder)
Fd.Copy MesDocuments,true
End sub
'==================================================================================================================
' Fonction pour backuper uniquement les PST présent dans le profil de l'utilisateur en cours
'Détection si Outlook est ouvert pour éviter une erreur de copie.
'==================================================================================================================
Sub VerifProcessPST(objProcess)
For Each Process In GetObject("winmgmts:").InstancesOf("Win32_process")
If UCase(Process.Name) = UCase(objProcess) Then
msgbox "Annulation de la sauvegarde : " & Process.Name & " est actif..."& Chr(13) &"Fermer Outlook puis relancer l'outils de sauvegarde"
Exit Sub
End If
Next
backup_PST
MsgBox "Sauvegarde terminée"
End Sub
Sub backup_PST
Dim objFS, strFolder, objFolder
Set objFS = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Pst_Folder = Racine & "\" & "Mes PST"
strFolder=CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%\")
Set objFolder = objFS.GetFolder(strFolder)
userprofil = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")
strcommand = "C:\windows\system32\robocopy " & chr(34) & userprofil & chr(34) & " " & chr(34) & Pst_Folder & chr(34) & " *.pst /S /R:1 /W:2 /XD *Temp*"
WshShell.Run strcommand, 1, true
End Sub
'==================================================================================================================
'Fonction après avoir appuyé sur le bouton continuer.
'Vérifie si un choix est coché et execute le backup de l'option sélectionné.
'==================================================================================================================
Sub backup
dim reponse
if ((Doc.Checked = false) AND (Bur.Checked = false) AND (PST.Checked = false)) then
Msgbox "Veuillez sélectionner une option avant de continuer"
else
reponse = msgbox ("La sauvegarde peut durer plusieurs minutes, voulez vous continuez ?", vbYesNo)
If reponse = vbYes then
msgbox "Démarrage de la sauvegarde, appuyer sur ok"
If Doc.Checked Then
VerifProcessDOC("outlook.exe")
End if
If Bur.Checked Then
VerifProcessBUR("outlook.exe")
End if
If PST.Checked Then
VerifProcessPST("outlook.exe")
End if
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Exec("Explorer " & racine)
fermer()
else
msgbox "Sauvegarde annulée"
fermer()
End If
End if
End Sub
</SCRIPT>
<br>
<br>
<br>
<input type="button" id="BTvalider" name="valider" value="Continuer" onclick="backup()">
<input type="button" Id="BTFermer" name="BTFermer" value="Fermer" OnClick="fermer()">
</body>
</html> |
Partager