InterviewSolution
| 1. |
Solve : Kill wscript.exe without WMI service permission? |
|
Answer» Greetings all. I'm on Windows 7 professional, and I do not have admin rights. I use many VBScript files, and have no issue there. My issue is that every time I run one of them, the WSCRIPT.exe process is left running. If there gets to be several instances of it the cpu usage spikes, the fan goes into overdrive, and my laptop sounds like a jet about to take off until I manually kill them all using the task MANAGER. This is what I have TRIED. My issue is that every time I run one of them, the wscript.exe process is left running Please post one of the scripts giving you problems. Your problem can be recreated by using the RUN method to start a secondary program/script and waiting for a return that never happens. Does this only happen with WScript/CScript? Just a thought. Quote from: Geek-9pm on May 29, 2013, 03:47:09 PM Greg, If it is your laptop, why don't you have admin rights? Sorry for the lack of info. It is a work laptop, and once we transitioned to W7, all admin rights gone. Most people had them with XP, but now I cannot rely on it if I am writing a script for others. Thank.Quote from: Sidewinder on May 30, 2013, 04:10:11 AM Please post one of the scripts giving you problems. Your problem can be recreated by using the RUN method to start a secondary program/script and waiting for a return that never happens. Sidewinder, here is a SAMPLE script that just pulls some data from a database. Note, I changed the DSN name and query and all that, not that it would mean anything to anyone, but just covering my rear. Anyhow, this script works exactly as it should, but leaves wscript.exe running after it is done. Code: [SELECT] Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") userid = inputbox("Enter EID") password = inputbox("Enter password") strSQL = "SELECT SomeColumn FROM SomeTable" cn.Open "DSN=SomeDSN;Password=" & Trim(password) & ";User ID=" & Trim(userid) & ";" Set rs = cn.Execute(strSQL) With rs .movefirst While Not (.EOF AND .BOF) On Error Resume Next MsgBox "Col1 = " & .fields(0) & vbcrlf & _ "Col2 = " & .fields(1) .MoveNext Wend End with rs.close Set rs = nothing Set cn = nothing Wscript.quit Just for grins, I put 'MsgBox "Hello"' in a script, with nothing else, and it did not leave an instance of wscript running, so I wonder if it has something to do with the objects. Just to test, here is another simple one that *does not* leave wscript.exe running. Code: [Select] Set wshShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") strFilePath = wshShell.ExpandEnvironmentStrings("%temp%") & "\Test.txt" If objFSO.FileExists(strFilePath) Then 'Delete the file if it exists objFSO.DeleteFile(strFilePath) End if set WriteText = objFSO.CreateTextFile(strFilePath) WriteText.WriteLine("Hello") Set objFSO = nothing Set WriteText = nothing I got it now. I had "While Not (.EOF AND .BOF)" where I should have had only "While Not (.EOF)". I copied from one of my Access VBA scripts without thinking. Thanks all. |
|