Bonjour à tous,
Je rencontrons une erreur quand j'ai voulu intégré les logs dans mon script VBS.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
On Error Resume Next
Dim objShell, objFSO, SystemDrive, WshShell, OsType
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.shell")
Set WshShell = CreateObject("WScript.Shell")
set filesys=CreateObject("Scripting.FileSystemObject")
SystemDrive = objShell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
 
'Create Log File
If objFSO.FolderExists(SystemDrive & "I:\logs\Install-Setup.txt") Then
'Wscript.Echo "Folder does exist"
Else
objFSO.CreateFolder SystemDrive & "I:\logs\Install-Setup.txt"
End If
 
'Install application
If OsType = "x86" then
objShell.run "I:\setup.exe /S", 1, True
Wscript.quit
elseif OsType = "AMD64" then
objShell.run "I:\setup.exe /S", 1, True
Wscript.quit(Exitcode)
end if
Quand j’utilise pas ce bout de code le script fonctionne correctement
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
'Create Log File
If objFSO.FolderExists(SystemDrive & "I:\logs\Install-Setup.txt") Then
'Wscript.Echo "Folder does exist"
Else
objFSO.CreateFolder SystemDrive & "I:\logs\Install-Setup.txt"
End If
Je vous remercie .

Cordialement .