lipkau/Spread

$PSDefaultParameterValues persist

Closed this issue · 0 comments

Expected Behavior

The console does not "remember" previous Invoke-WithParameter commands.

Current Behavior

Any parameters declared during Invoke-WithParameter remain for the duration of the current PowerShell session.

Possible Solution

Any modifications to $PSDefaultParameterValues are reverted in the END block of the command.

Steps to Reproduce (for bugs)

Invoke-WithParameter -ScriptBlock {
    Get-Service
    Get-Process
} Name '*y*'

Get-Service
# Results are filtered by -Name *y*, which I do not expect

Your Environment

Spread 1.1.0.0
PowerShell 5.1