Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use PowerShell to stop-process, can i bypass confirm?

Tags:

I'm a powershell newbie, but I often find myself starting and stopping a small group of services when I'm debugging some code. In Powershell I can easily stop the processes using a wildcard but it makes me confirm. There is a -confirm parameter, but I must not be using it correctly?

`Stop-Process -ProcessName alcore.* -Confirm` 

Can I bypass the confirm and just stop the process?

Thanks for any help, ~ck in San Diego

like image 971
Hcabnettek Avatar asked Jun 29 '10 18:06

Hcabnettek


People also ask

How do I bypass PowerShell confirmation?

If the script uses Powershell cmdlets, you can specify -Confirm:$false to suppress the prompt.

How do you force stop a process in PowerShell?

The basic command syntax to forcefully kill a specific process is as follows: taskkill /PID process-number /F.

How do I Auto confirm in PowerShell?

You have to use the -Confirm switch to the command to prompt the user for confirmation. It forces the command to display the confirmation prompt in PowerShell. A simpler way to use the -Confirm switch would be by using it in the Remove-Item cmdlet, which can produce a confirmation action in simpler command.


1 Answers

Try

stop-process -ProcessName alcore.* -Force 

From get-help stop-process:

On Windows Vista and later versions of Windows, to stop a process that is not owned by the current user, you must start Windows PowerShell with the "Run as administrator" option. Also, you are prompted for confirmation unless you use the Force parameter.

like image 152
driis Avatar answered Sep 20 '22 16:09

driis