Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. function CheckRunningProcessesFunc
  2. {
  3. $Processes = (Get-Variable InclusionList).Value.CheckedItems #List of proceese to check if they are on or off
  4. $RunningProcesses = Get-WMIObject Win32_Process -filter "Name='adc.exe' OR Name='optask.exe'" | select -expand path #current running processes
  5. foreach ($Process in $Processes)
  6. {
  7. $TimeNow = get-date -Format ‘HH:mm:ss’
  8. $Text = $TimeNow + " " + $Process
  9. if ($RunningProcesses -contains $Process)
  10. {
  11. $Result = $Text + ' is On'
  12. (Get-Variable ListBox).Value.Items.Add($Result)
  13. }
  14. else
  15. {
  16. $Result = $Text + ' is Off'
  17. (Get-Variable ListBox).Value.Items.Add($Result)
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement