Solved

Using sc to list services and their startup type in order on Windows Server

Posted on 2010-11-10
5
826 Views
Last Modified: 2012-05-10
I'm looking to use sc to list all of the services (alphabetically) on a system and display their start-up type. Any ideas? I looked at the helped syntax but didn't know if it might require power shell?
0
Comment
Question by:adamshields
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 55

Expert Comment

by:Bill Prew
ID: 34108613
We should be able to do this with a BAT script, can you give a small sample of what you want the output to look like?

~bp
0
 
LVL 3

Author Comment

by:adamshields
ID: 34108694
I was hoping to be able to use a one liner to take care of it but that doesn't seem like it's going to happen that easily with powershell as I'm unable to get it to list the startup types.

Get-Service * |Sort Name

The code below is close but it needs to sort the services names alphabetically first.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_Service",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "StartMode: " & objItem.StartMode
Next

Open in new window

0
 
LVL 55

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 34108725
How about this?

wmic service get caption,startmode|sort

~bp
0
 
LVL 3

Author Closing Comment

by:adamshields
ID: 34108732
Thanks!
0
 
LVL 55

Expert Comment

by:Bill Prew
ID: 34108751
Welcome, glad that was useful.

~bp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question