In version 5.0, PowerShell ISE has got a new feature that lets you edit files on remote computers with a graphical editor. Its main purpose is to open scripts on a server; however, this also works for other text files like logfiles.

To edit a file on a remote computer, you will usually navigate to a network share and load the text into a local editor. Alternatively, you connect via Remote Desktop Protocol (RDP) and use an editor residing on the remote machine.

Interesting option for Nano Server

In some cases, these ways are cumbersome or not even possible, for instance, if you have to edit files on a Nano Server. Microsoft's GUI-less operating system doesn't accept remote desktop connections. At least you could access the server's file system through an admin share.

However, PowerShell ISE offers a comfortable alternative with PSEdit. If you are working on a script, you don't have to leave your development environment to edit the file on a remote server.

Starting a remote session via GUI

First, you have to open a remote session on the server, which you could do the usual way with the corresponding cmdlets.

Opening a remote session in PowerShell ISE

Opening a remote session in PowerShell ISE

However, it is easier just to click New Remote PowerShell Tab in ISE's File menu. A dialog will then open where you just have to enter the computer name of the remote machine and your credentials.

Connecting to a remote computer

Connecting to a remote computer

Afterwards, you are in the context of the remote computer where you can navigate through the file system with Set-Location and Get-ChildItem. Once you locate your file, you can open it with PSEdit, which also accepts wildcards:

PSEdit .\*.ps1

This command would load all PowerShell scripts from the current directory and open each file in a different tab.

Subscribe to 4sysops newsletter!

The feature is unavailable on older Windows versions. However, if you upgrade to PowerShell 5.1, you will also get the latest PowerShell ISE version.

avataravatar
2 Comments
  1. FrankieM 6 years ago

    I would like to point out that you can also open a new PS tab in PSEdit then run:

    Enter-PSSession computername.company.com

    This will make the connection with currently logged in user, then you can run the PSEdit .\filename.extension

    This will also open it in the Editor. Less menu hunting this way. Depending on your setup/work flow I believe both are valid.

    avatar
  2. js2017 5 years ago

    You can start the ise from the command line by typing “ise”.

Leave a reply

Please enclose code in pre tags

Your email address will not be published.

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account