Author Posts

September 19, 2017 at 3:53 am

Hi all,
some help would be appreciated if possible. when i run the below cmdlet i get the following output

$service = (Get-Service -Name "SepMasterService")
$service

Status Name DisplayName
—— —- ———–
Running SepMasterService Symantec Endpoint Protection

however if i run the below through a function using Invoke-Command i get the following error
$serviceName = "SepMasterService"
$Service = (Get-service -Name $serviceName)
$service
i get the below error

Cannot find any service with service name 'System.ServiceProcess.ServiceController'.
+ CategoryInfo : ObjectNotFound: (System.ServiceProcess.ServiceController:String) [Get-Service], ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand

looks like a pretty straight forward commond. what am I doing wrong here ?

TIA
Regards
Shihan

September 19, 2017 at 5:23 am

Could you check this command

Get-Service -ComputerName $serverName -Name "SepMasterService"

September 22, 2017 at 2:18 am

Thanks Mate.
Got it working. I used DisplayName instead

[String]$displayName = "Symantec Endpoint Protection",
[String]$Status = "Stopped"
$Service = (Get-service -DisplayName $displayName)
$Service.WaitForStatus("Stopped",'00:00:30')

Cheers
Shihan