Skip to content

Hashtables

neztach edited this page Aug 31, 2023 · 1 revision
Code Explanation
$Person = @{
    FirstName = 'Trevor'
    LastName = 'Sullivan'
    Likes = @(
        'Bacon',
        'Beer',
        'Software'
    )
}
Create a PowerShell HashTable
$Person.FirstName
Retrieve an item from a HashTable
$Person.Likes[-1]
Returns the last item in the "Likes" array, in the $Person HashTable (software)
$Person.Age = 50
Add a new property to a HashTable

Clone this wiki locally