The Windows PowerShell Integrated Scripting Environment, or Windows PowerShell ISE, was introduced with PowerShell 2.0 and is packaged as part of the PowerShell installation.  The Windows PowerShell ISE is effectively an integrated development environment (IDE) that is built specifically for PowerShell.  Its feature set isn't as rich as commercially available IDEs, such as Quest Software's PowerGUI or Sapien Technologies' PowerShell Studio, but it provides the essentials, such as syntax highlighting, context-sensitive help, visual debugging and Microsoft's IntelliSense.

The PowerShell ISE is available as a 32-bit or 64-bit binary and consists of three panes:

The table below lists some of PowerShell ISE's most useful keyboard shortcuts:

Key Combination Action
F5 Executes the script, or continues if stopped at a breakpoint.
SHIFT + F5 Aborts debug (when at a breakpoint).
F8 Executes the current line or the current selection.
F9 Sets or clears a breakpoint on the current line (only if the script has been saved).
F10 Step over.  Executes the current line of code, and moves onto the next.  If the current line makes a call to a function or procedure, the function or procedure is executed as a whole.
F11 Step into.  Executes the current line of code, and moves onto the next.  If the current line makes a call to a function or procedure, the debugger steps into the function or procedure.
SHIFT + F11 Step out.  When in a function or procedure (having performed a Step into), executes the remainder of the function or procedure, returning to the calling level.
CTRL + BREAK Aborts execution.

To quickly launch the PowerShell ISE from within PowerShell, simply use the ise .

PowerShell has a comprehensive help system.   Help information is stored in help files, located in $PSHOME\en-US.  The base installation of PowerShell V3.0 and above does not include any help files by default, so they must be downloaded from Microsoft's Web site.   If you are using a computer with Internet connectivity, this can be achieved using the Update-Help cmdlet.  You can also manually download the help files from Microsoft's Web site, or use the Save-Help cmdlet to download the files and save them for use elsewhere.

To obtain information regarding a particular cmdled or concept, use the Get-Help cmdlet (or one of its , such as help or man).   For example, to find out about the Get-Process cmdlet, type:

PS C:\Users\JohnDoe> Get-Help Get-Process; NAME Get-Process SYNOPSIS Gets the processes that are running on the local computer or a remote computer. SYNTAX Get-Process [[-Name] ] [-ComputerName ] [-FileVersionInfo] [-Module] [] Get-Process [-ComputerName ] [-FileVersionInfo] [-Module] -InputObject [] Get-Process [-ComputerName ] [-FileVersionInfo] [-Module] -Id [] Get-Process -Id -IncludeUserName [] Get-Process -IncludeUserName -InputObject [] Get-Process [[-Name] ] -IncludeUserName [] DESCRIPTION The Get-Process cmdlet gets the processes on a local or remote computer. Without parameters, Get-Process gets all of the processes on the local computer. You can also specify a particular process by process name or process ID (PID) or pass a process object through the pipeline to Get-Process. ... ... ... Stop-Process Wait-Process REMARKS To see the examples, type: "get-help Get-Process -examples". For more information, type: "get-help Get-Process -detailed". For technical information, type: "get-help Get-Process -full". For online help, type: "get-help Get-Process -online" PS C:\Users\JohnDoe>

The default output from Get-Help provides a synopsis of the given command.  To retrieve more detailed information, use the -Detailed parameter.  To retrieve a full description, use the -Full parameter.   If you only wish to view examples of the given cmdlet or concept, use the -Examples parameter.

The help system contains numerous articles about general PowerShell concepts.  To list the available articles, type:

PS C:\Users\JohnDoe> Get-Help about_; Name Category Module Synopsis ---- -------- ------ -------- about_Aliases HelpFile Describes how to use alternate names for cmdle... about_Arithmetic_Operators HelpFile Describes the operators that perform arithmeti... about_Arrays HelpFile Describes arrays, which are data structures de... about_Assignment_Operators HelpFile Describes how to use operators to assign value... about_Automatic_Variables HelpFile Describes variables that store state informati... about_Break HelpFile Describes a statement you can use to immediate... about_Classes HelpFile Describes how you can use classes to develop i... about_Command_Precedence HelpFile Describes how Windows PowerShell determines wh... about_Command_Syntax HelpFile Describes the syntax diagrams that are used in... about_Comment_Based_Help HelpFile Describes how to write comment-based help topi... about_CommonParameters HelpFile Describes the parameters that can be used with... ... ... ... about_Checkpoint-Workflow HelpFile Describes the Checkpoint-Workflow activity, which about_Foreach-Parallel HelpFile Describes the ForEach -Parallel language const... about_InlineScript HelpFile Describes the InlineScript activity, which run... about_Parallel HelpFile Describes the Parallel keyword, which runs the about_Sequence HelpFile Describes the Sequence keyword, which runs sel... about_Suspend-Workflow HelpFile Describes the Suspend-Workflow activity, which... about_WorkflowCommonParameters HelpFile This topic describes the parameters that are v... about_Workflows HelpFile Provides a brief introduction to the Windows PS C:\Users\JohnDoe>

To list all available help topics, simply type:

PS C:\Users\JohnDoe> Get-Help *; Name Category Module Synopsis ---- -------- ------ -------- foreach Alias ForEach-Object % Alias ForEach-Object where Alias Where-Object ? Alias Where-Object ac Alias Add-Content clc Alias Clear-Content cli Alias Clear-Item clp Alias Clear-ItemProperty clv Alias Clear-Variable compare Alias Compare-Object cpi Alias Copy-Item cpp Alias Copy-ItemProperty ... ... ...

As we've already seen, PowerShell works natively with objects exposed by the underlying operating system, the .NET framework, and any loaded modules or snap-ins.  You will therefore find yourself dealing with various object classes when using the interactive shell, or when developing PowerShell scripts.  Understanding the object types you are working with, and exploring their respective methods and properties, will enable you to exploit the true potential of PowerShell.

If you don't already know the class of the object you are working with, you can use the GetType() method.  For example, the code excerpt below returns the data type of the first thread of an arbitrary process:

PS C:\Users\JohnDoe> $objFirstProcess = (Get-Process)[0]; # Get first process. PS C:\Users\JohnDoe> $objFirstThread = $objFirstProcess.Threads[0]; # Get first thread of first process. PS C:\Users\JohnDoe> $objFirstThread.GetType().FullName; # Get the class of the thread object. System.Diagnostics.ProcessThread PS C:\Users\JohnDoe>

Once you know the class of an object, you can call upon resources such as the Microsoft Developer Network (MSDN) to obtain detailed information about the class' properties and methods.  Continuing with the example above, performing a Bing or Google search for msdn System.Diagnostics.ProcessThread quickly takes us to the relevant MSDN page, that is:   From here, we can ascertain the various properties and methods of the given class.

You can also explore an object's properties and methods directly by using the Get-Member cmdlet (or its , gm), for example:

PS C:\Users\JohnDoe> $objFirstThread | Get-Member; TypeName: System.Diagnostics.ProcessThread Name MemberType Definition ---- ---------- ---------- Disposed Event System.EventHandler Disposed(System.Object, System.EventArgs) CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType) Dispose Method void Dispose(), void IDisposable.Dispose() Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetLifetimeService Method System.Object GetLifetimeService() GetType Method type GetType() InitializeLifetimeService Method System.Object InitializeLifetimeService() ResetIdealProcessor Method void ResetIdealProcessor() ToString Method string ToString() BasePriority Property int BasePriority {get;} Container Property System.ComponentModel.IContainer Container {get;} CurrentPriority Property int CurrentPriority {get;} Id Property int Id {get;} IdealProcessor Property int IdealProcessor {set;} PriorityBoostEnabled Property bool PriorityBoostEnabled {get;set;} PriorityLevel Property System.Diagnostics.ThreadPriorityLevel PriorityLevel {get;set;} PrivilegedProcessorTime Property timespan PrivilegedProcessorTime {get;} ProcessorAffinity Property System.IntPtr ProcessorAffinity {set;} Site Property System.ComponentModel.ISite Site {get;set;} StartAddress Property System.IntPtr StartAddress {get;} StartTime Property datetime StartTime {get;} ThreadState Property System.Diagnostics.ThreadState ThreadState {get;} TotalProcessorTime Property timespan TotalProcessorTime {get;} UserProcessorTime Property timespan UserProcessorTime {get;} WaitReason Property System.Diagnostics.ThreadWaitReason WaitReason {get;} PS C:\Users\JohnDoe>

Again, continuing with the example above, we can see that the PriorityLevel of a thread can be both viewed and modified {get;set;}, meaning we could do something like:

PS C:\Users\JohnDoe> $objFirstThread.PriorityLevel = 'Highest'; PS C:\Users\JohnDoe>

This has the effect of modifying the Base Priority of the given thread, changing it from Normal to Highest.   This operation can only be performed with appropariate privileges, and when launching PowerShell with the Run as administrator option.   So, with just three lines of code, we have managed to change the Base Priority of a process' thread.   Without PowerShell, this would only be possible using a lengthy piece of Python, VBScript or a compiled program.

We can also use of PowerShell's cmdlets to view actual object data.  The Out-GridView cmdlet, introduced in PowerShell V3.0, is particularly useful, as it allows us to quickly browse object data in a .NET GridView control, for example:

PS C:\Users\JohnDoe> $objFirstProcess.Threads | Select-Object -Property * | Out-GridView; PS C:\Users\JohnDoe>

From here, we can explore the object's property values.  Of course, this technique can be combined with the MSDN approach above to fully understand a given object class.