Skip to content

Fix incorrect INPUTS documentation for Clear-Variable#13057

Open
naffee wants to merge 1 commit into
MicrosoftDocs:mainfrom
naffee:fix/clear-variable-inputs
Open

Fix incorrect INPUTS documentation for Clear-Variable#13057
naffee wants to merge 1 commit into
MicrosoftDocs:mainfrom
naffee:fix/clear-variable-inputs

Conversation

@naffee
Copy link
Copy Markdown

@naffee naffee commented Jun 3, 2026

PR Summary

This PR corrects a technical inaccuracy in the Clear-Variable documentation. The ## INPUTS section previously stated that objects could not be piped to this cmdlet. It has been updated to reflect that piping a System.Management.Automation.PSVariable object is supported, which matches the behavior documented in Remove-Variable.

This fix was applied consistently across all supported version directories (5.1, 7.4, 7.5, 7.6, and 7.7) to ensure accuracy throughout the documentation.

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributor's guide.
  • Style: This PR adheres to the style guide.

Fixes MicrosoftDocs#13056. Updated the INPUTS section for Clear-Variable to reflect that piping a PSVariable object is allowed, matching the documentation for Remove-Variable.
Copilot AI review requested due to automatic review settings June 3, 2026 17:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the Clear-Variable cmdlet reference docs to reflect that pipeline input is supported (and documents the input type) across multiple PowerShell version reference sets.

Changes:

  • Updated ## INPUTS section from “None” to System.Management.Automation.PSVariable
  • Updated wording to indicate variables can be piped into Clear-Variable
  • Applied the same documentation change across 5.1 and 7.4–7.7 reference trees

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
reference/7.7/Microsoft.PowerShell.Utility/Clear-Variable.md Updates documented pipeline input type and narrative for Clear-Variable
reference/7.6/Microsoft.PowerShell.Utility/Clear-Variable.md Same INPUTS section update for 7.6 docs
reference/7.5/Microsoft.PowerShell.Utility/Clear-Variable.md Same INPUTS section update for 7.5 docs
reference/7.4/Microsoft.PowerShell.Utility/Clear-Variable.md Same INPUTS section update for 7.4 docs
reference/5.1/Microsoft.PowerShell.Utility/Clear-Variable.md Same INPUTS section update for Windows PowerShell 5.1 docs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread reference/7.7/Microsoft.PowerShell.Utility/Clear-Variable.md
Comment thread reference/5.1/Microsoft.PowerShell.Utility/Clear-Variable.md
@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit a599957:

✅ Validation status: passed

File Status Preview URL Details
reference/5.1/Microsoft.PowerShell.Utility/Clear-Variable.md ✅Succeeded View (powershell-5.1)
reference/7.4/Microsoft.PowerShell.Utility/Clear-Variable.md ✅Succeeded View (powershell-7.4)
reference/7.5/Microsoft.PowerShell.Utility/Clear-Variable.md ✅Succeeded View (powershell-7.5)
reference/7.6/Microsoft.PowerShell.Utility/Clear-Variable.md ✅Succeeded View (powershell-7.6)
reference/7.7/Microsoft.PowerShell.Utility/Clear-Variable.md ✅Succeeded View (powershell-7.7)

For more details, please refer to the build report.

@naffee
Copy link
Copy Markdown
Author

naffee commented Jun 3, 2026

@microsoft-github-policy-service agree

@sdwheeler
Copy link
Copy Markdown
Collaborator

@naffee Thanks for the PR. All the *-Variable command support pipeline input. My guess is that this information hasn't been updated since PowerShell 2.0. However, the input type is actually String[] or String.

gcm *-variable -pv cmd | %{ $cmd.Parameters.Name.Attributes[0] | Select @{n='Command'; e={$cmd.Name}}, valuefrompipe*, @{n='Type';e={$cmd.Parameters.Name.ParameterType}} }

Command         ValueFromPipeline ValueFromPipelineByPropertyName Type
-------         ----------------- ------------------------------- ----
Clear-Variable              False                            True System.String[]
Get-Variable                 True                            True System.String[]
New-Variable                False                            True System.String
Remove-Variable             False                            True System.String[]
Set-Variable                False                            True System.String[]

You can pass a PSVariable type because it has a Name property that is a string. But you could pipe any object type that has a Name property that is a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clear-Variable.md Documentation Section INPUTS is wrong - allows PSVariable object as input variable in pipe - tested on PS Core 7.5.5

3 participants