diff --git a/reference/docs-conceptual/learn/deep-dives/everything-about-hashtable.md b/reference/docs-conceptual/learn/deep-dives/everything-about-hashtable.md index 756aeaf39f3..e4ddf78701b 100644 --- a/reference/docs-conceptual/learn/deep-dives/everything-about-hashtable.md +++ b/reference/docs-conceptual/learn/deep-dives/everything-about-hashtable.md @@ -1,7 +1,7 @@ --- description: Hashtables are really important in PowerShell so it's good to have a solid understanding of them. ms.custom: contributor-KevinMarquette -ms.date: 06/25/2023 +ms.date: 10/22/2025 title: Everything you wanted to know about hashtables --- # Everything you wanted to know about hashtables @@ -269,6 +269,16 @@ $environments.Keys.Clone() | ForEach-Object { } ``` +> [!NOTE] +> You can't clone a hashtable containing a single key. PowerShell throws an error. Instead, you +> convert the **Keys** property to an array, then iterate over the array. + +```powershell +@($environments.Keys) | ForEach-Object { + $environments[$_] = 'SrvDev03' +} +``` + ## Hashtable as a collection of properties So far the type of objects we placed in our hashtable were all the same type of object. I used ages