this gives me all processes with lync on the computer AAA that are not from User BBB. So far so good. but how would I end these processes now?
I tried with foreach {$_.terminate()} but that did not work.
It would be nice if someone could help me with the last step.
Use invoke-command with stop-process, it’ll be easier for you.
The wmi method would be terminate. Really important to understand methods and properties of objects when learning powershell. Do not turn objects into custom objects with the select statement(you will lose the methods if you do). Don’t use |where |where, use -and.