Why does Get-Services give me PermissionDenied for the NetTcpPortSharing service?

2k views Asked by At

I just experienced an issue that I have never seen before when displaying services in Win8.1 (with Powershell Core 6+). Running Get-Service in an Admin shell, result in the following error:

$ Get-Service

...
Get-Service : Service 'NetTcpPortSharing (NetTcpPortSharing)' cannot be queried due to the following error:
At line:1 char:1
+ Get-Service
+ ~~~~~~~~~~~
+ CategoryInfo          : PermissionDenied: (System.ServiceProcess.ServiceController:ServiceController) [Get-Service], ServiceCommandException
+ FullyQualifiedErrorId : CouldNotGetServiceInfo,Microsoft.PowerShell.Commands.GetServiceCommand

Stopped  NetTcpPortSharing  NetTcpPortSharing
...

Looking at the details of this Service I see:

enter image description here

Using net helpmsg 15101 I then got this:
The resource loader failed to load MUI file because the file fail to pass validation.

I have no idea what this means, of even if it's relevant as it was shown in the Description field.

So none of this info makes sense, and I have no idea what created this service, nor what it is doing or was using it. However I know that a few days ago I didn't have this problem, but I don't know if I had the service. I have been playing a lot with various Remoting features, but from this machine to another W10.

What is NetTcpPortSharing used for and can I safely delete it?
(Where does it typically come from?)


Possibly Related References:


UPDATE (according to magicandre1981)

# $key = 'HKLM:\SYSTEM\CurrentControlSet\Services\NetTcpPortSharing'
# Get-ItemProperty -Path $key

DisplayName        : NetTcpPortSharing
ErrorControl       : 1
ImagePath          : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SMSvcHost.exe
Start              : 4
Type               : 32
Description        : @%systemroot%\Microsoft.NET\Framework64\v4.0.30319\ServiceModelInstallRC.dll,-8200
ObjectName         : NT AUTHORITY\LocalService
ServiceSidType     : 3
RequiredPrivileges : {SeCreateGlobalPrivilege}
FailureActions     : {132, 3, 0, 0...}
PSPath             : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetTcpPortSharing
PSParentPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
PSChildName        : NetTcpPortSharing
PSDrive            : HKLM
PSProvider         : Microsoft.PowerShell.Core\Registry

The config file for this is located here:

# find //c/Windows/Microsoft.NET/Framework*/ -iname "SMSvcHost.exe.config"
//c/Windows/Microsoft.NET/Framework/v4.0.30319/SMSvcHost.exe.config
//c/Windows/Microsoft.NET/Framework64/v4.0.30319/SMSvcHost.exe.config
1

There are 1 answers

9
magicandre1981 On BEST ANSWER

This service belongs to Windows Communication Foundation (WCF) and is part of .net framework.

On my Windows 8.1 Pro x64 (German), the registry setting under the key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetTcpPortSharing

is

# Description:
%systemroot%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\ServiceModelInstallRC.dll,-8200 
# DisplayName:
%systemroot%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\ServiceModelInstallRC.dll,-820
# Imagepath:
%systemroot%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\SMSvcHost.exe

So check which settings you have for for Description. I have no idea why it is .net 3.x and 4.0 for you.