PowerShell / PowerShell/vscode-powershell

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

Open
#4,836 1 comment 0 reactions 1 assignee View on GitHub

@andyleejordan is already working on this.

Since Nov 29, 2023.

Area-Debugging Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.