Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9098661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:24:54+00:00 2026-06-17T00:24:54+00:00

I am trying to impersonate network service using advapi32 LogonUser(NETWORK SERVICE, NT AUTHORITY, null,

  • 0

I am trying to impersonate network service using advapi32

LogonUser("NETWORK SERVICE", "NT AUTHORITY", null, LOGON32_LOGON_SERVICE, LOGON32_PROVIDER_DEFAULT, ref token)

But keep getting Access is denied error, on a Windows 8 machine. Any ideas? (I googled a lot but can’t find an answer).

<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">        
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
      <applicationRequestMinimum>
        <defaultAssemblyRequest permissionSetReference="Custom" />
        <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
      </applicationRequestMinimum>
    </security>
  </trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application />      
  </compatibility>  
</asmv1:assembly>

EDIT:

So after few attempts the impersonation seems to work, but I cannot ever authenticate as the host’s Network Service. How can an application pool run under a network service than?

Using

LOGON32_LOGON_SERVICE

results in:

Unhandled Exception: System.ComponentModel.Win32Exception: Access is denied
   at Tools.Network.Impersonator.Impersonate(String userName, String domainName,
 String password, LogonType logonType, LogonProvider logonProvider)
   at Tools.Network.Impersonator..ctor(String userName, String domainName, Strin
g password, LogonType logonType, LogonProvider logonProvider)
   at Impersonation.Program.Main(String[] args)

Using

LOGON32_LOGON_NEW_CREDENTIALS

results in:

System.IO.IOException: Logon failure: unknown user name or bad password.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Bo
olean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean ov
erwrite)
   at Impersonation.Program.Main(String[] args)

Puzzled.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:24:55+00:00Added an answer on June 17, 2026 at 12:24 am

    Finally! I have found an answer:

    How do I 'run as' 'Network Service'?

    and

    http://geek.hubkey.com/2008/02/impersonating-built-in-service-account.html

    On Windows 8..
    “Microsoft have changed the default behaviour of this in Windows 8 / Windows Server 2012. To allow interactive services, you need to find the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows and change NoInteractiveServices from 1 to 0.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to impersonate the Core Service in Tridion 2011 SP1 HR1 and
I am trying to host a WCF web service in IIS using Windows Authentication.
I'm trying to launch notepad.exe(as a simpler test) from a web service using process.Start().
I'm trying to use impersonation with my WCF service (using net.tcp binding) hosted in
Trying to execute a Powershell cmdlet from a MVC 3 Controller using impersonation but
I am trying to call my WCF service through a Flex application. I'm getting
I'm trying to execute the following code using System.DirectoryServices; public bool HasVirtualDirectory(string serverName, string
I'm using the following Microsoft example . Every time the WindowsIdentity instance calls .Impersonate(),
Trying to replace certain words in HTML pages with the same word but as
Trying to select unique years from timestamp column in a table but so far

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.