O'Reilly logo

PowerShell in Depth: An administrator's guide by Don Jones, Richard Siddaway, and Jeffery Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 16. Variables, arrays, hash tables, and scriptblocks

This chapter covers

  • Variable names and types
  • Strict mode
  • Variable drives and cmdlets
  • Arrays
  • Hash tables
  • Scriptblocks

Variables are a big part of any programming language or operating system shell, and PowerShell is no exception. In this chapter, we’ll explain what they are and how to use them, and we’ll cover some advanced variable-like data structures such as arrays, hash tables, and scriptblocks.

16.1. Variables

Variables are quite simply a temporary storage area for data. If you have some piece of data you plan to use over and over again, it makes sense to store it in a variable rather than having to retrieve it from where it’s stored each time you need it. Or if you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required