A first look at Windows PowerShell ISE Preview

Doctor Scripto

Summary: Take a first look at the newly released Windows PowerShell ISE Preview.

Good morning everyone. Ed Wilson here. I can tell you that the list of speakers for PowerShell Saturday on in Tampa March 19, 2016 looks really impressive. There are going to be seven MVPs and six Microsoftees there! When it comes to Microsoft Automation, this is going to be the place to be in March. Registration is still open, but it is starting to fill up quickly.

Image of menu

Yesterday in Install the PowerShell ISE Preview from the PowerShell Gallery, I looked at downloading and installing Windows PowerShell ISE Preview. Because this installs a module, I can use standard Windows PowerShell module types of commands to explore it. This is cool because Windows PowerShell modules have been around since Windows PowerShell 2.0 shipped.

The first thing I want to do is to look at the module. I can use the Get-Module cmdlet to do this. Here is the command and the output:

PS C:\Users\mredw> Get-Module *ise*

ModuleType Version    Name                  ExportedCommands

———- ——-    —-                                —————-

Script     5.1.1      PowerShellISE-preview   {Install-ISEPreviewShor…

I can see that it exports some commands. But I also wonder if it exports any cmdlets. So I select exported cmdlets, and I see nothing:

PS C:\Users\mredw> Get-Module *ise* | select ExportedCmdlets

ExportedCmdlets

—————

{}

Next, I look at exported commands, and I see that there are a few:

PS C:\Users\mredw> Get-Module *ise* | select ExportedCommands

ExportedCommands

—————-

{[Install-ISEPreviewShortcut, Install-ISEPreviewShortcut], [Start-ISEPreview, Sta…

I decide to pipe the output to the Format-List cmdlet. Here is the command (using fl as an alias) and the output:

PS C:\Users\mredw> Get-Module *ise* | fl *

LogPipelineExecutionDetails : False

Name                        : PowerShellISE-preview

Path                        : C:\Users\mredw\Documents\WindowsPowerShell\Modules\PowerShellISE-preview\5.1.1\PowerShellISE-preview.psm1                      

ImplementingAssembly        :

Definition                  : $PSModule = $ExecutionContext.SessionState.Module

                              $PSModuleRoot = $PSModule.ModuleBase

                              function Update-ISEPreviewShortcut($wshell,

                              $shortcutPath, $exeName)

                              {

                                  $shortcut = $wshell.CreateShortcut($shortcutPath)

                                  if ($shortcut.TargetPath -ne $shortcutPath)

                                  {

                                      $shortcut.TargetPath =

                              "$PSModuleRoot\$exeName"

                                      $shortcut.Description = "Windows PowerShell

                              Integrated Scripting Environment. Performs

                              object-based (command-line) functions"

                                      $shortcut.WorkingDirectory =

                              "%HOMEDRIVE%%HOMEPATH%"

                                      $shortcut.Save()

                                  }

                              }

                              function Update-ISEPreviewShortcuts([switch]$OnlyUpdateExisting)

                              {

                                  $startMenuRootPath =

                              [System.Environment]::GetFolderPath('StartMenu')

                                  $powerShellShortcutPath =

                              [System.IO.Path]::Combine($startMenuRootPath,

                              "Programs\Windows PowerShell")

                                  $isePreviewShortcutPath =

                              [System.IO.Path]::Combine($powerShellShortcutPath,

                              "Windows PowerShell ISE Preview.lnk")

                                  $isePreviewShortcutX86Path =

                              [System.IO.Path]::Combine($powerShellShortcutPath,

                              "Windows PowerShell ISE Preview (x86).lnk")

                                  $wshell = New-Object -ComObject WScript.Shell

                                  if (!$OnlyUpdateExisting)

                                  {

                                      # If the shortcut folder doesn't exist,

                              create it

                                      New-Item -ItemType Directory -Force -Path

                              $powerShellShortcutPath | Out-Null

                                  }

                                  if (!$OnlyUpdateExisting.IsPresent -or

                              [System.IO.File]::Exists($isePreviewShortcutPath))

                                  {

                                      Update-ISEPreviewShortcut $wshell

                              $isePreviewShortcutPath "powershell_ise.exe"

                                  }

                                  if (!$OnlyUpdateExisting.IsPresent -or

                              [System.IO.File]::Exists($isePreviewShortcutPath))

                                  {

                                      Update-ISEPreviewShortcut $wshell

                              $isePreviewShortcutX86Path "powershell_ise.x86.exe"

                                  }

                              }

                              function Install-ISEPreviewShortcut

                              {

                                  # Call the update cmdlet without passing the -OnlyUpdateExisting parameter

                                  Update-ISEPreviewShortcuts

                              }

                              function Start-ISEPreview

                              {

                                  # Run the included binary, passing along the given arguments

                                  & "$PSModuleRoot\powershell_ise.exe" @args

                              }

                              # Set up the 'isep' alias

                              Set-Alias isep Start-ISEPreview -Option AllScope

                              -Scope Global

                              Set-Alias Install-ISEPreviewShortcuts

                              Install-ISEPreviewShortcut

                              # Ensure that existing ISE Preview shortcuts have the right path

                              Update-ISEPreviewShortcuts -OnlyUpdateExisting

Description                 : A preview release of the PowerShell ISE containing

                              new features that are not yet a part of the built-in

                              PowerShell ISE.

Guid                        : d9ba0903-a775-4e37-99ac-19ef888b2cb7

HelpInfoUri                 :

ModuleBase                  : C:\Users\mredw\Documents\WindowsPowerShell\Modules\PowerShellISE-preview\5.1.1

PrivateData                 : {PSData}

Tags                        : {PowerShell, ISE, powershell_ise, preview…}

ProjectUri                  :

IconUri                     :

LicenseUri                  :

ReleaseNotes                :

RepositorySourceLocation    : https://www.powershellgallery.com/api/v2/

Version                     : 5.1.1

ModuleType                  : Script

Author                      : Microsoft Corporation

AccessMode                  : ReadWrite

ClrVersion                  :

CompanyName                 : Microsoft Corporation

Copyright                   : (c) 2016 Microsoft Corporation. All rights reserved.

DotNetFrameworkVersion      :

ExportedFunctions           : {[Install-ISEPreviewShortcut,

                              Install-ISEPreviewShortcut], [Start-ISEPreview,

                              Start-ISEPreview]}

Prefix                      :

ExportedCmdlets             : {}

ExportedCommands            : {[Install-ISEPreviewShortcut,

                              Install-ISEPreviewShortcut], [Start-ISEPreview,

                              Start-ISEPreview], [Install-ISEPreviewShortcuts,

                              Install-ISEPreviewShortcuts]}

FileList                    : {}

ModuleList                  : {}

NestedModules               : {}

PowerShellHostName          :

PowerShellHostVersion       :

PowerShellVersion           : 5.0

ProcessorArchitecture       : None

Scripts                     : {}

RequiredAssemblies          : {}

RequiredModules             : {}

RootModule                  : PowerShellISE-preview.psm1

ExportedVariables           : {}

ExportedAliases             : {[Install-ISEPreviewShortcuts,

                              Install-ISEPreviewShortcuts]}

ExportedWorkflows           : {}

ExportedDscResources        : {}

SessionState                : System.Management.Automation.SessionState

OnRemove                    :

ExportedFormatFiles         : {}

ExportedTypeFiles           : {}

PS C:\Users\mredw>

So, basically there are two functions exported:

  • Install-ISEPreviewShortcut
  • Start-ISEPreview

Installing shortcuts

I can launch Windows PowerShell ISE Preview by typing isep at the Windows PowerShell console. And when I do, it launches the Windows ISE Preview Release by doing a sort of fade:

Image of menu

But it would be easier if I could simply click a shortcut link. So I call the Install-ISEPreviewShortCut function. Nothing appears to happen:

Image of command

I open my Start menu, and I can see that Windows PowerShell ISE preview appears in a Recently added list:

Image of menu

If I go to my All apps section and scroll down to the W section, I can see that I have two new links for Windows PowerShell ISE Preview: one is x86 mode and the other is 64-bit:

Image of menu

The other function is a bit confusing in a way. It is Start-ISEPreview. This launches Windows PowerShell ISE Preview, but does not launch a preview of Windows PowerShell ISE Preview. Anyway, this is the function that is associated with the isep alias, which I find easier to type and remember. This command is shown here:

PS C:\Users\mredw> Get-Alias isep

CommandType     Name                               Version    Source

———–     —-                                               ——-    ——

Alias           isep -> Start-ISEPreview             5.1.1      Pow…

PS C:\Users\mredw>

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Also check out my Microsoft Operations Management Suite Blog. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

0 comments

Discussion is closed.

Feedback usabilla icon