PowerShell script can’t find and stop the Webex process

August 7, 2026 4 answers
Asked by MellowPine47
I'm trying to create a PowerShell script that closes Webex at a specific time. When I type the command manually, I can stop the process after identifying the correct executable, but saving the command as a .ps1 file causes a brief red error message and Webex remains open. The original command was: Get-Process -Name "Webex" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue Write-Host "Webex has been stopped." -ForegroundColor Green How can I identify the correct process and make the script show or log any errors instead of hiding them?

Answers

BrightHarbor8
The name shown in Task Manager isn’t always the name PowerShell uses. Check the actual process names with: Get-Process | Where-Object {$_.ProcessName -like "*Webex*"} `Get-Process -Name` expects the process name without `.exe`. If the executable is `CiscoCollabHost.exe`, use: Get-Process -Name CiscoCollabHost | Stop-Process -Force You can also inspect the result before stopping anything: $p = Get-Process | Where-Object {$_.ProcessName -like "*Webex*"} $p $p | Stop-Process -Force

MellowPine47: That command works when I type it directly in PowerShell, but running the saved .ps1 file briefly shows red error text and doesn’t close Webex.

Reply to this answer
CleverBirch64
Task Manager’s friendly display name, process name, and executable filename can all differ. `Webex` may be the app label while the real process is something like `CiscoCollabHost`. Run `Get-Process` and use the exact `ProcessName` value, without the `.exe` extension. Also verify that the process is running under your account and that PowerShell has enough permissions to terminate it.
Reply to this answer
QuietCedar22
Remove `-ErrorAction SilentlyContinue` while troubleshooting. Those switches are hiding the useful error message, which is probably why the script appears to just repeat or do nothing. Also, the `Write-Host` line always prints success even if no process was found or stopping it failed. Test the process first and only print success when a process was actually stopped.
Reply to this answer
SilverMango31
The script may be running in a different context from the interactive PowerShell window. Confirm that the .ps1 file is actually being executed with PowerShell, and check whether the execution policy blocks scripts. For testing, run it from a PowerShell window so the error remains visible instead of launching the file by double-clicking it. You can also capture errors with a transcript or a try/catch block.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions