#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.

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

PSEdit-WMF5

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.

About the author: Ravikanth C

Ravikanth is the founder and editor of the PowerShell Magazine. He is also a PowerShell MVP who works at Dell Inc. He blogs at http://www.ravichaganti.com/blog and you can follow him on Twitter @ravikanth.

Related Posts

%d bloggers like this: