1

I am trying create a process of the windows reliability monitor and kill it after I take a screenshot.

I am having trouble to get the process and automatically close it before I take the screenshot because there is no process ID that identifies that window.

there is any way to close the reliability monitor via PowerShell?

$psi = New-object System.Diagnostics.ProcessStartInfo
$psi.CreateNoWindow = $false
$psi.UseShellExecute = $true
$psi.RedirectStandardOutput = $false
$psi.RedirectStandardError = $false
$psi.FileName = "Perfmon"
$psi.Arguments ="/rel"
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $psi
[void]$process.Start()
#$output = $process.StandardOutput.ReadToEnd()
$process.id
Start-Sleep 5
kimo pryvt
  • 431
  • 5
  • 12
  • 24
  • 1
    Starting `perfmon /rel` seems to start `perfmon` wich starts `control` *(Windows Control Panel)* wich passes its results to `explorer` so there is no process to kill. Perhaps you can search for the Window and send it a close message or perhaps even better yet, there's a command line report for the reliability monitor *(haven't checked but I would assume so)* – Lieven Keersmaekers Jan 13 '17 at 06:50
  • The reliability monitor is very special because it does not have command line and you can only export the information in a xml format that does contain a very basic information. For there reason I need to take screen shots to get the information of the machine........ – kimo pryvt Jan 13 '17 at 07:51

1 Answers1

1

perfmon /rel starts perfmon but ends up opening the Reliability Monitor in the Explorer Process so there is no Process you can kill. As per your own comments the Reliability Monitor has no command line reporting you can make use of, all that I can think of is to

  • enumerate the windows of the shell
  • find the Reliability Monitor
  • Quit the window

in code

$shell = New-Object -ComObject Shell.Application
$window = $shell.Windows() | Where-Object { $_.LocationName -eq "Reliability Monitor" }
$window | ForEach-Object { $_.Quit() }