I'm invoking powershell command with C#, and powershell command is invoked background. and i want to terminate the background thread. everytime, i terminate the background thread, the powershell is still running which result in that i can't run that thread again. is there any method to terminate powershell execution?

the background thread as follows:

```
Task.run(()=>{ while(...) {...                             
if (cancellationToken.IsCancellationRequested)
{
    cancellationToken.ThrowIfCancellationRequested();
}}}); 

Task.run(()=>{ 
    while(...) { powershell.invoke(powershellCommand);// it will execute here, I don't know how to stop. 
} })

```