Tuesday, September 27, 2022

Setting up ISE Profile with Options

 

Here is updated ISE profile. You can use it to built your own and make few adjustments.

 

 

 

# STARTING ADDS-ON MENU

# Clear the Add-ons menu if any entries currently exist

# $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()

 

 

# ****VARS **********************************

#(-).VARS

$year = (get-Date -format '-MMM-yyyy')

 

 

# ****FUNCTIONS *****************************

# Function --- INTRO

  Function INTRO {

 

$intro = "

<#

 

_______________

 

< ISE PROFILE  >

< IronNinJa Team  >

 

---------------

        \   ^__^

         \  (oo)\_______

            (__)\       )\/\

                ||-Ninja |

                ||      ||

#>

 

"

 

}

 

# Function --- TITLE

  Function TITLE {

 

$comp = $env:computername

$dom  = $env:userdomain

$usr  = $env:username

$host.ui.RawUI.WindowTitle = “ISE + $usr + $dom + $comp

 

 Write-Warning "*******************************"

"You are now entering PowerShell : " + $usr

"Domain                          : " + $dom

"PCname                          : " + $comp

 Write-Warning "********************************"

 

 

}

 

# Function --- Create-Local-Path

  Function Create-Local-path {

 

$LocalPath = "C:\users\$env:username\Documents\SCRIPTS" + $year

if( ( Test-Path -PathType Container $LocalPath ) -eq $false ) {

New-Item $LocalPath -Type Directory -Force  | Out-Null

}

 

Set-Location $LocalPath

#(4)_.Create Profile if Does not exist

if (!(test-path $profile ))

{new-item -type file -path $profile -force | Out-Null}

 

}

 

# Function Start-PowerShell

  Function start-PowerShell {

  start cmd.exe

}

 

# Function --- Set-hash-symbol

  Function Prompt {

  return "#";

}

 

# Function --- Add-Synopsis

   Function Add-Synopsis {

 

  $header = @” 

 

<#    

 

.NOTES

#=============================================

# Script      : $(split-path -Path $psISE.CurrentFile.FullPath -Leaf)

# Created     : ISE 3.0 

# Author(s)   : $env:username 

# Date        : $(Get-Date) 

# Org         : Ninja Solutions

# File Name   :

# Comments    :

# Assumptions :

#==============================================

 

SYNOPSIS           :

DESCRIPTION        :

Acknowledgements   : Open license

Limitations        : None

Known issues       : None

Credits            : None

 

.EXAMPLE

  .\Get-Sample.ps1

 

  MAP:

  -----------

 

#>

 

“@ 

 $psise.CurrentFile.Editor.InsertText($header

}

# ****PARENT MENU *****************************

#(1)_.Parent MENU Admin Console

$Parent1 = "Admin Console"

$parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("(1)_.$Parent1", $null, $null)

 

$parentAdded.SubMenus.Add('_.Connect-cmd.exe',{Start-cmd}, 'Alt+A') | Out-Null

$parentAdded.SubMenus.Add('_.Connect-PowerShell',{Start-PowerShell}, 'Alt+B') | Out-Null

 

#(2)_.Parent MENU Admin URLs

$parent2 = "Admin URLs"

$parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("(2)_.$Parent2", $null, $null)

$adminURL1 = "www.google.com"

$adminURL2 = "www.IpChicken.com"

 

$parentAdded.SubMenus.Add("_.Connect-$adminURL1",{Start $adminURL1 }, 'Alt+C') | Out-Null

$parentAdded.SubMenus.Add("_.Connect-$adminURL2",{Start $adminURL2 }, 'Alt+D') | Out-Null

#(3)_.Parent MENU Admin Tools

$Parent3 = "Admin Tools"

$parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("(3)_.$Parent3", $null, $null)

$parentAdded.SubMenus.Add('_.Connect-cmd.exe',{Start-cmd}, 'Alt+E') | Out-Null

$parentAdded.SubMenus.Add('_.Connect-PowerShell',{Start-PowerShell}, 'Alt+F') | Out-Null

 

 

 

No comments:

Post a Comment

Setting up ISE Profile with Options

  Here is updated ISE profile. You can use it to built your own and make few adjustments.       # STARTING ADDS-ON MENU # ...