PowerShell for Hackers #1

This tutorial is for PowerShell beginners who have a little exposure to CMD.exe, Linux Bash shell.


Let's start with basic navigation in PowerShell.

Simple naviagtion in PowerShell


  • PowerShell is case-insensitive.

  • Commands (like dir, cd, cls, clear) are called cmdlet in PowerShell's terms.

  • To clear the output in the shell, you can use CTRL+L, cls, or clear or Clear-Host.

  • cmdlet in PowerShell has a Verb-Noun structure.


There are many commands that are aliases for a specific command in PowerShell. For Example, diris an alias for a cmdlet Get-ChildItem


Similarly, there are other aliases. To find them, type either Get-Alias or alias.

Notice that clear and cls have the same cmdlet

You also type gal for Get-Alias to find the alias.

Dive Deep

As we all know, PowerShell is the latest shell built based on the latest technology, C# and .Net in this case. PowerShell's real capability lies in its object. It doesn't only work with the simple text-based input-output streams but objects. Please Note that select is an alias for Select-Object.

Getting the output based on the Name (i.e an object in PowerShell)

Passing arguments such as -First #, -Last #, -Index #. Please replace the # sign with a number. Remember, PowerShell starts counting from 0.

Passing arguments to the cmdlet

You can keep piping and get a more fine-grained result.

Piping for a specific result

You can drill down and find more and more properties regarding a specific command that may be used in a specific situation.

You can do the same things in a different way (in PowerShell way):

Get Help

We can get help using Get-Help cmdlet

If you are unsure about the command you're looking for, you can use a wildcard like a star (*). For example. Get-Command *printer* will give all possible outputs that have the word printer at either one or both ends.

For more information, please watch this video. John Hammond is awesome!

For more information, please watch this video. John Hammond is awesome!