# Help with script cmdlet (get-service) on remote computer

**URL:** <https://forums.powershell.org/t/help-with-script-cmdlet-get-service-on-remote-computer/9375>\
**Category:** PowerShell Help\
**Created:** [September 18, 2017, 10:23pm UTC](https://forums.powershell.org/t/help-with-script-cmdlet-get-service-on-remote-computer/9375 "2017-09-18T22:23:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shihanpietersz](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shihanpietersz](https://forums.powershell.org/u/shihanpietersz)\
**Post date:** [September 18, 2017, 10:23pm UTC](https://forums.powershell.org/t/help-with-script-cmdlet-get-service-on-remote-computer/9375/1 "2017-09-18T22:23:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![deepitpro](https://avatars.discourse-cdn.com/v4/letter/d/48db29/32.png) [@deepitpro](https://forums.powershell.org/u/deepitpro)\
**Post date:** [September 18, 2017, 11:53pm UTC](https://forums.powershell.org/t/help-with-script-cmdlet-get-service-on-remote-computer/9375/2 "2017-09-18T23:53:31Z")

</div>

Could you check this command

Get-Service -ComputerName $serverName -Name “SepMasterService”

---

<div class="post-metadata">

**Author:** ![shihanpietersz](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shihanpietersz](https://forums.powershell.org/u/shihanpietersz)\
**Post date:** [September 21, 2017, 8:48pm UTC](https://forums.powershell.org/t/help-with-script-cmdlet-get-service-on-remote-computer/9375/3 "2017-09-21T20:48:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:37pm UTC](https://forums.powershell.org/t/help-with-script-cmdlet-get-service-on-remote-computer/9375/4 "2024-05-16T20:37:30Z")

</div>


