Syntax

Restart-Service
[-Force]
[-InputObject] <ServiceController[]>
[-PassThru]
[-Include <String[]>]
[-Exclude <String[]>]

Download Full Script

Example 1: Restart a service on the local computer

PS C:\> Restart-Service -Name ‘ServiceName’


Example 2: Start all stopped network services

PS C:\> Get-Service -Name “net*” | Where-Object {$_.Status -eq “Stopped”} | Restart-Service

Purpose:This script will help you to start/restart/stop any Windows Service
Modification:Service restart script can be modified as per your requirements
Type:PowerShell Script (ps1) 
Compatibility:Windows 
Tags:PowerShell, Restart Windows Services
Reference link:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/restart-service?view=powershell-7.1