Skip to content

Powershell issues when VSCode run as another user #2825

@SilentlyContinue27

Description

@SilentlyContinue27

Greetings,

I run VSCode as another user via “Run As Administrator” with my domain credentials. I’ve been noticing several issues with the PowerShell extension while doing this.

1: Run Selection does not work, either via F8 on the keyboard or right-click and “Run Selection.” Copy and paste code into the terminal works fine.

2:The VSCode log command requested for this post ( >PowerShell: Upload Bug Report To Github ) fails with VSCode popup error “Command ‘PowerShell: Upload Bug Report To Github’ resulted in an error (command ‘PowerShell.GenerateBugReport’ not found)

3: The troubleshooting code requested for this post:
[
& {"### VSCode version: $(code -v)"; "n### VSCode extensions:n$(code --list-extensions --show-versions | Out-String)"; "n### PSES version: $($pseditor.EditorServicesVersion)"; "n### PowerShell version:`n$($PSVersionTable | Out-String)"}
]
errors with the following PowerShell errors:
[
code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:27

  • & {"### VSCode version: $(code -v)"; "n### VSCode extensions:n$(cod ...
  •                       ~~~~
    
    • CategoryInfo : ObjectNotFound: (code:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

VSCode version:

code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:67

  • ... SCode version: $(code -v)"; "n### VSCode extensions:n$(code --list- ...
  •                                                          ~~~~
    
    • CategoryInfo : ObjectNotFound: (code:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

VSCode extensions:

nothing to see here, despite having the PowerShell extension V2020.6 installed…

PSES version:

PowerShell version:

Name Value


PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

]

All of the above function correctly when running VScode as my logged in user (Double-clicking VScode to start) rather than as another user (Right Click > Run As Admin).
I’ve been able to produce this on both of my workstations using the same versioning below. I’m curious if I have managed to mess something up or if anyone else can reproduce the issue.
Unfortunately, I am unable to attach a log due to issue 2 above. I would be happy to send logs if anyone can help me do so.

System Details

VS Code Version: 1.47.2, User and System Versions attempted, x64.
PowerShell Extension Version: v2020.6.0 (also tested with preview v2020.6.1. Only one extension installed at a given time.)
WinVer: Windows 10 1909 (OS Build 18363.959)

PSES version:

PowerShell version:

Name Value


PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions