Learn your way! Get started

PowerShell 3.0, Part 2 of 4: Variables, Functions, and Objects

with expert Doug Ware


Watch trailer


Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack

Release date 1/21/2013
Level Beginner
Runtime 2h 4m
Closed captioning Included
Transcript Included
eBooks / courseware Included
Hands-on labs Included
Sample code N/A
Exams Included


Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More



Course description

In this course you’ll learn all about PowerShell Scripting. We’ll start off by looking at how PowerShell treats variables and how you can use basic variables like strings, arrays, and hash tables. Once you understand this we’ll move on to functions, so you can codify your functionality into easily reused pieces. Next we’ll look how functions can work with the object pipeline and how you can control the scope of your variables and your functions to prevent your scripts from colliding with each other. Once you understand all of that we’ll take a look at types and objects before we close off with a look at collecting input, effective error handling, and good comment practices.

Prerequisites

This course assumes that users have an understanding of the Windows desktop, Windows server operating system, and how to use a scripting language.

Meet the expert

Doug Ware is a SharePoint expert and an instructor for many of our SharePoint 2007 and SharePoint 2010 courses. A Microsoft MVP several times over, Doug is the leader of the Atlanta .NET User Group, one of the largest user groups in the Southeast U.S., and is a frequent speaker at code camps and other events. In addition to teaching and writing about SharePoint, Doug stays active as a consultant and has helped numerous organizations implement and customize SharePoint.

Course outline



Variables, Functions, Objects

Variable Strings Arrays (23:54)
  • Introduction (00:36)
  • Scripting Options (00:48)
  • Variables (00:56)
  • Demo: Variables (03:31)
  • Automatic Variables (01:01)
  • Demo: Automatic Variables (03:14)
  • Strings (00:58)
  • Demo: Strings (03:40)
  • Hashtables and Arrays (00:53)
  • Demo: Arrays (02:44)
  • Demo: Hashtables (01:31)
  • More on Hashtables (01:05)
  • Demo: More on Hashtables (01:52)
  • Summary (00:58)
Functions Pipeline Scope (39:26)
  • Introduction (01:02)
  • Functions (01:02)
  • Demo: Hello World Function (02:25)
  • Function Names (01:02)
  • Function Parameters (00:49)
  • Demo: Parameters (03:57)
  • Returning Values (00:45)
  • Demo: Returning Values (05:45)
  • $_ (01:07)
  • Demo: Object Pipeline (02:02)
  • Reading the Pipeline (00:58)
  • Demo: Pipeline Input (03:40)
  • Scope (00:48)
  • Demo: Scope (04:04)
  • Demo: .Sourcing (02:11)
  • Demo: Nesting Functions (01:48)
  • Controlling Scope (01:22)
  • Demo: Controlling Scope (03:36)
  • Summary (00:56)

Types to Error Handling

Types and Objects (27:56)
  • Introduction (00:35)
  • Types (01:25)
  • Demo: Types (03:14)
  • New Object (01:20)
  • Demo: New Object (04:38)
  • Static Methods (00:41)
  • Demo: Static Methods (01:52)
  • Custom Objects (01:38)
  • Types of Members (01:22)
  • Demo: Custom Objects (05:46)
  • Demo: Extension Method Example (03:44)
  • Summary (01:35)
Inputs to Error Handling (33:39)
  • Introduction (00:35)
  • Collecting Input (01:02)
  • Demo: Collecting Input (02:43)
  • Looping (01:35)
  • Demo: Looping (03:12)
  • Demo: ForEach-Object (02:34)
  • Conditional Operations (01:04)
  • Demo: Conditionals (04:36)
  • Operators (02:57)
  • Demo: Operators (03:11)
  • Creating Help and Comments (01:39)
  • Demo: Help and Comments (02:54)
  • Error Handling (01:49)
  • Demo: Error Handling (02:16)
  • Summary (01:26)