Skip to content

Start-EditorServices.ps1 causes a 2nd terminal to open. New terminal has execution policy set to RemoteSigned #1090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BristleBeard opened this issue Nov 5, 2017 · 3 comments

Comments

@BristleBeard
Copy link

System Details

  • Operating system name and version: Windows 10 Pro 1709
  • VS Code version: 1.17.2
  • PowerShell extension version: 1.50
  • Output from $PSVersionTable:
    PSVersion 5.1.16299.19
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.16299.19
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

Issue Description

When I open VS Code my terminal opens automatically with 'powershell'. If I open an existing script or start a new PS file, a 2nd terminal opens up running 'PowerShell Integrated Console'. Now I have two terminals, and the new one has a RemoteSigned execution restriction. My profile.ps1 executes again, causing the line Set-ExecutionPolicy Bypass -Scope CurrentUser to throw an error. The 'PowerShell Integrated Console' terminal also does not retain previous command history or color coding.

My non-default powershell extensions settings are these:

"powershell.enableProfileLoading": true
"powershell.codeFormatting.preset": "OTBS"

I've been unable to find where the execution policy is getting changed to RemoteSigned but I'm wondering if these two default settings are the cause of the additional terminal:

"powershell.startAutomatically": true
"powershell.integratedConsole.showOnStartup": true

Attached Screenshots

image

image

image

@rkeithhill
Copy link
Contributor

This is a dupe of #1084. The latest release had an issue where the script file was tweaked after signing, rendering the signature hash invalid. There should be an update coming soon to resolve this issue.

BTW the PowerShell Integrated Console is similar to the ISE console where the debug session runs in that console. It can manipulated during debug and the debug state remains after the debug session finishes - just like in ISE.

@BristleBeard
Copy link
Author

Please re-open this issue. It still exists in 1.51 and #1084 has been since closed.

@daviwil
Copy link
Contributor

daviwil commented Nov 20, 2017

@BristleBeard The second terminal is the "PowerShell Integrated Terminal" which is connected to the PowerShell extension's editing and debugging experience, you definitely want it to be open. The reason why you see 2 terminals open is because VS Code falsely remembers a terminal being open the last time it was closed and pre-emptively opens a terminal for powershell.exe when it starts back up, before the PowerShell extension has a chance to start.

Is the RemoteSigned execution policy an issue for you? Can you solve this issue by calling Set-ExecutionPolicy in the $profile of the PowerShell Integrated Terminal (it's different than the default PowerShell profile)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants