GithubHelp home page GithubHelp logo

jdhitsolutions / new-iseremotetab Goto Github PK

View Code? Open in Web Editor NEW
36.0 7.0 8.0 115 KB

A set of PowerShell functions to add new remote tabs in the PowerShell ISE

License: MIT License

PowerShell 100.00%
powershell-ise powershell-remoting

new-iseremotetab's Introduction

ISERemoteTab

PSGallery VersionPSGallery 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.

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.

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.

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.

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) 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

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.

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.

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:

Import-Module ISERemoteTab

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

$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add($Display,$Action,$shortcut) | Out-Null

The console function, New-ISERemoteTab will also use the value of $ISERemoteProfile as its default value.

A sample profile script, SampleRemoteProfile.ps1, is included with this module.

Deprecation Notice

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.

new-iseremotetab's People

Contributors

jdhitsolutions avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

new-iseremotetab's Issues

Form default location

Opening a new remote form should set cursor in computername text box. Not sure it does that now.

Modify form

Need to modify the WPF form to turn the remote profile script box into a file picker.

Create a GUI front end

Use WPF to create a GUI front end for the command that could plug into the PowerShell ISE.

"I am REMOTE" Prompt in every session

$session = new-pssession $hname
    Invoke-Command -session $session -scriptblock{
    
        function prompt
        {
          Write-Host "  You are in a remote session!!  "  -NoNewline -ForegroundColor Red -BackgroundColor Yellow
          Write-Host "  "  -NoNewline
          write-host $(get-location) -nonewline
          return "--> "
        }
    
    }

is there any way to implement a prompt using enter-pssession only? I love and use YOUR module every day.. Thank you!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.