Answer the question
In order to leave comments, you need to log in
What Windows system event occurs when a (second) monitor is connected?
I want to assign a task to the Scheduler when a second monitor is connected. In fact, the connected second monitor via HDMI becomes the main one, as well as the sound device associated with it. However, often the connection is initiated not by the computer, but by the directly turned on monitor, the Windows computer (7x32) determines the connection. You need to find out which event is taking place in order to assign some Scheduler task to it.
Answer the question
In order to leave comments, you need to log in
To solve a similar problem, I used ProcessMonitor.
Found a pattern. When an additional monitor is connected/disconnected, the process "C:\Windows\System32\svchost.exe -k netsvcs -p -s ShellHWDetection" is executed. Most likely, the process is also executed during other system events, but for now this is enough for me.
What I did next:
1) Enabled "Audit process creation" using GPO.
Computer Configuration - Windows Configuration - Security Options - - Advanced Audit Policy Configuration - Verbose Monitoring - Audit Process Creation
Either CMD as administrator 'auditpol.exe /set /category:"Verbose Monitoring" /subcategory:"Process Creation" /success:enable /failure:enable'
2) Now the "Security" log logs the launch of processes.
For convenience, I created a custom view in the Event Viewer
XML query
*[System[(EventID=4688)]] and *[EventData[Data[@Name='ParentProcessName'] and (Data='C:\Windows\System32 \svchost.exe')]] and *[EventData[Data[@Name='NewProcessName'] and (Data='C:\Windows\System32\dllhost.exe')]]
3) Well, then I created my task . Trigger configured "On event", query above.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question