Skip to content

Running script when remoted into another computer Error (Temp Files) #4836

Open
@melas0nos

Description

@melas0nos

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

I am remoted into another computer with Enter-PSSession. I hit F5 to run a .ps1 with any code and it is trying to run on the local machine and/or not running correctly. Getting error:

C:\Users\XXXXX\AppData\Local\Temp\PSES-25588\RemoteFiles\609289779\CORE\scratch.ps1 : The term 
'C:\Users\XXXXX\AppData\Local\Temp\PSES-25588\RemoteFiles\609289779\CORE\scratch.ps1' 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:2 char:1
+ C:\Users\XXXXX\AppData\Local\Temp\PSES-25588\RemoteFiles\609289779 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\KTheis...ORE\scratch.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I have tried reinstalling the extension, reinstalling VSCode, and using the preview version of the extension.

This functionality works when I reproduce in Powershell ISE

PowerShell Version

(The following is from the integrated terminal, I am remoted into the "CORE" machine)

[CORE]: PS C:\Users\XXXX\Documents> $PSVersionTable       

Name                           Value
----                           -----
PSVersion                      5.1.17763.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


[CORE]: PS C:\Users\hctech\Documents>

Visual Studio Code Version

1.84.2

Extension Version

v2023.11.0

Steps to Reproduce

Remote into computer:

$so = New-PSSessionOption -SkipCACheck -SkipCNCheck
enter-pssession -ComputerName "CORE" -Credential:'hctech' -UseSSL -SessionOption $so

Then run any code with F5 to get the error.

*** I CAN run the code fine by using F8 running each line independently ***

Visuals

No response

Logs

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Wishlist

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions