How to debug as NT AUTHORITY\SYSTEM in Visual Studio?
Asked Answered
P

2

6

I'm trying to debug as NT AUTHORITY\SYSTEM. I've tried to use the methods described in the following question: RunAs A different user when debugging in Visual Studio

Yet, what credentials do I need to use in order to pass through authentication?

Privacy answered 30/1, 2014 at 19:44 Comment(1)
Were you attempting to debug a stand-alone application or a web application?Faker
B
8

runas cannot start as System/Local Service/Network Service etc. But psexec -s can start a process as System.

-s Run the remote process in the System account.

Bubal answered 30/1, 2014 at 19:50 Comment(3)
Thanks Remus! Looks promising. One problem, the process is running in background, no UI.Privacy
OK, found what's wrong. We need to use -i flag before -s in order to run the process with UI. Full command: psexec -i -s "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"Privacy
I think MichaelS's comment above is the answer, since Visual Studio process needs to be run with user interface.Poco
F
0

In my case, I was attempting to debug a web application using Visual Studio. Running Visual Studio using psexec -s -i didn't work for me, because the SYSTEM account did not have IIS Express configured.

What did work for me, however, was to rebuild my app (in debug mode), publish it to my local folder (in debug mode) where my IIS web app was pointing to it and then configure the apppool to run as the LocalSystem account.

enter image description here

I then launched the web application to initialize the web process. After initializing the web process, I would attach my Visual Studio debugger to the process:

Debug -> Attach to Process (Ctrl + Alt + P) -> Show processes from all users (checkbox)

Then select and attach to the process:

enter image description here

Faker answered 10/2, 2020 at 16:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.