DirectoryServices ServiceAccountName NETWORKSERVICE rather than NETWORK SERVICE RRS feed

  • Question

  • When iterating through the children of the computer using DirectoryServices I'm seeing the ServiceAccountName property for services that run under the "NT AUTHORITY\NETWORK SERVICE" account show as "NT AUTHORITY\NETWORKSERVICE".  Why is that?

    Module Module1
      Sub Main()
      End Sub
      Private Sub Iterate()
        Dim dirEntry As New DirectoryServices.DirectoryEntry("WinNT://" & Environment.MachineName & ",computer")
        For Each de As DirectoryServices.DirectoryEntry In dirEntry.Children
          Dim pauseForDramaticEffect As Boolean = False
          For Each p As String In de.Properties.PropertyNames
            Dim pv As String = de.Properties.Item(p).Value.ToString()
            If p = "ServiceAccountName" AndAlso pv Like "*NETWORKSERVICE" Then pauseForDramaticEffect = True
            Console.WriteLine(p & "  --  " & pv)
          If pauseForDramaticEffect Then
            Console.WriteLine("Press enter to continue...")
          End If
      End Sub
    End Module

    May we all make money in the sequel.

    Thursday, March 20, 2014 10:08 PM


  • Hello Dave,

    Being confused that what is meaning for “run under the "NT AUTHORITY\NETWORK SERVICE"”, I run the codes but cannot not find the NT AUTHORITY\NETWORK SERVICE within the input.

    For why it shows NT AUTHORITY\NETWORKSERVICE rather than NT AUTHORITY\NETWORK SERVICE, it is described here:

    Therefore, you will receive a localized name for this account from the LookupAccountSid function, but the name of the account must be NT AUTHORITY\NetworkService when you call CreateService or ChangeServiceConfig, regardless of the locale, or unexpected results can occur.

    If I misunderstand, please let me know.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 21, 2014 5:39 AM