Question

I am simply trying to kill a process using a batch that calls a vbscript, but i need the vbscript to do it silently. Or can this not be done without UAC prompting for privileges?

Was it helpful?

Solution

Used WMIC instead

wmic process where name="wscript.exe" call terminate > nul

OTHER TIPS

You can TASKKILL a process with PID on a remote system, using different user credentials, and TASKLIST to list them.

At a command prompt type taskkill /? or this taskkill on technet. Using PID will prevent terminating a wrong process with the same. For example, a computer with both 2007 and 2010 versions of office installed and only the 2007 version needs terminating.

See tasklist /? or this tasklist on technet.

You can even combine PSEXEC to fill the gap which TASKLIST cannot do remotely.

To run a script or application in the Windows Shell using the ShellExecute method (cf msdn.microsoft.com):

Syntax
      .ShellExecute "application", "parameters", "dir", "verb", windowFlag
Key
   application   The file to execute (required)
   parameters    Arguments for the executable
   dir           Working directory
   verb          The operation to execute (runas/open/edit/print)
   windowFlag    View mode application window (normal=1, hide=0, ...)

You can try this:

Set denyUAC = CreateObject("Shell.Application")
denyUAC.ShellExecute "cscript", "D:\demo\vbscript.vbs", "", "runas", 0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top