I am trying to show the name (only the name) of all installed services containing the string "SQL". For example, I want to see
- SQLAgent $ SQL2008_R2
- SQLBrowser
- SQLWriter
So, I try this:
Get-WmiObject Win32_Service
Shows all services, but as a list.
Exit Code : 0 Name : ProtectedStorage ProcessId : 664 StartMode : Manual State : Running Status : OK Exit Code : 1077 Name : QWAVE ProcessId : 0 StartMode : Manual State : Stopped Status : OK (etc...)
This is good, but I just want to see that name. Therefore, I type:
Get-WmiObject Win32_Service | select-object Name
And I get what I expect:
sppuinotfy SQLAgent$SQL2008_RT SQLBrowser SQLWriter SSDPSRV (etc ..)
Things are good. I take the following step of filtering names to include only those related to SQL:
Get-WmiObject Win32_Service | select-object Name | select-string -pattern 'SQL'
And now this is confusing. Here is my conclusion:
@{Name=BcmSqlStartupSvc} @{Name=MSOLAP$SQL2008_R2} @{Name=MSSQL$SQL2008_R2} (etc ...)
Why am I getting this output instead of names? What should I enter to get only names?
source share