Monday, January 19, 2009

contain the character sequence

to find running services that contain the character sequence 'sql' in the service's name

PS R:\> get-service "*sql*"
| where-object { $_.status -eq "running" }

or,

PS R:\> get-service
| where-object { $_.status -eq "running" }
| where-object { $_.name -match ".*sql.*" }


Status Name DisplayName
------ ---- -----------
Running MSSQLServer MSSQLServer

No comments:

Post a Comment