![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Equivalent for tasklist /svc ? Is there a PowerShell equivalent for tasklist /svc. I feel it must be there but can't find a PowerShell equivalent. I want output like I get from tasklist /FI "ImageName eq svchost.exe" /svc Thanks Andrew Watt MVP |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Equivalent for tasklist /svc ? I don't think it's there, but I want it too, now. ![]() "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message news:m4kg82d9lep7i3t9t0a4d989n1sjbqu27l@4ax.com... > Is there a PowerShell equivalent for tasklist /svc. I feel it must be > there but can't find a PowerShell equivalent. > > I want output like I get from > tasklist /FI "ImageName eq svchost.exe" /svc > > Thanks > > Andrew Watt MVP |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Equivalent for tasklist /svc ? Alex K. Angelopoulos [MVP] wrote: > I don't think it's there, but I want it too, now. ![]() > > > > "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message > news:m4kg82d9lep7i3t9t0a4d989n1sjbqu27l@4ax.com... >> Is there a PowerShell equivalent for tasklist /svc. I feel it must be >> there but can't find a PowerShell equivalent. >> >> I want output like I get from >> tasklist /FI "ImageName eq svchost.exe" /svc >> >> Thanks >> >> Andrew Watt MVP > > $FormatEnumerationLimit = 100 gwmi win32_service |? {$_.PathName -match 'svchost.exe'} | group ProcessId | ft -Wrap gr /\/\o\/\/ |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Equivalent for tasklist /svc ? little bug some missed the .exe : gwmi win32_service |? {$_.PathName -match 'svchost'} | group ProcessId | ft -Wrap will get some more (so now the same as tasklist ) gr /\/\o\/\/ /\/\o\/\/ wrote: > Alex K. Angelopoulos [MVP] wrote: >> I don't think it's there, but I want it too, now. ![]() >> >> >> >> "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message >> news:m4kg82d9lep7i3t9t0a4d989n1sjbqu27l@4ax.com... >>> Is there a PowerShell equivalent for tasklist /svc. I feel it must be >>> there but can't find a PowerShell equivalent. >>> >>> I want output like I get from >>> tasklist /FI "ImageName eq svchost.exe" /svc >>> >>> Thanks >>> >>> Andrew Watt MVP >> >> > > $FormatEnumerationLimit = 100 > gwmi win32_service |? {$_.PathName -match 'svchost.exe'} | group > ProcessId | ft -Wrap > > gr /\/\o\/\/ |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Equivalent for tasklist /svc ? I noticed a small anomaly between the tasklist result and your result. gwmi is reporting on all services, even those that are not running. The stopped processes are all shown as PID 0. So I took the liberty of making a small change to your code to get rid of these non-running services: gwmi win32_service |? {$_.PathName -match 'svchost' -and $_.ProcessId -ne 0} | group ProcessId | ft -Wrap --- Jim Holbach "/\/\o\/\/" <no@spam.mow> wrote in message news:umDMkpyiGHA.4512@TK2MSFTNGP04.phx.gbl... > little bug some missed the .exe : > > gwmi win32_service |? {$_.PathName -match 'svchost'} | group ProcessId | > ft -Wrap > > will get some more (so now the same as tasklist ) > > gr /\/\o\/\/ > > /\/\o\/\/ wrote: >> Alex K. Angelopoulos [MVP] wrote: >>> I don't think it's there, but I want it too, now. ![]() >>> >>> >>> >>> "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message >>> news:m4kg82d9lep7i3t9t0a4d989n1sjbqu27l@4ax.com... >>>> Is there a PowerShell equivalent for tasklist /svc. I feel it must be >>>> there but can't find a PowerShell equivalent. >>>> >>>> I want output like I get from >>>> tasklist /FI "ImageName eq svchost.exe" /svc >>>> >>>> Thanks >>>> >>>> Andrew Watt MVP >>> >>> >> >> $FormatEnumerationLimit = 100 >> gwmi win32_service |? {$_.PathName -match 'svchost.exe'} | group >> ProcessId | ft -Wrap >> >> gr /\/\o\/\/ |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Equivalent for tasklist /svc ? Actually I wrote a blog on it recently at http://spaces.msn.com/abhishek225/blog/cns!13469C7B7CE6E911!140.entry I extend the Process object with a Service member -- Abhishek Agrawal [MSFT] MSH Team http://spaces.msn.com/abhishek225 Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message news:m4kg82d9lep7i3t9t0a4d989n1sjbqu27l@4ax.com... > Is there a PowerShell equivalent for tasklist /svc. I feel it must be > there but can't find a PowerShell equivalent. > > I want output like I get from > tasklist /FI "ImageName eq svchost.exe" /svc > > Thanks > > Andrew Watt MVP |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Equivalent for tasklist /svc ? I have added a new Script property named, "Service" in "types.ps1.xml" to return service associated with the current Process object. <Type> <Name>System.Diagnostics.Process</Name> <Members> ... Other membersets and properties ... <ScriptProperty> <Name>Service</Name> <GetScriptBlock> @(, (Get-WmiObject Win32_Service -Filter "ProcessId='$($this.Id)'" | Group-Object ProcessId).Group) </GetScriptBlock> </ScriptProperty> </Members> </Type> Now you can do [^_^]PS[1]>gps svchost | select name,id,service | ft -auto Name Id Service ---- -- ------- SVCHOST 920 {DcomLaunch, TermService} SVCHOST 1016 {RpcSs} SVCHOST 1116 {Dnscache} SVCHOST 1176 {Alerter, LmHosts, SSDPSRV, WebClient} SVCHOST 1196 {AudioSrv, Browser, CryptSvc, dmserver...} Have fun... "Abhishek Agrawal [MSFT]" wrote: > Actually I wrote a blog on it recently at > http://spaces.msn.com/abhishek225/blog/cns!13469C7B7CE6E911!140.entry > > I extend the Process object with a Service member > > > -- > Abhishek Agrawal [MSFT] > MSH Team > http://spaces.msn.com/abhishek225 > Microsoft Corporation > This posting is provided "AS IS" with no warranties, and confers no rights. > > "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message > news:m4kg82d9lep7i3t9t0a4d989n1sjbqu27l@4ax.com... > > Is there a PowerShell equivalent for tasklist /svc. I feel it must be > > there but can't find a PowerShell equivalent. > > > > I want output like I get from > > tasklist /FI "ImageName eq svchost.exe" /svc > > > > Thanks > > > > Andrew Watt MVP > > > |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Equivalent for tasklist /svc ? "DBMwS" <DBMwS@discussions.microsoft.com> wrote in message news:460DE895-B22F-46C7-A6B0-EDA19143DE0F@microsoft.com... >I have added a new Script property named, "Service" in "types.ps1.xml" to > return service associated with the current Process object. > > <Type> > <Name>System.Diagnostics.Process</Name> > <Members> > ... Other membersets and properties ... > <ScriptProperty> > <Name>Service</Name> > <GetScriptBlock> > @(, (Get-WmiObject Win32_Service -Filter "ProcessId='$($this.Id)'" | > Group-Object ProcessId).Group) > </GetScriptBlock> > </ScriptProperty> > </Members> > </Type> Nice! It would be even better if the team could get this into PowerShell before V1 ships. :-) -- Keith |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Equivalent for tasklist /svc ? "DBMwS" wrote: > I have added a new Script property named, "Service" in "types.ps1.xml" to > return service associated with the current Process object. Woops, typo. "types.ps1.xml" -> $pshome\types.ps1xml |
My System Specs![]() |
| | #10 (permalink) |
| | Re: Equivalent for tasklist /svc ? > Nice! It would be even better if the team could get this into PowerShell > before V1 ships. :-) > > -- > Keith I would love to get this included but the chances are very very low Inthe meantime checkout the Serive tab in the task manager in Vista Beta2. Thats cool as well. -- Abhishek Agrawal [MSFT] http://spaces.msn.com/abhishek225 Windows PowerShell Team Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in message news:uQEPHTmjGHA.5036@TK2MSFTNGP04.phx.gbl... > "DBMwS" <DBMwS@discussions.microsoft.com> wrote in message > news:460DE895-B22F-46C7-A6B0-EDA19143DE0F@microsoft.com... >>I have added a new Script property named, "Service" in "types.ps1.xml" to >> return service associated with the current Process object. >> >> <Type> >> <Name>System.Diagnostics.Process</Name> >> <Members> >> ... Other membersets and properties ... >> <ScriptProperty> >> <Name>Service</Name> >> <GetScriptBlock> >> @(, (Get-WmiObject Win32_Service -Filter "ProcessId='$($this.Id)'" | >> Group-Object ProcessId).Group) >> </GetScriptBlock> >> </ScriptProperty> >> </Members> >> </Type> > > Nice! It would be even better if the team could get this into PowerShell > before V1 ships. :-) > > -- > Keith > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Sidebar appears twice in tasklist | Vista General | |||
| VB6 Equivalent | .NET General | |||
| 'runwait' equivalent | PowerShell | |||
| Equivalent to $0? | PowerShell | |||
| what is the equivalent of xp pro | Vista General | |||