How to use wmic job get / list in CMD to get process name and location?

I need to get the exact location of the name of the process that is performing the scheduled task. I want to use WMIC JOB (if you have other suggestions .. let me know) to get this, but I don’t know HOW exactly. I tried several options, but so far no luck.

How do I?

+6
source share
3 answers

Here's a start.

Get Schedule Service Process ID

 wmic service where name='schedule' get ProcessId ProcessId 288 

Get the process that is the identifier of the parent Schedule process

 wmic process where ParentProcessId=288 

Edited

I don't think that at Microsoft, system tasks are what you are looking for:

The task object allows you to manage groups of processes as a whole. Job objects are potential, protected, compatible objects that manage the attributes of their associated processes. Operations performed on the task object affect all processes associated with the task object. Examples include enforced restrictions, such as the size of the working set and the priority of a process, or the termination of all processes associated with a job.

I think you are looking for a process.

To answer your question, I am looking for processes launched by the schedule service. If you want an exact location, it is set by the ExecutablePath property.

 wmic process where ParentProcessId=288 get ExecutablePath ExecutablePath C:\Windows\system32\wuauclt.exe 
+5
source

The following steps will work, although you only need β€œ CommandLine ” or β€œ ExecutablePath ” - not both:

 wmic process where "ProcessID=1111" get CommandLine, ExecutablePath 

It will return something like the following, showing where the program for PID 1111 is running:

 "C:\Program Files (x86)\Common Files\MyProgram\Agent\agent.exe" 
+5
source

WMIC has built-in progressive help, so you can learn its syntax with /? anywhere

 C:\WINDOWS\system32>wmic wmic:root\cli>/? [global switches] <command> 
-1
source

Source: https://habr.com/ru/post/901794/


All Articles