Thursday, January 24, 2019

Emulate taskkill in C#/Powershell

So i wrote a Powershell script that creates a notify icon and the program gets killed if a certain event occurs (via powershell job). I found out that if i kill my program with taskkill, the notify icon vanishes correctly and everything is fine. However if i use Stop-Process, the icon stays in the taskbar until i hover over it. I already tried to implement the EndTask function, but since my script disabels the main window, i cannot get a valid handle for the process... Any idea what taskkill does differently? Is there a way to implement the taskkill functions in powershell directly instead of just writing taskkill /pid $parentpid?

Emulate taskkill in C#/Powershell Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team