Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PSUseUsingScopeModifierInNewRunspaces has false positive when using -ArgumentList on Invoke-Command #1504

Open
@jegannathanmaniganadan

Description

Steps to reproduce

 # $sb = {Invoke-Command -Session $psSession -ArgumentList $path -ErrorAction Stop -ScriptBlock {    Param ($Foo)    return $Foo}} # Invoke-ScriptAnalyzer -ScriptDefinition [scriptblock]$sb | ft -aRuleName                              Severity ScriptName Line Message--------                              -------- ---------- ---- -------PSUseUsingScopeModifierInNewRunspaces Warning             3    The variable '$Foo' is not declared within this ScriptBlock, and is missing the 'Using:' scope modifier.PSUseUsingScopeModifierInNewRunspaces Warning             5    The variable '$Foo' is not declared within this ScriptBlock, and is missing the 'Using:' scope modifier.

Expected behavior

$Foo should not get flagged

Actual behavior

$Foo is being flagged violating PSUseUsingScopeModifierInNewRunspaces.

Environment data

# $PSVersionTableName                           Value---------PSVersion5.1.18362.752PSEdition                      DesktopPSCompatibleVersions           {1.0,2.0,3.0,4.0...}BuildVersion10.0.18362.752CLRVersion4.0.30319.42000WSManStackVersion3.0PSRemotingProtocolVersion2.3SerializationVersion1.1.0.1# (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }1.19.0

@mattpwhite

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp