Title: PSAvoidOverwritingBuiltInCmdlets (core-6.1.0-*) returns warning for Write-Log, which is not a built-in cmdlet · Issue #2146 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: PSAvoidOverwritingBuiltInCmdlets (core-6.1.0-*) returns warning for Write-Log, which is not a built-in cmdlet · Issue #2146 · PowerShell/PSScriptAnalyzer
X Title: PSAvoidOverwritingBuiltInCmdlets (core-6.1.0-*) returns warning for Write-Log, which is not a built-in cmdlet · Issue #2146 · PowerShell/PSScriptAnalyzer
Description: Before submitting a bug report: Make sure you are able to repro it on the latest released version Perform a quick search for existing issues to check if this bug has already been reported Steps to reproduce Create a file called Write-Log...
Open Graph Description: Before submitting a bug report: Make sure you are able to repro it on the latest released version Perform a quick search for existing issues to check if this bug has already been reported Steps to ...
X Description: Before submitting a bug report: Make sure you are able to repro it on the latest released version Perform a quick search for existing issues to check if this bug has already been reported Steps to ...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/2146
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PSAvoidOverwritingBuiltInCmdlets (core-6.1.0-*) returns warning for Write-Log, which is not a built-in cmdlet","articleBody":"Before submitting a bug report:\n\n- [X] Make sure you are able to repro it on the latest released version\n- [X] Perform a quick search for existing issues to check if this bug has already been reported\n\nSteps to reproduce\n------------------\n\nCreate a file called `Write-Log.psm1` in your home directory and populate it with an empty function called `Write-Log`:\n\n```PowerShell\nfunction Write-Log {\n}\n```\n\nInstall and run PSScriptAnalyzer against the file:\n\n```PowerShell\n\u003e Install-Module PSScriptAnalyzer\n\n\u003e Invoke-ScriptAnalyzer -Path ~\\Write-Log.psm1\n```\n\nExpected behavior\n-----------------\n\nPSScriptAnalyzer returns no findings because Write-Log is not a built-in cmdlet.\n\nActual behavior\n---------------\n\n```PowerShell\nRuleName Severity ScriptName Line Message\n-------- -------- ---------- ---- -------\nPSAvoidOverwritingBuiltInCmdlets Warning Write-Log.psm1 1 'Write-Log' is a cmdlet that is included with PowerShell (version core-6.1.0-windows) whose definition should not be overridden\n```\n\nThis behaviour should be reproducible cross-platform.\n\nTroubleshooting\n---------------\n\nWrite-Log was never shipped with any version of PowerShell, but it is erroneously defined as a built-in cmdlet:\n\nhttps://github.com/PowerShell/PSScriptAnalyzer/blob/e2804796f43eab60f5d105f6bbaea83fb446a13d/Engine/Settings/core-6.1.0-linux-arm.json#L1391-L1395\n\nhttps://github.com/PowerShell/PSScriptAnalyzer/blob/e2804796f43eab60f5d105f6bbaea83fb446a13d/Engine/Settings/core-6.1.0-linux.json#L1391-L1395\n\nhttps://github.com/PowerShell/PSScriptAnalyzer/blob/e2804796f43eab60f5d105f6bbaea83fb446a13d/Engine/Settings/core-6.1.0-macos.json#L1391-L1395\n\nhttps://github.com/PowerShell/PSScriptAnalyzer/blob/e2804796f43eab60f5d105f6bbaea83fb446a13d/Engine/Settings/core-6.1.0-windows.json#L1692-L1696\n\nProbable cause is described in https://github.com/PowerShell/PowerShell/issues/7209 as an upstream issue in PSDesiredStateConfiguration that was reportedly fixed in 2020. However, the PSScriptAnalyzer files affected by that issue were never rebuilt afterwards.\n\nThe module that may have caused this problem at the time is https://github.com/microsoft/PowerShellForGitHub, which defines `Write-Log` and then suppresses PSScriptAnalyzer reports in [Helper.ps1#L128](https://github.com/microsoft/PowerShellForGitHub/blob/fd4fa65f23ca30f18f85312a85348e660c287a9c/Helpers.ps1#L128). The PR to suppress that finding is recorded in https://github.com/microsoft/PowerShellForGitHub/pull/180. If this module was present in the build environment, then PSScriptAnalyzer would have added `Write-Log` and possibly other cmdlets to the list of built-in cmdlets even though they do not ship with PowerShell.\n\nAs a result, default installations of PSScriptAnalyzer return a false warning for PSAvoidOverwritingBuiltInCmdlets against cmdlets named `Write-Log`.\n\nIt is possible that there may be other cmdlets erroneously included in these files for the same reason.\n\nEnvironment data\n----------------\n\n```PowerShell\n\u003e $PSVersionTable\n\nName Value\n---- -----\nPSVersion 7.5.4\nPSEdition Core\nGitCommitId 7.5.4\nOS Microsoft Windows 10.0.22631\nPlatform Win32NT\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n\n\u003e (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\n\n1.24.0\n```\n","author":{"url":"https://github.com/dbensmith","@type":"Person","name":"dbensmith"},"datePublished":"2025-12-05T01:27:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2146/PSScriptAnalyzer/issues/2146"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e2a4846f-d25d-12da-fbdb-bce114c7cb8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A456:360CD8:17B85AD:201D523:696EACCF |
| html-safe-nonce | 4871be49e4261b851400667ba64633936c9173851ea37cc625d6154308441c2c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDU2OjM2MENEODoxN0I4NUFEOjIwMUQ1MjM6Njk2RUFDQ0YiLCJ2aXNpdG9yX2lkIjoiNTg3MzMwOTU4NjUzNjk2NzM3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 43055441afe4306e255ce070f5665693a9eb9c94c59ae1ee4bc98f7fca6db236 |
| hovercard-subject-tag | issue:3697151243 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PSScriptAnalyzer/2146/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ba9840f0cf1207fbe09fda51965e0f33048b9aaa7a5e37d7919a027dc3b64ac/PowerShell/PSScriptAnalyzer/issues/2146 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ba9840f0cf1207fbe09fda51965e0f33048b9aaa7a5e37d7919a027dc3b64ac/PowerShell/PSScriptAnalyzer/issues/2146 |
| og:image:alt | Before submitting a bug report: Make sure you are able to repro it on the latest released version Perform a quick search for existing issues to check if this bug has already been reported Steps to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dbensmith |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 33149177 |
| octolytics-dimension-repository_nwo | PowerShell/PSScriptAnalyzer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33149177 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PSScriptAnalyzer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width