#PSTip Editing remote file in PowerShell ISE

Note: This tip requires PowerShell 5.0 or later.

If you have ever wondered how you can edit files on a remote system using Windows PowerShell, it is now possible with PowerShell 5.0 preview. This is, at the moment, possible only within PowerShell ISE.

Enter-PSSession -ComputerName computername
psEdit filename

If you are wondering, what is psEdit, it existed in Windows PowerShell for a long time (since 2.0) and is used to add the specified file(s) to the current PowerShell tab in PowerShell ISE.

Here is a quick demo of remote file editing in PowerShell 5.0.

PowerShell console has ise command that opens PowerShell ISE. However, it is not possible to perform remote file editing from PowerShell console prompt. The ise command is mapped to PowerShell_ise.exe and therefore it just creates a process on the remote session.

Share on: