Basically, I don't have an issue with the action being taken. My question is about the status output of the action "waiting for..." message. Is there a way to suppress that message?
Example:
PS C:\Users\a.real.person.maybe> Get-Service *fewserviceswithmatchingprefixes* | Where-Object {$_.Name -notmatch 'somethinghere' -and $_.Name -ne 'alsosomethinghere' -and $_.Name -ne 'somethinghereprobably'} | Stop-Service
WARNING: Waiting for service 'thoseservicesabove' to stop...
WARNING: Waiting for service 'anotheroneofthoseservicesabove' to stop...
You can either set the value of the
$WarningActionPreference
variable at the callsite toIgnore
orSilentlyContinue
(both will suppress consumption and rendering of the warning message):Or you can use the
-WarningAction
common parameter explicitly when making the call toStop-Service
(it will only affect that particular invocation ofStop-Service
):