Edit Remote PowerShell Scripts Using PSEdit And ISE

In this article I’ll show you how I create and edit scripts on Windows Nano Server using Psedit via a remote PowerShell session using PowerShell ISE.

So what Is PSEdit ? Psedit Is a script editor tool available with PowerShell ISE only.

In my case, I’m going to create a PowerShell script on my Nano Server using a remote PowerShell session Initiated from ISE.

After connecting to my Nano Server using the two cmdlets:

Set-Item WSMan:\localhost\Client\TrustedHosts -Value 192.168.100.10 -Concatenate

Enter-PSSession -ComputerName 192.168.100.10 -Credential administrator

Next I’ll create a PS script

New-Item -ItemType file script.ps1

And the I’ll use Psedit to load it to ISE and edit the script:

psedit .\script.ps1

Below I’ll edit the script and click on save

Now I can run the script.


Posted

in

by