0

I have a service running with a service account. I have a logged into the machine using administrator account. I want to find username using which the service is running.

I tried below

"Get-WmiObject Win32_Process -Filter "name='myservicename*'" | 
Select Name, @{Name="UserName";Expression={$_.GetOwner().Domain+"\"+$_.GetOwner().User}} | 
Sort-Object UserName, Name"
usr021986
  • 3,421
  • 14
  • 53
  • 64

1 Answers1

0

As per Bill_Stewart mentioned in the comment, it worked for me

 Get-WmiObject Win32_Service -Filter "Name LIKE 'myservicename%'" | Select-Object Name,StartName
usr021986
  • 3,421
  • 14
  • 53
  • 64