Option Explicit
Dim shell, fso, folder, scriptPath, tempFolder, tempScript, commandLine
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
folder = fso.GetParentFolderName(WScript.ScriptFullName)
scriptPath = fso.BuildPath(folder, "desinstaller_v10.ps1")
If Not fso.FileExists(scriptPath) Then
  MsgBox "Le programme de desinstallation est introuvable. Reinstallez Alerte Agenda V1.0 puis recommencez.", 16, "Alerte Agenda"
  WScript.Quit 1
End If
tempFolder = shell.ExpandEnvironmentStrings("%TEMP%")
tempScript = fso.BuildPath(tempFolder, "AlerteAgenda_desinstaller_v10_" & Replace(Replace(Replace(CStr(Now), "/", ""), ":", ""), " ", "_") & ".ps1")
fso.CopyFile scriptPath, tempScript, True
commandLine = "powershell.exe -NoProfile -Sta -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & tempScript & """"
shell.Run commandLine, 0, False
