There are some windows services hosted whose display name starts with a common name (here NATION). For example:
Is there some command to get all the services like 'NATION-'. Finally I need to stop, start and restart such services using the command promt.
The services in Windows can be listed using the Service Manager tool. To start the Service Manager GUI, press ⊞ Win keybutton to open the “Start” menu, type in services to search for the Service Manager and press Enter to launch it. The services can also be listed using the command-line prompt (CMD) or the PowerShell.
In the Services window, Action > Export... menu can give you the list as a . txt or . csv file.
Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. (Optional) Type the following command to view a list of all the services and press Enter: sc queryex state=all type=service.
Using the Get-Service PowerShell cmdlet, you can generate a list of Windows Services running on your Windows 10/8/7 computer. Open an elevated PowerShell console, type Get-Service and hit Enter. You will see a list of all the Services installed on your Windows system.
sc queryex type= service state= all | find /i "NATION"
/i
for case insensitive searchtype=
is deliberate and requiredUsing PowerShell, you can use the following
Get-Service | Where-Object {$_.displayName.StartsWith("NATION-")} | Select name
This will show a list off all services which displayname starts with "NATION-".
You can also directly stop or start the services;
Get-Service | Where-Object {$_.displayName.StartsWith("NATION-")} | Stop-Service Get-Service | Where-Object {$_.displayName.StartsWith("NATION-")} | Start-Service
or simply
Get-Service | Where-Object {$_.displayName.StartsWith("NATION-")} | Restart-Service
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With