Im using powershell, as Administrator in windows8.1.
I give the command Restart-Service netmon
but it fails with no service found.
ok, how do I restart netmon then?
1 Answer
First of all - your Service Same doesn't always match the Service Display Name. In this example - I would need to Restart-Service vds
:
If you want to get a full service list and look at the service name, you can do a simple Get-Service
:
You could then narrow this down using a "Where" clause similar to this Get-Service | Where {$_.Name -like "Net*"}
:
(Or you could just find your service in services.msc
or you could use sc query
)
When you have your actual service name, you can then restart, stop, start or query the service: Stop-Service | Start-Service | Restart-Service | Get-Service
Sometimes you will get a service error stating that the service isnt installed on your machine. Normally this is because you aren't running "As Admistrator":
By Elevating, these commands will start to work again: The error message isn't very good for this - and I've seen it trip people up before several times.
Edit - just re-read your question and seen you say you are running as Admin already. Are you able to post a screenshot for us please? Or confirm it by running the following:
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] “Administrator”)){
Write-Warning “You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!”
}
If your session has been properly elevated, you won't get the warning as shown in the below screenshot:
Restart-Service -Name netmon
instead. You will need to be sure you use the name of an actual service that exists, your syntax as provide in your question, is incorrect though.sc query netmon
from a command prompt, does it report that a service with that name is installed?Restart-Service btwdins
"netmon
or Network Monitor does not even appear to be a service but an executable.-Name
qualifier as optional (it's in square brackets in the docs). My point is tho is simply that the OPs syntax is correct. :) I think we're on the same page tho -- the OP is just referencing an invalid service, as the error message told him.