I am developing a website using .NET Core 5 for the site and .NET Framework for a backing WebAPI service. I am building both as OWIN self-hosted applications (console apps).
For the WebAPI service, I can add an Installer component in which I can specify LocalSystem as the host account; Windows displays this account name as "System" in the Services view, just as it appears for numerous other services.
For the website, .NET Core does not support the Installer component, so I had to cobble together a PowerShell script, in which I had to specify the account as "NT AUTHORITYSystem" (which I understood to be the same "local system" account), as below:
$path = "C:MyPath" $exe = "MyApp.exe" $exePath = -join($path,"",$exe) $serviceName = "MyService" $description = "My service" $displayName = "My service" $account = "NT AUTHORITYSystem" $secpassword = (new-object System.Security.SecureString) $credential = New-Object System.Management.Automation.PSCredential ($account, $secpassword) $acl = Get-Acl $path $aclRuleArgs = $account, "Read,Write,ReadAndExecute", "ContainerInherit,ObjectInherit", "None", "Allow" $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($aclRuleArgs) $acl.SetAccessRule($accessRule) $acl | Set-Acl $path New-Service -Name $serviceName -BinaryPathName $exePath -Credential $credential -Description $description -DisplayName $displayName -StartupType Automatic Start-Service $serviceName
This works; it creates the service which I can start and appears to run as expected. However, Windows uniquely displays the account for this service as "NT AUTHORITYSystem" in the Services view.
My question is: does the difference in display suggest that it is actually using a different account? Is "NT AUTHORITYSystem" the same as "System" or isn’t it? If it’s the same account, why does it display differently? If it is a different account, what are the differences, and how do I specify in PowerShell the account which appears as "System" in the services display?
Source: Windows Questions