![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Collecting a list of Services What I am trying to do is create a list of services that are set to automatic and are stopped. I have collected several scripts to lists the services but can not find the way to get the Startup Type and then filter it in the script. I have the following... Stopped Services get-service | where-object {$_.Status -eq "Stopped"} | sort DisplayName Running Services Get-Service | Where-Object {$_.Status -eq 'Running'} | sort DisplayName So How would I list Stopped Services that are set to Automatic? -- Glenn "Mykre" Wilson Blog: http://www.virtualrealm.com.au/blogs/mykre http://www.virtualrealm.com.au XNA News and Resources from Down Under |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Collecting a list of Services Hi Glen, When you use a WMI query, the startup mode is also returned. for example: gwmi Win32_Service | where {$_.Startmode -eq "Manual"} this will return all Services that are set to manuel rgds, Bart "Glenn Wilson" wrote: > > What I am trying to do is create a list of services that are set to > automatic and are stopped. I have collected several scripts to lists the > services but can not find the way to get the Startup Type and then filter it > in the script. > > I have the following... > Stopped Services > get-service | where-object {$_.Status -eq "Stopped"} | sort DisplayName > Running Services > Get-Service | Where-Object {$_.Status -eq 'Running'} | sort DisplayName > > So How would I list Stopped Services that are set to Automatic? > > -- > Glenn "Mykre" Wilson > Blog: http://www.virtualrealm.com.au/blogs/mykre > > http://www.virtualrealm.com.au > XNA News and Resources from Down Under |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Collecting a list of Services Bart wrote: > "Glenn Wilson" wrote: >> What I am trying to do is create a list of services that are set to >> automatic and are stopped. I have collected several scripts to lists the >> services but can not find the way to get the Startup Type and then filter it >> in the script. >> >> I have the following... >> Stopped Services >> get-service | where-object {$_.Status -eq "Stopped"} | sort DisplayName >> Running Services >> Get-Service | Where-Object {$_.Status -eq 'Running'} | sort DisplayName >> >> So How would I list Stopped Services that are set to Automatic? >> > When you use a WMI query, the startup mode is also returned. > > for example: > > gwmi Win32_Service | where {$_.Startmode -eq "Manual"} > > this will return all Services that are set to manuel > Strange, the cmdlet Set-Service has a parameter [-startupType {<Automatic> | <Manual> | <Disabled>] which is missing in get-service (also no property) with WMI you get inconsistently Automatic shorted to Auto: gwmi Win32_Service | group-object StartMode Count Name Group ----- ---- ----- 10 Disabled {Alerter, ClipSrv, HidServ, Messenger...} 45 Manual {ALG, AppMgmt, aspnet_state, BITS...} 54 Auto {AntiVirScheduler, AntiVirService, ASChann....} So for the op the proper anwer is $a = gwmi Win32_Service $a | where {($_.Startmode -eq "Auto") -and ($_.State -eq "Stopped")} HTH -- Greetings Matthias |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Display list of log ons accounts used by windows services | PowerShell | |||
| Network List Service is missing from the list of services | Network & Sharing | |||
| I have no Spool Service on Services list... | Vista print fax & scan | |||
| Comprehensive list of unnecessary services?? | Vista installation & setup | |||