July 2017
Intermediate to advanced
648 pages
31h 9m
English
You can initialize an array that stores a set of items by assigning multiple values to a variable. All you need to do is separate each value with a comma. The following command would create an array of server names:
$servers = "EX1","EX2","EX3"
To create an empty hash table, use the following syntax:
$hashtable = @{}
Now that we have an empty hash table, we can add key-value pairs:
$hashtable["server1"] = 1
$hashtable["server2"] = 2
$hashtable["server3"] = 3
Notice in this example that we can assign a value based on a key name, not using an index number as we saw with a regular array. Alternatively, we can create this same object using a single command using the following syntax:
$hashtable = @{server1 = 1; server2 ...Read now
Unlock full access