PowerShell/docs/learning-powerShell/learning-powershell.md

5.8 KiB
Raw Blame History

Learning PowerShell

Whether you're new to programming or an experienced developer, we'll help you get started with PowerShell. In this document we'll cover the following: installing PowerShell, samples walkthrough, PowerShell editor, debugger, testing tools and a map book for experienced bash users to get started with PowerShell faster. The exercises in this document are intended to give you a solid foundation in how to use PowerShell and get PowerShell to do work for you. You won't be a PowerShell guru at the end of reading this material but you will be well on your way with the right set of knowledge to start using PowerShell. If you have 30 minutes now, lets try it.

Installing PowerShell

First you need to setup your computer working environment if you have not done so. Choose the platform below and follow the instructions. At the end of this exercise, you should be able to launch the PowerShell session.

  • PowerShell on Linux

  • PowerShell on OS X

  • PowerShell on Windows

    For this tutorial, you do not need to install PowerShell if you are running on Windows. You can launch PowerShell command console by pressing Windows Key and typing PowerShell, and clicking on 'Windows PowerShell'.

TODO: Raghu for setup-dev-environment.md

Getting Started with PowerShell

PowerShell command has a Verb-Noun structure with a set of parameters. It's easy to learn and use PowerShell. For example, "Get-Process" will display all the running processes on your system. Let's walk through with a few examples by clicking on the PowerShell Beginner's Guide.

Now you have learned the basics of PowerShell. Please continue reading if you want to do some development work in PowerShell.

PowerShell Editor

In this section, you will create a PowerShell script using PowerShell editor. You can use your favorite editor to write scripts. As an example, we will use Visual Studio Code (VS Code) which works for Windows, Linux, or OS X. Click on the following link to start create your first PowerShell script, let's say helloworld.ps1.

On Windows, you can also use PowerShell Integrated Scripting Environment (ISE) to edit PowerShell scripts.

PowerShell Debugger

Assuming you have written a PowerShell script which may contain a software bug, you can fix the issue via debugging. As an example, we will use VS Code. Click on the link below to start debugging:

On Windows, you can also use ISE to debug PowerShell scripts.

PowerShell Testing

We recommend using Pester testing tool which is initiated by the PowerShell Community for writing test cases. To use the tool please read Pester Guides and Writing Pester Tests Guidelines.

Map Book for Experienced Bash users

TODO: Don & JP to fill in

Bash PowerShell Description
ls ls List files and folders
cd cd Change directory
mkdir mkdir Create a new folder
Clear, Ctrl+L, Reset cls Clear screen

More Reading