Author Posts

November 24, 2017 at 12:10 pm

Hi Folks,

I've been using ISE for some time, and have enjoyed experimenting with Visual Studio Code. One of the barriers to adopting Code fully right now is I don't feel entirely comfortable with running it with privileged access to our environment, which in my workflow is generally something I'd do with ISE (run as admin, the admin has privileges to the domain, etc) as I build out my tools.

How do other Visual Studio Code user work with it in a way where they can build out tools on environments that require privileged access? Maybe I'm just being paranoid? Unfortunately not all cmdlets support passing of credentials.

November 24, 2017 at 2:52 pm

I don't use Visual Studio but one way to solve your problem would be to set both Powershell & ISE exe files to always run as administrator – go to their location and set "Advanced" properties. Now you can run VS the way you want to.

November 24, 2017 at 10:25 pm

How is running the ISE elevated / privileged any less risky that VSCode elevated?

Yep, you are being paranoid. If you need to do admin stuff, you need to run elevated, regardless of editor / host you decide to use.

Number one. I never log in as admin. Either domain or local as a daily rule. Their are one ortwo very rare exceptions where it may be required. I have a set of shortcuts pinned to may taskbar:

Set one is for normal user for PoSH console host, ISE and VSCode. Left at their defaults
Set one is for Admin user for PoSH console host, ISE and VSCode, using RunAs and set to run as admin on startup.

C:\Windows\System32\runas.exe /user:YourDomainName\YourAdminUsername "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted"

C:\Windows\System32\runas.exe /user:YourDomainName\YourAdminUsername "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy UnRestricted PowerShell_ISE.exe"

C:\Windows\System32\runas.exe /user:YourDomainName\YourAdminUsername "C:\Program Files (x86)\Microsoft VS Code\Code.exe"

So, these don't impact you host or user settings. These are per process/session.