Manage Windows services with PowerShell. In this article, we want to introduce you to PowerShell by managing Windows services so that you can easily and quickly control and manage Windows services. You can also buy and use the Windows VPS Server from eldernode.
As you know, one of the most important parts of any operating system is the services that run it. In general, it can be said that each part of the operating system that starts has a special service that can be managed and controlled.
In this article, we will manage Windows services with PowerShell so that you do not have any problems if you need to use PowerShell in Windows Nano Server or Windows Server Core.
Table of Contents
Manage Windows services with PowerShell
* First, open a PowerShell terminal with Administrator access.
* The first step in working with services in PowerShell is to get a list of services or search among them, for which the following command can be used.
Get-Service
The Get-Service command displays a list of all services, the output of which is as follows.
PS C:\WINDOWS\system32> Get-Service Status Name DisplayName ------ ---- ----------- Running AdobeARMservice Adobe Acrobat Update Service Stopped AJRouter AllJoyn Router Service Stopped ALG Application Layer Gateway Service Running AppHostSvc Application Host Helper Service Stopped AppIDSvc Application Identity Running Appinfo Application Information Running AppMgmt Application Management Stopped AppReadiness App Readiness Stopped AppVClient Microsoft App-V Client Stopped AppXSvc AppX Deployment Service (AppXSVC)
By default, you will see the three main sections Status, Name, and Display.
Now if you plan to search and list a specific service, you can use filtering each of the parameters.
for example:
Display all services whose names begin with the letters wi:
Get-Service -Name wi*
Display all services whose display name starts with the letters win:
Get-Service -DisplayName win*
Note: If you have access to another computer through the network, you can see the list of services of that system as follows from the following command.
Get-Service -ComputerName Server1
One of the most important points in services is Dependent services, which may be used to troubleshoot services, to run, and so on.
The following command can be used to get a list of special services for Dependency services:
Get-Service -Name WinDefend -DependentServices
The RequiredServices parameter can be used to get a list of services required by a service.
Get-Service -Name WinDefend - RequiredServices
Explain the management instructions of the services
Stop the service with PowerShell
The following command can be used to stop a service via PowerShell.
Stop-Service -Name Windefend
Start the service with PowerShell
Like the structure of the PowerShell Stop Service command, the Start-Service command is used.
Start-Service -Name Windefend
Restart the service with PowerShell
One of the most common commands used with services is to restart the structure.
Restart-Service -Name Windefend
Suspension of service with PowerShell
Another command that you may be less familiar with is service suspension, which will temporarily stop a service.
Suspend-Service -Name Windefend
Similarly, you can manage Windows services with PowerShell.
For more information on these commands and how they work, use the Get-Help command to learn more about these commands.
Goodluck.