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?

Community
  • 1
  • 1
MichaelS
  • 7,023
  • 10
  • 51
  • 75

2 Answers2

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.

Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569
  • Thanks Remus! Looks promising. One problem, the process is running in background, no UI. – MichaelS Jan 30 '14 at 20:28
  • 4
    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" – MichaelS Jan 30 '14 at 20:39
  • I think MichaelS's comment above is the answer, since Visual Studio process needs to be run with user interface. – Hamid Heydarian Jun 08 '17 at 00:32
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

RobC
  • 22,977
  • 20
  • 73
  • 80