Learn Windows PowerShell in a Month of Lunches, Third Edition
Don Jones and Jeffery Hicks
  • December 2016
  • ISBN 9781617294167
  • 384 pages
  • printed in black & white

Superb...full of real-world examples, this book is an IT specialist's best friend.

Olivier Deveault, Voxco Group

Learn Windows PowerShell in a Month of Lunches, Third Edition is an innovative tutorial designed for busy IT professionals. This updated edition covers PowerShell features that run on Windows 7, Windows Server 2008 R2 and later, PowerShell v3 and later, and includes v5 features like PowerShellGet.

Listen to this book in liveAudio! liveAudio integrates a professional voice recording with the book’s text, graphics, code, and exercises in Manning’s exclusive liveBook online reader. Use the text to search and navigate the audio, or download the audio-only recording for portable offline listening. You can purchase or upgrade to liveAudio here or in liveBook.

About the Technology

PowerShell is both a scripting language and an administrative shell that lets you control and automate nearly every aspect of Windows. It accepts and executes commands interactively and you can write scripts to manage most Windows servers like Exchange, IIS, and SharePoint, as well as online services like Azure and Office 365.

About the book

Learn Windows PowerShell in a Month of Lunches, Third Edition is an innovative tutorial designed for busy IT professionals. Just set aside one hour a day - lunchtime would be perfect - for a month, and you'll be automating Windows tasks faster than you ever thought possible. This updated edition covers PowerShell features that run on Windows 7, Windows Server 2008 R2 and later, PowerShell v3 and later, and includes v5 features like PowerShellGet.

Table of Contents detailed table of contents

1. Before you begin

1.1. Why you can't afford to ignore PowerShell

1.1.1. Life without PowerShell

1.1.2. Life with PowerShell

1.2. Is this book for you?

1.3. How to use this book

1.4. Setting up your lab environment

1.5. Installing Windows PowerShell

1.6. Contacting us

1.7. Being immediately effective with PowerShell

2. Meet PowerShell

2.1. Choose your weapon

2.1.1. The console window

2.1.2. The Integrated Scripting Environment (ISE)

2.2. It's typing class all over again

2.3. Common points of confusion

2.4. What version is this?

2.5. Lab

3. Using the help system

3.1. The help system: how you discover commands

3.2. Updatable help

3.3. Asking for help

3.4. Using help to find commands

3.5. Interpreting the help

3.5.1. Parameter sets and common parameters

3.5.2. Optional and mandatory parameters

3.5.3. Positional parameters

3.5.4. Parameter values

3.5.5. Finding command examples

3.6. Accessing "about" topics

3.7. Accessing online help

3.8. Lab

4. Running commands

4.1. Not scripting, but running commands

4.2. The anatomy of a command

4.3. The cmdlet naming convention

4.4. Aliases: nicknames for commands

4.5. Taking shortcuts

4.5.1. Truncating parameter names

4.5.2. Parameter name aliases

4.5.3. Positional parameters

4.6. Cheating, a bit: Show-Command

4.7. Support for external commands

4.8. Dealing with errors

4.9. Common points of confusion

4.9.1. Typing cmdlet names

4.9.2. Typing parameters

4.10. Lab

5. Working with providers

5.1. What are providers?

5.2. How the filesystem is organized

5.3. How the filesystem is like other data stores

5.4. Navigating the filesystem

5.5. Using wildcards and literal paths

5.6. Working with other providers

5.7. Lab

5.8. Further exploration

6. The pipeline: connecting commands

6.1. Connect one command to another: less work for you

6.2. Exporting to a CSV or an XML file

6.2.1. Exporting to CSV

6.2.2. Exporting to XML

6.2.3. Comparing files

6.3. Piping to a file or a printer

6.4. Converting to HTML

6.5. Using cmdlets that modify the system: killing processes and stopping services

6.6. Common points of confusion

6.7. Lab

7. Adding commands

7.1. How one shell can do everything

7.2. About product-specific "management shells"

7.3. Extensions: finding and adding snap-ins

7.4. Extensions: finding and adding modules

7.5. Command conflicts and removing extensions

7.6. Playing with a new module

7.7. Profile scripts: preloading extensions when the shell starts

7.8. Getting modules from the Internet

7.9. Common points of confusion

7.10. Lab

8. Objects: data by another name

8.1. What are objects?

8.2. Why PowerShell uses objects

8.3. Discovering objects: Get-Member

8.4. Object attributes, or "properties"

8.5. Object actions, or "methods"

8.6. Sorting objects

8.7. Selecting the properties you want

8.8. Objects until the end

8.9. Common points of confusion

8.10. Lab

9. The pipeline, deeper

9.1. The pipeline: enabling power with less typing

9.2. How PowerShell passes data down the pipeline

9.3. Plan A: pipeline input ByValue

9.4. Plan B: pipeline input ByPropertyName

9.5. When things don't line up: custom properties

9.6. Parenthetical commands

9.7. Extracting the value from a single property

9.8. Lab

9.9. Further exploration

10. Formatting—and why it's done on the right

10.1. Formatting: making what you see prettier

10.2. About the default formatting

10.3. Formatting tables

10.4. Formatting lists

10.5. Formatting wide

10.6. Custom columns and list entries

10.7. Going out: to a file, a printer, or the host

10.8. Another out: GridViews

10.9. Common points of confusion

10.9.1. Always format right

10.9.2. One type of object at a time, please

10.10. Lab

10.11. Further exploration

11. Filtering and comparisons

11.1. Making the shell give you just what you need

11.2. Filter left

11.3. Comparison operators

11.4. Filtering objects out of the pipeline

11.5. The iterative command-line model

11.6. Common points of confusion

11.6.1. Filter left, please

11.6.2. When $_ is allowed

11.7. Lab

11.8. Further exploration

12. A practical interlude

12.1. Defining the task

12.2. Finding the commands

12.3. Learning to use the commands

12.4. Tips for teaching yourself

12.5. Lab

13. Remote control: one to one, and one to many

13.1. The idea behind remote PowerShell

13.2. WinRM overview

13.3. Using Enter-PSSession and Exit-PSSession for one-to-one remoting

13.4. Using Invoke-Command for one-to-many remoting

13.5. Differences between remote and local commands

13.5.1. Invoke-Command versus -ComputerName

13.5.2. Local versus remote processing

13.5.3. Deserialized objects

13.6. But wait, there's more

13.7. Remote options

13.8. Common points of confusion

13.9. Lab

13.10. Further exploration

14. Using Windows Management Instrumentation

14.1. WMI essentials

14.2. The bad news about WMI

14.3. Exploring WMI

14.4. Choose your weapon: WMI or CIM

14.5. Using Get-WmiObject

14.6. Using Get-CimInstance

14.7. WMI documentation

14.8. Common points of confusion

14.9. Lab

14.10. Further exploration

15. Multitasking with background jobs

15.1. Making PowerShell do multiple things at the same time

15.2. Synchronous versus asynchronous

15.3. Creating a local job

15.4. WMI, as a job

15.5. Remoting, as a job

15.6. Getting job results

15.7. Working with child jobs

15.8. Commands for managing jobs

15.9. Scheduled jobs

15.10. Common points of confusion

15.11. Lab

16. Working with many objects, one at a time

16.1. Automation for mass management

16.2. The preferred way: "batch" cmdlets

16.3. The CIM/WMI way: invoking methods

16.4. The backup plan: enumerating objects

16.5. Common points of confusion

16.5.1. Which way is the right way?

16.5.2. WMI methods versus cmdlets

16.5.3. Method documentation

16.5.4. ForEach-Object confusion

16.6. Lab

17. Security alert!

17.1. Keeping the shell secure

17.2. Windows PowerShell security goals

17.3. Execution policy and code signing

17.3.1. Execution policy settings

17.3.2. Digital code signing

17.4. Other security measures

17.5. Other security holes?

17.6. Security recommendations

17.7. Lab

18. Variables: a place to store your stuff

18.1. Introduction to variables

18.2. Storing values in variables

18.3. Using variables: fun tricks with quotes

18.4. Storing many objects in a variable

18.4.1. Working with single objects in a variable

18.4.2. Working with multiple objects in a variable

18.4.3. Other ways to work with multiple objects

18.4.4. Unrolling Properties and Methods in PowerShell v3

18.5. More tricks with double quotes

18.6. Declaring a variable's type

18.7. Commands for working with variables

18.8. Variable best practices

18.9. Common points of confusion

18.10. Lab

18.11. Further exploration

19. Input and output

19.1. Prompting for, and displaying, information

19.2. Read-Host

19.3. Write-Host

19.4. Write-Output

19.5. Other ways to write

19.6. Lab

19.7. Further exploration

20. Sessions: remote control with less work

20.1. Making PowerShell remoting a bit easier

20.2. Creating and using reusable sessions

20.3. Using sessions with Enter-PSSession

20.4. Using sessions with Invoke-Command

20.5. Implicit remoting: importing a session

20.6. Disconnected sessions

20.7. Lab

20.8. Further exploration

21. You call this scripting?

21.1. Not programming, more like batch files

21.2. Making commands repeatable

21.3. Parameterizing commands

21.4. Creating a parameterized script

21.5. Documenting your script

21.6. One script, one pipeline

21.7. A quick look at scope

21.8. Lab

22. Improving your parameterized script

22.1. Starting point

22.2. Getting PowerShell to do the hard work

22.3. Making parameters mandatory

22.4. Adding parameter aliases

22.5. Validating parameter input

22.6. Adding the warm and fuzzies with verbose output

22.7. Lab

23. Advanced remoting configuration

23.1. Using other endpoints

23.2. Creating custom endpoints

23.2.1. Creating the session configuration

23.2.2. Registering the session

23.3. Enabling multihop remoting

23.4. Digging deeper into remoting authentication

23.4.1. Defaults for mutual authentication

23.4.2. Mutual authentication via SSL

23.4.3. Mutual authentication via TrustedHosts

23.5. Lab

24. Using regular expressions to parse text files

24.1. The purpose of regular expressions

24.2. A regex syntax primer

24.3. Using regex with -Match

24.4. Using regex with Select-String

24.5. Lab

24.6. Further exploration

25. Additional random tips, tricks, and techniques

25.1. Profiles, prompts, and colors: customizing the shell

25.1.1. PowerShell profiles

25.1.2. Customizing the prompt

25.1.3. Tweaking colors

25.2. Operators: -as, -is, -replace, -join, -split, -in, -contains

25.2.1. -as and -is

25.2.2. -replace

25.2.3. -join and -split

25.2.4. -contains and -in

25.3. String manipulation

25.4. Date manipulation

25.5. Dealing with WMI dates

25.6. Setting default parameter values

25.7. Playing with script blocks

25.8. More tips, tricks, and techniques

26. Using someone else's script

26.1. The script

26.2. It’s a line-by-line examination

26.3. Lab

27. Never the end

27.1. Ideas for further exploration

27.2. "Now that I've read the book, where do I start?"

27.3. Other resources you'll grow to love

28. PowerShell cheat sheet

28.1. Punctuation

28.2. Help file

28.3. Operators

28.4. Custom property and column syntax

28.5. Pipeline parameter input

28.6. When to use $_


Appendix A: Review labs

A.1. Review lab 1: chapters 1-6

A.2. Review lab 2: chapters 1-14

A.3. Review lab 3: chapters 1-19

A.4. Answers

A.5. Review Lab 1

A.6. Review Lab 2

A.7. Review Lab 3

Appendix B: Chapter Lab Answers

B.1. Chapter 3

B.2. Chapter 4

B.3. Chapter 5

B.4. Chapter 6

B.5. Chapter 7

B.6. Chapter 8

B.7. Chapter 9

B.8. Chapter 10

B.9. Chapter 11

B.10. Chapter 12

B.11. Chapter 13

B.12. Chapter 14

B.13. Chapter 15

B.14. Chapter 16

B.15. Chapter 18

B.16. Chapter 19

B.17. Chapter 20

B.18. Chapter 21

B.19. Chapter 22

B.20. Chapter 23

B.21. Chapter 24

B.22. Chapter 26

What's inside

  • Learn PowerShell from the beginning, no experience required!
  • Covers PowerShell v3 and up, Windows 7, and Windows Server 2008 R2 and later
  • Each lesson takes you an hour or less

About the reader

Experience with Windows administration is helpful. No programming or scripting experience needed.

About the authors

Veteran PowerShell MVPs Don Jones and Jeffery Hicks bring years as successful trainers to this concise, easy-to-follow book.

placing your order...

Don't refresh or navigate away from the page.
print book $33.74 $44.99 pBook + eBook + liveBook
Additional shipping charges may apply
Learn Windows PowerShell in a Month of Lunches, Third Edition (print book) added to cart
continue shopping
go to cart

eBook $26.99 $35.99 3 formats + liveBook
Learn Windows PowerShell in a Month of Lunches, Third Edition (eBook) added to cart
continue shopping
go to cart

Add liveAudio for only $19.99
Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks