More PowerShell: Hash tables

Using arcane text-based syntax to achieve miraculous results

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

In this next installment of my ongoing PowerShell series, I want to focus on putting PowerShell objects to work for you. Let me warn you in advance, however: Put on your advanced thinking caps for this piece, especially if you are a non-programmer or non-developer and are used to pointing at things and clicking them once or twice to accomplish some tasks. I'm going to get abstract with you here but, as far as I know, there is no way around it.

The subject? Hash tables; these are *very* useful tools to have in your arsenal. It just takes a while to both (a) understand them and their use fully and (b) wrap your head around the **extremely funky** syntax that they use. Really, the syntax is unforgiveable. I'm going to try to simplify things as much as possible.

transparent binary code binary code computer coding technical programming 000000123354 iStockphoto

Hash tables are a fancy way of saying "A table full of single pieces of information many times over." Those single pieces of information are known as name-value pairs, or key-value pairs as you might sometimes see them called. These pairs store a single piece of data; the key is the descriptive word about the data and the value is the actual piece of data.

A common example of key-value pairs are a list of American states and their capitals. We might call our key-value pair table "StateCapitals," for instance, and then within that table, each state would be the key, and each state's capital would be the value.

To continue reading this article register now