PowerPaul avatar

A beginners guide to Powershell - Part 2 - Getting started with Powershell ISE

redbaron90

Published: 21 Jan 2018 › Updated: 21 Jan 2018A beginners guide to Powershell - Part 2 - Getting started with Powershell ISE

A beginners guide to Powershell - Part 2 - Getting started with Powershell ISE

Hi fellow Steemians,

in this second part of "A beginners guide to Powershell" (Part 1 - Introduction) I want to introduce you to the Powershell Integrated Scripting Environment (short ISE) in a little more depth. 

After starting ISE (covered in Part 1) you should see this:

For simplicity I have marked the most relevant areas:

  1. This is the Editor pane, here you write your script
  2. This is an interactive powershell console, you can execute commands to your liking (Enter command and press Enter). If you execute code from the Editor pane it will be executed in this console
  3. Commands overview, in this pane you can see all cmdlets (commands) of all Powershell Modules that are installed on your PC. There are Modules for a lot of different technologies like Exchange, Sharepoint, Office365 and many more
  4. The Run/Stop Button, from left to right: 
  • Run Script (F5) - Executes all code in the Editor pane
  • Run Selection (F8) - Executes marked code
  • Stop Operation (Ctrl+C) - Stops Execution

Powershell Commands

In powershell commands are generally called cmdlets, the naming convention for Powershell is Verb-Noun. There are certain proposed verbs for certain functions like "Get" for getting information, "Set" for changing information etc. the list of approved verbs can be found here.

This naming convention makes powershell a very readable language since you will end up with simple to understand command names like Get-Item, Set-Item, Move-Item . The Noun part of the cmdlets is supposed to be descriptive as well of course, which sometimes leads to ridiculously long command names like Get-AzureRmRecoveryServicesAsrStorageClassificationMapping. Apart from that the naming system is pretty good and allows for easy exploration.

Exploring the Shell

Powershell is a very explorable language, using some basic commands you can find out what commands are available on your system, what they do and how you can use them.

As you might have extracted from my previous writing powershell commands are seperated into different modules so you might find network-related commands in one module and commands for file interaction in another one.

You can find out what modules are installed on your PC with the following command (Enter in the interactive console):

Get-Module -ListAvailable

Remember that you can use tab completion. Also the console is case insensitive by default so you can just go off in all lowercase (or caps if that´s your thing ;))

You can also search for commands directly:

Get-Command

by default this lists all commands of all available modules, if you want to see commands of a specific module you can use the Module parameter:

Get-Command -Module smbshare

or you can just search all commands that have a certain flag in them like for example SMB:

Get-Command *smb*

The asterisk acts as a wildcard.

Getting help

So now you found a command you are interested in but you still dont know what it does or how it works? No problem, getting help in powershell is as easy as this (Set-Item as example):

Get-Help Set-Item

This will give you a short overview over the command, including available parameters and Syntax.

For the complete information you can enter

Get-Help Set-Item -Full

or

Get-Help Set-Item -Online

The -Online switch opens a new tab in your web browser so you can read the help in a familiar environment.

Up next

In the next part of the series I will probably go deeper into using commands, variables and some basic comparison operators. 

If you have questions or suggestions related or unrelated to this series feel free to contact me.

Leave A beginners guide to Powershell - Part 2 - Getting started with Powershell ISE to:

Written by

Read more #technology posts


Best Posts From PowerPaul

We have not curated any of redbaron90's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From PowerPaul