Hash Tables are convenient but are not true objects. This is bad because you are unable to output the hash content to formatting cmdlets or export...
Powershell
Sorting Hash Tables
Hash Tables store key-value pairs, and you normally cannot sort its content. Let's define a Hash Table first to examine this: $hash =...
Using Hash Tables
Hash Tables are a great way to organize data. A hash table stores key-value-pairs. To create a new hash table variable, try this: $person = @{} You...
Strongly Typed Variables
Unless you override how PowerShell stores variable content, you may find that PowerShell does not automatically pick the best type. For example,...
Permanent Changes to Environment Variables
You can easily manage environment variables with the predefined env: drive. For example, to add a new environment variable, type this: $env:launched...
Making Variables Constant
If you need to write more robust scripts, it makes sense to write-protect certain variables. Whenever you want a variable to set its content as...
Add Descriptions to Variables
Keeping track of a variable’s purpose can be accomplished by assigning a clear text description: $ip = '10.10.10.10' Set-Variable ip...
Assigning Variables
With PowerShell, you can assign values to multiple variables. For example, to initialize three variables to the same default value, use this: $a =...