|
Answer» I have CREATED a batch script .EXE file, in which i am calling below ProcessStartTime.vbs file to capture the start date & time of EXCEL.EXE process, ---- call ProcessStartTime.vbs ---- and i have scheduled that batch script .exe file in the scheduled task, but while running the .exe file below error message gets popped-up on the screen, Please help to RESOLVE the same,
error as :- Windows Script host script: c:\aeclm\ProcessStartTime.vbs Line: 7 Char: 1 Error: Permission Denied code: 800A0046 Source:Microsoft VBScript runtime error
----------ProcessStartTime.vbs code------------------- Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("C:\aeclm\Process_list.txt", _ ForWriting, True)
'objLogFile.Write _ ' ("Process Name,Start Time,Process ID")
'objLogFile.Writeline
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessStartTrace = objWmiService.ExecQuery _ ("SELECT * From Win32_Process")
For Each objProcess in colProcessStartTrace if(objProcess.Name = "EXCEL.EXE")then objLogFile.Write(objProcess.Name) & "," objLogFile.Write(objProcess.CreationDate) & "," objLogFile.Write(objProcess.ProcessId) objLogFile.writeline end if Next
objLogFile.Close --------------------------------------------You don't have write permission in C:\aeclm. You NEED to obtain this.
|