Bruce Adamczak

I have spent years working in perfmon, so I thought I would share some tips and tricks on the tool!

Windows 2012 Core Survival Guide – Managing Services

Windows 2012 Core Survival Guide – Managing Services

  • Comments 1
  • Likes

Learn about my 2012 Core Survival Guide here.

Managing Services

This module is going to look at how to manage services.  The key to using PowerShell to manage any service is to know the exact spelling of the service name.

How to list services

PowerShell Command:

Get-service | Format-table -autosize

The output below show each services status, name and display name.

 

How to view a single service

You can use the "NAME" of the service to display a single service's information.

PowerShell Command:

Get-service | where name -eq BITS |Format-list

In the output below we use the format-list (or fl) to show all of the service's attributes.

 

How to start a single service

To start a service there is a simple PowerShell cmdlet called Start-Service. 
Below I use it to start the BITS service.

PowerShell Command:

Start-Service -name BITS

The output below shows the current status of the service, followed by the command to start the service (in yellow), and followed by a command to confirm the status.

 

How to stop a service

Stopping a service is easy too.  I use the Stop-Service cmdlet below to stop the BITS services.

PowerShell Command:

Stop-Services -name BITS

The output below shows the current status of the service, followed by the command to stop the service, and followed by a command to confirm the status.

 

How view a Service Startup Type

In order to view the startup type I had to make a WMI call.

PowerShell Command:

Get-wmiobject win32_service | where Name -eq WinRM

In the screen shot below "StartMode" is the startup type of the service and it is set to disabled.  There are 3 possible values for this setting Manual, Automatic, and Disabled.

 

How to change the Service Startup Type

The Set-Service cmdlet has three possible settings for "-StartupType" flag: Automatic, Disabled, and Manual.

PowerShell Command:

Set-Service -name WinRM -StartupType Automatic

The output below shows the current status, followed by the command to disable the WinRM service, and followed by the command to confirm the change.

 

I hope you found this useful.  Please leave me a comment.  Let me know if there are any core tasks you would like me to cover.

Bruce

 

Comments
  • how do we change the account on the service?

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment