Show-Inspector

Opens the Inspector window, a debugging tool that displays all existing PowerShell variables and their values:

../../../_images/variableinspector.png

Syntax

Show-Inspector [-Highlight <String>] [<CommonParameters>]

Parameters

Type

Name

Description

Optional

String

Highlight

The inspector jumps to the passed variable (e.g. 'file')

yes

Return type

empty

Examples

Extend PowerShell script with Show-Inspector to analyse variables and find errors:

function Get-Path{
  param($switch)
   switch($switch){
	 a{$path = "C:\Temp\a.txt";break}
	 b{$path = "C:\Temp\b.txt";break}
	 c{$path = "C:\Temp\.txt";break}
	 d{$path = "C:\Temp\d.txt";break}
   }
  return $path
}

$path = Get-Path -switch 'c'

Show-Inspector 'path'

Get-Content $path

Admittedly the error in the previous script is obvious, but it’s just intented to show a possible purpose of the Inspector window.
In more complex scripts you can easily check your PowerShell variables with this method without writing them out to a textfile.