

InterviewSolution
Saved Bookmarks
1. |
Solve : Microsoft VBScript runtime error while running it from batch exe file? |
Answer» <html><body><p>I have <a href="https://interviewquestions.tuteehub.com/tag/created-938398" style="font-weight:bold;" target="_blank" title="Click to know more about CREATED">CREATED</a> a batch script .<a href="https://interviewquestions.tuteehub.com/tag/exe-447113" style="font-weight:bold;" target="_blank" title="Click to know more about EXE">EXE</a> file, <br/>in which i am calling below ProcessStartTime.vbs file to capture the start date & time of EXCEL.EXE process,<br/>----<br/>call ProcessStartTime.vbs<br/>----<br/>and i have scheduled that batch script .exe file in the scheduled task,<br/>but while running the .exe file below error message gets popped-up on the screen,<br/>Please help to <a href="https://interviewquestions.tuteehub.com/tag/resolve-622670" style="font-weight:bold;" target="_blank" title="Click to know more about RESOLVE">RESOLVE</a> the same,<br/><br/><strong>error as :- Windows Script host<br/>script: c:\aeclm\ProcessStartTime.vbs<br/>Line: 7<br/>Char: 1<br/>Error: Permission Denied<br/>code: 800A0046<br/>Source:Microsoft VBScript runtime error</strong><br/><br/>----------ProcessStartTime.vbs code-------------------<br/>Const ForReading = 1<br/>Const ForWriting = 2<br/>Const ForAppending = 8<br/><br/>Set objFSO = CreateObject("Scripting.FileSystemObject")<br/><br/>Set objLogFile = objFSO.OpenTextFile("C:\aeclm\Process_list.txt", _ <br/> ForWriting, True)<br/><br/>'objLogFile.Write _<br/>' ("Process Name,Start Time,Process ID") <br/><br/>'objLogFile.Writeline<br/><br/>strComputer = "."<br/><br/>Set objWMIService = GetObject("winmgmts:" _<br/> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")<br/><br/><br/>Set colProcessStartTrace = objWmiService.ExecQuery _<br/> ("<a href="https://interviewquestions.tuteehub.com/tag/select-630282" style="font-weight:bold;" target="_blank" title="Click to know more about SELECT">SELECT</a> * From Win32_Process")<br/><br/><br/>For Each objProcess in colProcessStartTrace<br/> <br/> if(objProcess.Name = "EXCEL.EXE")then<br/> objLogFile.Write(objProcess.Name) & "," <br/> objLogFile.Write(objProcess.CreationDate) & ","<br/> objLogFile.Write(objProcess.ProcessId)<br/> objLogFile.writeline<br/> end if<br/>Next<br/> <br/><br/>objLogFile.Close<br/>--------------------------------------------You don't have write permission in C:\aeclm. You <a href="https://interviewquestions.tuteehub.com/tag/need-25476" style="font-weight:bold;" target="_blank" title="Click to know more about NEED">NEED</a> to obtain this.<br/><br/><br/></p></body></html> | |