Vscode-powershell: Remote editing only works for .ps1 files but not others

Created on 4 Sep 2019  路  46Comments  路  Source: PowerShell/vscode-powershell

When I follow this documentation
https://docs.microsoft.com/en-us/powershell/scripting/components/vscode/using-vscode-for-remote-editing-and-debugging?view=powershell-6

I noticed remote editing only works for .ps1 files. For other extensions, you can save the file but it won't sync back to the server. I am using PowerShell v7 preview 3 for both host and server and both host and server are windows machines along with Latest VSCode and Powershell extension

A relevant issue has been earlier reported but closed:
https://github.com/PowerShell/vscode-powershell/issues/1040

Area-psEditor Issue-Bug Needs-Repro-Info

All 46 comments

@OnurGumus thanks for opening this issue...It would be really helpful if you could also attach the logs--instructions for how to do that are here , please also provide repro steps, as well as a detailed description of the behavior you are experiencing...thanks!

@SydneyhSmith all repo steps has been clearly stated in the opening issue. If you actually spend 2 minutes and read what I wrote, you will understand the problem. I am not intended to provide further info regarding how to reproduce and loggings as the issue and repro steps are crystal clear.

@OnurGumus I just followed the steps, and the file saves as expected.

before:
image

after I added a line in the editor:
image

We need the logs because something might be specific to your system. Please provide those and also what OS's you're using.

Also, do you have access to the file you're trying to save?

@TylerLeonhardt, if you read the issue carefully, it clearly states both server and client are windows machines. In your case you are using Linux.

To be specific client is latest windows 10 pro rtm X64 and server is windows server 2019 standard edition 1809.

I am creating the file with new item. Saving only works when the extension is ps1. Also you use a different command than the linked tutorial as new-editor-file whereas I am using psedit, not sure if it makes any difference.

I will provide the logs once I have access to my computer.

Missed the part about Windows. My bad. Just for future reference, we have an issue template so that we don't miss these details the first time around. It just streamlines the process.

New-EditorFile creates a file and opens it in vscode. It's the equivalent to New-Item and then psedit (which is an alias of Open-EditorFile).

I still need to know - what communication protocol are you using? ssh or winrm?

It's winrm. I agree that my writing style makes those details less visible. But I thought your template was really overwhelming since it was easy to repro from my point of view.

@OnurGumus we will try to stand up an environment similar to yours and repro this...in the meantime it would still be helpful to see your logs--thanks!

Hi, I'm having the same issue from Windows 10 PC to Windows Server
Reproduced both with 6.2 and 7-preview3

My prompt and logs attached

[npe-file-01]: PS C:\Users\majohnson_admin\Documents> "Test" > test.ps1
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> Get-Content test.ps1
Test
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> psedit test.ps1
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> Get-Content test.ps1
Edited
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> "Test" > test.txt
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> Get-Content test.txt
Test
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> psedit test.txt
[npe-file-01]: PS C:\Users\majohnson_admin\Documents> Get-Content test.txt
Test
[npe-file-01]: PS C:\Users\majohnson_admin\Documents>

1568362690-2cf65ee5-9dce-4f0e-b10e-421124476b0e1568360608478.zip

This issue is being closed as inactive, if this issue is still occurring it will be re-opened

@SydneyhSmith I'm still having this issue. Let me know if you need any further information

Faced the same issue today (Windows 10 with Powershell 5).
Is any additional information required? (This issue is still labelled as 'Needs-Repro-Info')

@SydneyhSmith may I ask why you remove Needs:Attention?

The "Needs: Attention" label is only applied if someone said something after we have:

  • Responded
  • Determined the issue should be closed
  • Determined the issue should remain open

We acknowledge this bug (it's still open and has the Issue-Bug label) but we haven't made progress on it yet to report anything back. It's not the highest priority issue compared to others but when we have resources to spend some time in this space I promise to give an update.

We removed that label because we have nothing to report back or add to the conversation.

@TylerLeonhardt it's you to decide the priorities but allow me to explain the impact of this. Right now it's impossible to edit a remote file through powershell remoting by any means from windows to windows. Sounds pretty serious to me.

I've been looking into this this week, but haven't been able to reproduce any issues remoting into Windows PowerShell 5.1 on Windows Server 2016 or 2019, from PowerShell 5.1 or 7. One example:

psedit

@OnurGumus, @centreboard, @mkarpuk, @dylan-azucena would you be able to share the following details of your setup please:

  • The name and version of the OS you're remoting from
  • The version of PowerShell you're remoting from
  • The name and version of the OS you're remoting to
  • The version of PowerShell you're remoting to
  • The remoting command you used — in particular, we need to know whether you're using WSMan (-ComputerName) or SSH (-HostName)

To get the OS name and version, try:

systeminfo | select -first 2 -skip 2

which should have an output like:

OS Name:                   Microsoft Windows Server 2019 Datacenter
OS Version:                10.0.17763 N/A Build 17763

To get the PowerShell version, try $PSVersionTable.

@rjmholt I'm no longer seeing the issue, I attempted your test and was able to remotely edit a txt file and save it successfully.

FWIW:

Remoting From

OS: macos Catalina (10.15.2)
PS: 6.2.3 Core

Remoting To

OS: Microsoft Windows Server 2016 Datacenter (10.0.14393 N/A Build 14393)
PS: 5.1.14393.3053 Desktop

Command

Enter-PSSession -ComputerName $server -Credential $admin -Authentication basic -UseSSL -SessionOption $pso

I've just tested this remoting over SSH from PS 7-rc.1 to 6.2.3 and PS 7 to 7 and was able to save the file like in the GIF above.

Hopefully we can collect more information to determine what might be causing this on some systems.

@rjmholt what is your source operating system?

@dylan-azucena you are trying from Mac. The issue is from windows to windows.

The problem still exists by the way. I have just tested today:
Source OS : windows 10 x64 1903, Powershell 7.0 rc1
Target OS : Windows 2019 x64 Standard edition 1809

@OnurGumus

Target OS : Windows 2019 x64 Standard edition 1809

Could you specify the version of PowerShell you're trying to remote into and the remoting command you're using to do it?

@rjmholt what is your source operating system?

OS Name:                   Microsoft Windows 10 Enterprise Insider Preview
OS Version:                10.0.19535 N/A Build 19535

@rjmholt
Source:

PowerShell 7.0.0-rc.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/powershell
Type 'help' to get help.

PS C:\Users\Onur.Gumus>  systeminfo | select -first 2 -skip 2
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18363 N/A Build 18363

Target:

PowerShell 7.0.0-rc.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/powershell
Type 'help' to get help.

PS C:\Users\gatesdev>  systeminfo | select -first 2 -skip 2
OS Name:                   Microsoft Windows Server 2019 Standard
OS Version:                10.0.17763 N/A Build 17763

@OnurGumus are you remoting with a command like this:

$s = New-PSSession -HostName $ipAddress -Credential $credential
Enter-PSSession $s

Or are you using a different command (perhaps WSMan-based?)

Was this page helpful?
0 / 5 - 0 ratings