Skip to content

The $using: scope for remoting quietly accepts scope modifiers, but resolves to $null #9204

Description

@mklement0

Affects both:

  • true scope modifiers such as $global:
  • namespace variable notation such as $function:

Steps to reproduce

Prerequisites:

  • enable remoting on the calling machine
  • run as admin.
# Define a variable and function, both named 'foo'.
function foo { 'func' }; $global:foo = 'var'
# Try to access these definitions remotely via $using
Invoke-Command -ComputerName . { $using:foo; $using:global:foo; $using:function:foo }

Expected behavior

var
var
 'func' 

Actual behavior

var

That is, $using:global:foo and $using:function:foo quietly evaluated to $null.

Environment data

PowerShell Core 6.2.0-rc.1
Windows PowerShell v5.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-RemotingPSRP issues with any transport layer

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions