From 85253a6b5e633ef82f03895c2d618076f7ee5a7b Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 16 Jan 2026 09:17:29 -0600 Subject: [PATCH] Describe behavior of Local scope modifier --- .../5.1/Microsoft.PowerShell.Core/About/about_Scopes.md | 7 +++++-- .../7.4/Microsoft.PowerShell.Core/About/about_Scopes.md | 7 +++++-- .../7.5/Microsoft.PowerShell.Core/About/about_Scopes.md | 7 +++++-- .../7.6/Microsoft.PowerShell.Core/About/about_Scopes.md | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Scopes.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Scopes.md index c57fd17056af..c87c7b3de398 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Scopes.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Scopes.md @@ -1,7 +1,7 @@ --- description: Explains the concept of scope in PowerShell and shows how to set and change the scope of elements. Locale: en-US -ms.date: 02/02/2025 +ms.date: 01/16/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Scopes @@ -124,7 +124,10 @@ optional scope modifiers: - `Global:` - Specifies that the name exists in the **Global** scope. - `Local:` - Specifies that the name exists in the **Local** scope. The current - scope is always the **Local** scope. + scope is always the **Local** scope. When you use the `Local:` scope + modifier, PowerShell doesn't search parent scopes. If the item exists in the + current scope, it's used. If the item doesn't exist in the current scope, + PowerShell creates a new item in the current scope. - `Private:` - Specifies that the name is **Private** and only visible to the current scope. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Scopes.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Scopes.md index 363e9f2bdc8e..d944908da576 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Scopes.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Scopes.md @@ -1,7 +1,7 @@ --- description: Explains the concept of scope in PowerShell and shows how to set and change the scope of elements. Locale: en-US -ms.date: 02/02/2025 +ms.date: 01/16/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Scopes @@ -124,7 +124,10 @@ optional scope modifiers: - `Global:` - Specifies that the name exists in the **Global** scope. - `Local:` - Specifies that the name exists in the **Local** scope. The current - scope is always the **Local** scope. + scope is always the **Local** scope. When you use the `Local:` scope + modifier, PowerShell doesn't search parent scopes. If the item exists in the + current scope, it's used. If the item doesn't exist in the current scope, + PowerShell creates a new item in the current scope. - `Private:` - Specifies that the name is **Private** and only visible to the current scope. diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Scopes.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Scopes.md index 4dd41987f88b..55b7fa4a71f2 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Scopes.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Scopes.md @@ -1,7 +1,7 @@ --- description: Explains the concept of scope in PowerShell and shows how to set and change the scope of elements. Locale: en-US -ms.date: 02/02/2025 +ms.date: 01/16/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Scopes @@ -124,7 +124,10 @@ optional scope modifiers: - `Global:` - Specifies that the name exists in the **Global** scope. - `Local:` - Specifies that the name exists in the **Local** scope. The current - scope is always the **Local** scope. + scope is always the **Local** scope. When you use the `Local:` scope + modifier, PowerShell doesn't search parent scopes. If the item exists in the + current scope, it's used. If the item doesn't exist in the current scope, + PowerShell creates a new item in the current scope. - `Private:` - Specifies that the name is **Private** and only visible to the current scope. diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Scopes.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Scopes.md index 8d6dc3801a9a..eb44d7531641 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Scopes.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Scopes.md @@ -1,7 +1,7 @@ --- description: Explains the concept of scope in PowerShell and shows how to set and change the scope of elements. Locale: en-US -ms.date: 02/02/2025 +ms.date: 01/16/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_scopes?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Scopes @@ -124,7 +124,10 @@ optional scope modifiers: - `Global:` - Specifies that the name exists in the **Global** scope. - `Local:` - Specifies that the name exists in the **Local** scope. The current - scope is always the **Local** scope. + scope is always the **Local** scope. When you use the `Local:` scope + modifier, PowerShell doesn't search parent scopes. If the item exists in the + current scope, it's used. If the item doesn't exist in the current scope, + PowerShell creates a new item in the current scope. - `Private:` - Specifies that the name is **Private** and only visible to the current scope.