powershell - Unregister-Event not removing orphaned event subscriptions -


I am using this to subscribe to events off to a particular computer:

  register -WMIEvent -ComputerName MyServer1 -query "select Win32_ComputerShutdownEvent *" -SourceIdentifier "ShutdownWatcher" action {write-host "MyServer1 has stopped"}  

it seems Works and I get off the text when the computer is off.

The problem is that there is a one-time event and that I subscribed event subscription nothing has been removed to try to use the following to remove.

  unregistered event -SourceIdentifier "ShutdownWatcher"  
event subscription orphaned and can no longer be removed it. It is orphaned and completely useless as it does not fire when another shutdown. is done. I want to remove the membership once it has been removed

Does anyone know how to remove orphan event subscription? One way to stop is Powe's Rshell session but I do not want to actually do that.

subscription with you should be able to clear all out:

  Go-Event Subscriber-Force | Unregistered-event-force  

Comments