Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Jul 2, 2021
1 parent 1be5ff5 commit 907dee8
Show file tree
Hide file tree
Showing 16 changed files with 1,339 additions and 945 deletions.
Binary file modified ISERemoteTab.psd1
Binary file not shown.
9 changes: 4 additions & 5 deletions ISERemoteTab.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#requires -version 4.0

. $psScriptroot\New-ISERemoteTab.ps1
. $psScriptroot\New-ISERemoteTabForm.ps1


#dot source the module functions
. $psScriptroot\Functions\New-ISERemoteTab.ps1
. $psScriptroot\Functions\New-ISERemoteTabForm.ps1
220 changes: 0 additions & 220 deletions New-ISERemoteTab.ps1

This file was deleted.

68 changes: 53 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,67 @@
# New-ISERemoteTab
# ISERemoteTab

![PSGallery Version](https://img.shields.io/powershellgallery/v/ISERemoteTab.png?style=for-the-badge&logo=powershell&label=PowerShell%20Gallery)![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/ISERemoteTab.png?style=for-the-badge&label=Downloads)

The module includes a PowerShell function to add new remote tabs in the PowerShell ISE. The default behavior of adding remote tabs in the ISE is very basic and offers no flexibility like specifying an alternate port. This module was created to address those limitations.

This command will create one or more remote tabs in the PowerShell ISE. You could use this to programmatically to open multiple remote tabs.

PS C:\> New-ISERemoteTab -Computername $c -Credential globomantics\administrator -Authentication Default
After importing the module into the ISE be sure to read help and examples. All commands must be run in the PowerShell ISE.

## Basic Usage

The default behavior is to open tabs with your current credentials using [New-ISEREmoteTab](docs/New-ISERemoteTab.md).

```powershell
New-ISERemotetab localhost
```

But you can specify a single credential for all remote connections, or prompt for a credential for each connection. You might need this if some of the machines require different credentials.

```powershell
New-ISERemoteTab -Computername $c -Credential company\administrator -Authentication Default
```

You can also specify a VMName to use PowerShell Direct and connect to a Hyper-V virtual machine. You will need to include parameters with this option.

```powershell
New-ISEREmoteTab -vmname srv1 -credential $admin
```

The original function was first demonstrated at <http://bit.ly/1lpMoNj>.

## Form Front-End

The module also includes a second function ([New-ISEREmoteTabForm](docs/New-ISERemoteTabForm.md)) to generate a WPF form to enter remote tab information. You can enter a single computer or multiple names separated by commas.

![Remote ISE Tab](images/remoteIsetab_thumb.png "Remote Tab Form")

The form should handle everything except additional PSSessionOptions. If you require that level of control, you will need to use `New-ISEREmoteTab`. If you check the box for `Use VMName`, incompatible form controls will be disabled.

_You will need to manually close the form._

## Profile Scripts

Normally, you do not have a traditional PowerShell profile script when you enter a remote PSSession. But you have the option to specify a profile script that will be executed in the remote session in place of a regular profile script. The form will look in your current session for a variable called `ISERemoteProfile` which is the path to a ps1 file with your remote profile script.

The default behavior is to open tabs with your current credentials. But you can specify a single credential for all remote connections, or prompt for a credential for each connection. You might need this if some of the machines require different credentials.
You can set this in your PowerShell ISE Profile script or you can use the `Save script setting` checkbox to store the current file in the variable.

The original function is described in greater detail at http://bit.ly/1lpMoNj.
Note that this variable is only for the length of your PowerShell session and does NOT update your ISE profile. In your PowerShell ISE profile script you can add lines like this to create a menu shortcut and define a default remote profile script:

This version of the module includes a second function (New-ISERemoteForm) to generate a WPF form to enter remote tab information.
You can enter a single computer or multiple names separated by commas.
```powershell
Import-Module ISERemoteTab
![Alt Remote ISE Tab](http://jdhitsolutions.com/blog/wp-content/uploads/2016/05/remoteIsetab_thumb.png "Remote Tab Form")
$Display = "New Remote ISE Tab"
$Action = {New-ISEREmoteForm}
$Shortcut = "Ctrl+Shift+T"
$ISERemoteProfile = "C:\Scripts\RemoteProfile.ps1"
In your PowerShell ISE profile script you can add lines like this to create a menu shortcut:
$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add($Display,$Action,$shortcut) | Out-Null
```

Import-Module ISERemoteTab
A sample profile script, [SampleRemoteProfile.ps1](SampleRemoteProfile.ps1), is included with this module.

$Display = "New Remote ISE Tab"
$Action = {New-ISEREmoteForm}
$Shortcut = "Ctrl+Shift+T"
$ISERemoteProfile = "C:\Scripts\RemoteProfile.ps1"
## Deprecation Notice

$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add($Display,$Action,$shortcut) | Out-Null
This module should be considered in maintenance-mode. The PowerShell ISE should be considered deprecated. I will try to address bug fixes, but do not expect any other changes or enhancements to this module. If you like the concept of separate remoting sessions, you can achieve similar results with [Windows Terminal](https://docs.microsoft.com/en-us/windows/terminal/get-started).

After importing the module into the ISE be sure to read help and examples.
17 changes: 16 additions & 1 deletion SampleRemoteProfile.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
#this is a sample remote profile script
#each command must be a one-liner. Do not use block comments.

#how long has this session been running?
$initiated = Get-Date

Function prompt {
#display the session runtime without the milliseconds
$ts = ((Get-Date) - $initiated).ToString().split(".")[0]
# Write-Host ">$ts< " -ForegroundColor yellow -nonewline
Write-Host "$ts <REMOTE> " -NoNewline -ForegroundColor Red -BackgroundColor Yellow
"PS $($executionContext.SessionState.Path.CurrentLocation)--> "
}

Set-Location -path 'C:\'
Clear-Host

Write-Host "Connected to " -nonewline
Write-Host "$env:Computername" -ForegroundColor Red -BackgroundColor Yellow -NoNewline
Write-Host " as $($env:userdomain)\$($env:username)"

$PSVersionTable

Binary file added changelog.md
Binary file not shown.
Binary file removed changelog.txt
Binary file not shown.
10 changes: 5 additions & 5 deletions docs/ISERemoteTab.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Locale: en-US
---

# ISERemoteTab Module

## Description

A PowerShell ISE module to make it easier to create remote tabs.

## ISERemoteTab Cmdlets

### [New-ISERemoteTab](New-ISERemoteTab.md)

This function will let you create remote tabs in the ISE that supports many of the same parameters you would get with Enter-PSSession.

### [New-ISERemoteForm](New-ISERemoteForm.md)
This function creates a WPF entry form that serves as a front end to New-ISERemoteTab.





This function creates a WPF entry form that serves as a front end to New-ISERemoteTab.
Loading

0 comments on commit 907dee8

Please sign in to comment.