You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Ability to open the terminal with elevated privilages #582
Is there a way to open the new PS Terminal as an admin/elevated privileges without opening VS Code as an admin? If not, can that be added into the extension so that I don't have to open VS Code as an admin in order to have admin rights in the terminal? Opening VS Code as an admin causes issues with opening/running other files from outside the application.
Attached Logs
Follow the instructions in the README
about capturing and sending logs.
Reacted by Michael Yanni, Uzair Sajid, Marando Freeman, Caleb Boyd, Dan Thompson, Dimko Zhluktenko, hansvonn, Werner Kapferer, Erik Jan Meijer and Abdul Mohamed
I looked into this in the past, seemed like it might not be possible for a non-elevated process (VS Code) to attach to the console output of an elevated process (PowerShell). I'll give it one more shot at some point just to make sure.
SQL Solver (@sqlsolver) I can't repro what you're seeing. When I started VSCode as admin, both the regular PowerShell terminal and the PowerShell Integrated Terminal run as admin as well.
I was getting a non-admin error when running Import-Module. My VS Code taskbar shortcut is set to run as admin, however I had three instances open and the one without admin privilege was apparently opened from 'New Window' in the taskbar slide-up vs. the regular shortcut. When VS Code is opened from the shortcut set to run as admin you are correct, the shell is running as admin also. Thanks for your quick response to my comment.
Activity
rkeithhill commentedon Mar 20, 2017
As a work-around (for now), you can attach to a PowerShell console that you have started elevated when debugging.
rkeithhill commentedon Mar 20, 2017
Check out this blog post - https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/13/debugging-powershell-script-in-visual-studio-code-part-2/
daviwil commentedon Mar 20, 2017
I looked into this in the past, seemed like it might not be possible for a non-elevated process (VS Code) to attach to the console output of an elevated process (PowerShell). I'll give it one more shot at some point just to make sure.
iesen commentedon Nov 14, 2017
i tried that and it gives me following error
sqlsolver commentedon Dec 5, 2017
Even when opening VSCode as an admin, the PShell console is not running elevated. This should be fixed.
rkeithhill commentedon Dec 6, 2017
SQL Solver (@sqlsolver) I can't repro what you're seeing. When I started VSCode as admin, both the regular PowerShell terminal and the PowerShell Integrated Terminal run as admin as well.
sqlsolver commentedon Dec 6, 2017
I was getting a non-admin error when running Import-Module. My VS Code taskbar shortcut is set to run as admin, however I had three instances open and the one without admin privilege was apparently opened from 'New Window' in the taskbar slide-up vs. the regular shortcut. When VS Code is opened from the shortcut set to run as admin you are correct, the shell is running as admin also. Thanks for your quick response to my comment.
carrchri commentedon Nov 25, 2026
It would be great to have a new button 'Run as admin' next to the 'Run' button. I have a lot of script and some must be started as admin.