PowerShell for Total Beginners
PowerShell for Total Beginners
PowerShell for Total Beginners

This book is 100% complete

Completed on 2015-11-28

About the Book

If you don’t know PowerShell, you’re getting left behind.

PowerShell is absolutely everywhere. It’s embedded in Microsoft products. You’ll find it in Exchange, SharePoint, SQL, Skype for Business and Lync, Windows Server itself, and even third party software has jumped on the bandwagon.

In fact, some Microsoft products use PowerShell as their primary management interface. Sometimes there are features to configure or settings to administer that you just can’t get to via the GUI anymore. That’s how far PowerShell has come.

So it’s time to face the bottom line: if you administer or use Windows products from any sort of management perspective, you’re going to use PowerShell at some point. Or you won’t be able to do your job. It’s really that simple.

If you don’t learn PowerShell now, then when?

Hey, I get it. Learning a new scripting language doesn’t pay the bills. You have to put out fires, remove that pesky Cryptolocker malware, increase everyone’s mailbox quota by 10 GB a piece because these damn iPhones take such high resolution pictures, move a bunch of data up to Office 365, make sure everyone’s Dropbox accounts are locked down–and that’s only before lunch.


Learning PowerShell will pay the bills.

Now, I don’t like speaking from a fear perspective. I want you to want to learn PowerShell. I want you to be convinced it’s the best thing since sliced bread. (I don’t know that it is, though, because I really like a good sandwich.)

The issue is, plenty of other people already made up their mind. Hiring managers have. Other employee candidates have. PowerShell experience is a requirement for many–dare I say most–job postings in this new economy. If you want a new system administrator position, or if you want to move up in the ranks to management or grow your experience elsewhere, you have to have PowerShell chops in order to fit in.

And if you’re a consultant or you manage a lot of systems, you are actually costing yourself money by not working in the most efficient way possible. Do you bill by the hour? Do you regularly set up production systems for new clients? Do you have a script that lets you do it in five minutes, or do you sit there manually and take a whole weekend to on-board a new client?

If you can’t do your job without a GUI, you’re at the end of the road.

The GUI is dead. We can have a funeral and lament the good ole days of Remote Desktop to 15 different servers at one time, or we can learn how to move forward with PowerShell. I vote for that.

Trouble is, lots of people never take the time to actually learn PowerShell. Rather, they just start trying to look up commands one at a time. How do you add a mailbox to Exchange? How do you add new users to your network? How can I run the same command on all ten of my domain controllers?

And so they Google and Bing for answers and they find some that are sort of applicable, but don’t fully work in their environments. They run the examples, they fail, the error messages are cryptic, and they give up in frustration. It’s impossible to learn PowerShell by sound bite, after all. And they think to themselves, “who has time to learn this stuff?”

Learning PowerShell is hard. And it’s OK to admit that.

I took the time to ask some folks what their biggest hang-ups with PowerShell were right then and there. I wanted to understand what was holding people back. I got a lot of answers, and I saw some clear themes develop. Some of the most common answers I got looked a lot like the following:

  • “I’m not a developer so these scripts look like greek to me.”
  • “I don’t have time to learn PowerShell well.”
  • “I’m not sure how to apply PowerShell to my daily work.”
  • “It’s so big! How can I remember everything?”
  • “I have no idea where to find help and the documentation is poor or intimidating, or both!”

And if you’ve spent only ten or 15 minutes with PowerShell, it’s easy to see how those are your main takeaways from your experience.

But it doesn’t have to be that way.

You don’t have to be a developer. You don’t have to have a lot of time to learn PowerShell. You can apply PowerShell almost immediately. You don’t have to remember every command. And the help you actually need is right around the corner.

I can show you how, and why, all of those things are true in my new book and video series.

Introducing PowerShell for Total Beginners

PowerShell for Total Beginners is my custom built, handcrafted, painstakingly curated book and video series designed to get you from total PowerShell newbie to confident and open PowerShell user in as little as four weeks.

The Book

The PowerShell for Total Beginners book I can sum up in one way:

It’s PowerShell as I would like to have learned it.

I’m not a developer. I was a system administrator for a Research I university for a while, I was a SharePoint administrator, and I’ve been covering Microsoft and Windows Server from an IT pro perspective for 16 years now. I saw the importance PowerShell was gaining in the industry and I wanted to learn it.

I wanted to learn it so much, in fact, that I went out and bought basically every beginner resource that I could get my hands on. I bought books that promised I could learn in 24 hours, in a month of hour long sessions, in three weeks, and that I’d know everything at the end. I bought books geared toward idiots because I thought that would be a good place to start.

I’ll be honest with you–every single one of them disappointed me in some way. Every one.

I didn’t learn PowerShell well. I certainly didn’t learn it in 24 hours, or even a month. Sure, I picked up bits and pieces, but the overwhelming feeling I got from these books is that they assumed too much knowledge on my part. They thought I would know what an int32 was. They thought I’d be able to figure out what modules and variables were. And what the hell is a pipe character?

There were some great books for the advanced beginner, but for a guy with no development experience and no prior knowledge of PowerShell, I felt lost.

I know why this is the case. Most programmers are absolutely terrible at teaching programming, and yet programmers are the ones writing the books. These guys and gals are so advanced and so in the dirt, so to speak, that they just cannot empathize with or imagine a complete beginner, a total non-programmer, non-developer wanting to learn anything. And so in their writing and their teaching they make giant leaps and bounds without even realizing it, leaving their students lost and frustrated and on the brink of giving up.

It occurred to me that I certainly couldn’t be the only one who actually was a newbie with zero development or scripting experience who recognized and acknowledged the need to learn PowerShell, but who needed a serious helping hand. So, given the lack of good–well, any as far as I could tell–resources on the market for that demographic, I decided to take action.

I decided to create the book I wanted to learn PowerShell from.

And that’s what PowerShell for Total Beginners is. It’s over 200 pages of PowerShell hand holding. If your grandmother cared anything about learning PowerShell, she could learn it from my book.

Writing this book was a labor of love. I wanted to create the authority for total beginners who needed to learn PowerShell. I wanted to create an elegant resource that assumed no prior knowledge. I wanted to create a learning point that covered every topic worth covering with a depth of explanation that is unparalleled by any book of course on the market. I wanted to create a product that would make even the skeptics of PowerShell come away at the end in love with the language and ready to take their skills to the next level. In the end, I did it and I’m proud of it.

Table of Contents

  • Preface
    • If you can’t do your job without a GUI, you’re at the end of the road.
    • Learning PowerShell is hard. And it’s OK to admit that.
    • What to Expect from This Book
    • What’s Special About This Book
    • Don’t Wait
  • Chapter 1: Getting Started and Setting Up
    • Valid Platforms and Versions
    • Two Important PowerShell Tools
      • The PowerShell Integrated Scripting Environment (ISE)
        • IntelliSense
        • Getting the ISE Set Up
      • The Windows PowerShell Console
        • Running the Console as an Administrator
        • Setting Up the Windows PowerShell Console
        • Running and Stopping Commands in the Console
        • Windows PowerShell Console Caveats
        • Tab Completion
    • The Last Word
  • Chapter 2: The Basics of PowerShell
    • Some Terminology and Definitions
      • A Little about Aliases
      • PowerShell Command Components
        • Commands
        • Parameters
          • Syntax
          • Types of Parameter Values
          • Some Parameters are Positional Parameters
          • Optional Parameters
          • Mandatory Parameters
          • Parameter Sets – The Fork In The Road
          • Common Parameters
        • Shortcuts
        • External Commands
        • Commands Within Commands
      • Knowing Which Commands to Use and How to Use Them: Getting Help
        • Looking at Help for a Known Command
      • Looking for Help With an Idea or Concept
      • Full, Unrestrained, Painstakingly Detailed Help
      • A Little Interactive Handholding: Show-Command
      • Understanding Error Messages
      • Always Use Protection: Stopping You from Hurting Yourself
    • The Last Word
  • Chapter 3: The PowerShell Pipeline
    • Introducing the Pipeline
    • Piping to the Screen and to Files
      • To the Screen: Out-Host
      • To Files: Out-File
      • To Printers: Out-Printer
    • Importing and Exporting Data for PowerShell to Work With
      • Importing from Comma-Separated Values (CSV) Files
      • Exporting to Comma-Separated Values (CSV) Files
      • Converting Content
    • The Last Word
  • Chapter 4: PowerShell Providers, Modules, and Snap-ins
    • Introducing Providers
      • How Providers Work
      • Provider Capabilities and Drives
      • Items
      • Differences in Providers Matter
      • A Provider Example: The Registry
    • Introducing Modules and Snap-ins
      • Modules
      • Snap-ins
      • About Management Shells
      • Your Profile: Your Favorite Snap-Ins and Modules, Automatically Loaded
    • The Last Word
  • Chapter 5: The Complete Beginner’s Guide to Objects
    • What is an Object?
    • Properties and Methods
    • Objects and the Pipeline
      • Inspecting an Object’s Properties and Methods
    • Manipulating Objects
      • Limiting or Selecting
      • Sorting
    • Remembering What Kinds of Objects are in the Pipeline
    • The Last Word
  • Chapter 6: Filtering and Limiting
    • Introducing Where-Object
      • The Syntax for Where-Object
      • Using the Where-Object Goods
    • Getting Lists and Filtering on Them
    • Filtering, in a Pragmatic Sense
    • Another Example of Objects and Filtering
    • Further Exploration
    • The Last Word
  • Chapter 7: Creating Simple Scripts
    • Introducing Scripts in PowerShell
    • Making Scripts Useful, Phase 1: Variables
    • Making Scripts Useful, Phase 2: If/Then, Do-While, and ForEach
      • The If/Then Construct
      • Do While Constructs
      • The ForEach Construct
    • Putting It All Together: Scripts to Accomplish Something Useful
      • Method 1
      • Method 2
      • A Simple Backup Strategy for Smaller Environment: Exporting Mailboxes
      • Clearing the Requests
    • The Last Word
  • Chapter 8: More Work with Objects
    • Comparing Two Objects
      • Looking at Compare-Object
      • Another Example
    • Selecting Objects
      • Selecting a Certain Number of Objects
      • Selecting Certain Properties
    • Grouping Objects with Common Characteristics
    • Hash Tables
    • PowerShell in the Real World: Grouping and Comparing Objects
    • The Last Word
  • Chapter 9: To The Many, To The Few - PowerShell Remoting
    • Introducing Remoting
    • How Remoting Works
    • Enabling PowerShell Remoting
    • Remoting to One Computer at a Time
    • Remoting to Many Computers at a Time
      • Specifying a Script File Instead of a Command
      • Specifying a Separate List of Computers
      • The Caveats When Using Remote Commands
        • Serialization and Deserialization Side Effects
        • Remoting with Efficiency in Mind
        • Remoting Needs Some Permission Sometimes
    • The Last Word
  • Chapter 10: Useful PowerShell Tools
    • Dell PowerGUI
    • SAPIEN Technologies PowerShell Studio 2015
    • Amazon AWS Tools for Windows PowerShell
    • Microsoft Script Browser for Windows PowerShell ISE
    • Adam Driscoll’s PowerShell Tools for Visual Studio
    • Microsoft Windows PowerShell Web Access, via Control Panel
    • PowerShell Training via the Microsoft Virtual Academy
    • Master-PowerShell, an ebook from Dr. Tobias Weltner
    • VMware vSphere PowerCLI
    • The Last Word
  • Chapter 11: Using PowerShell to Manage Office 365
    • Create a Script to Open a PowerShell Session to Office 365 in One Click
    • Assign Rights to Mailboxes
    • Converting Regular Mailboxes to Shared Mailboxes
    • Obtaining Last Logon Times for Office 365 Accounts
    • Onboarding a List of Multiple New Users to Your Office 365 Tenant
    • Lock Down and Configure Sharing on a SharePoint Online Tenant
    • Examining and Auditing Who Has External Access to a SharePoint Online Site
    • Add and Remove People from Mailing Lists (Distribution Groups)
    • Performing a Mass Password Change
    • Place All Mailboxes on Litigation Hold
    • The Last Word
  • Chapter 12: Wrapping Up - Performing Five Common Administrative Tasks using Windows PowerShell
    • Adding Users
    • Deleting Dangerous or Objectionable Content from Exchange Mailboxes
    • Elegantly Handling Departed Employees and Their Distribution List Memberships
    • Create a New Comma Separated Values (.CSV) File and Populate It With Data
    • Easily Connect to Exchange Online or Office 365 from Your Hybrid Deployment
  • Appendix X: Quick Cheat Sheet of PowerShell Verbs

About the Author

Jonathan Hassell
Jonathan Hassell

Jonathan Hassell is an author and consultant based in Charlotte, North Carolina. He's been writing on Microsoft from an IT pro perspective for over 15 years.

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors and publishers use Leanpub to publish amazing in-progress and completed ebooks, just like this one. You can use Leanpub to write, publish and sell your book as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub