twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
994 stars 61 forks source link

[FEATURE] Run PowerShell commands as Administrator #366

Open JakeD22 opened 3 weeks ago

JakeD22 commented 3 weeks ago

Is your feature request related to a problem? Please describe. I have several commands in PowerShell that require to be ran as Administrator.

Describe the solution you'd like A button or prompt to run as admin

Describe alternatives you've considered I tried putting a command I got from ChatGPT in the inject PowerShell code that elevates the script but that didn't seem to work. Although the UAC prompt showed up which was promising but the code never ran. besides I don't want all code to be elevated if I can avoid it only code that needs elevation. Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath"" -Verb RunAs

Additional context I did look around for this solution or question but couldn't find any, apologies if this has been asked before

Any and all help is appreciated, love this plugin. Saved me lots of work and time already