This fixes test isolation issues where six test files were leaking $PSDefaultParameterValues["It:Skip"] settings to subsequent tests, causing widespread test skipping on Linux. The fixes address two distinct patterns: using .Remove() which doesn't restore the original state (4 files), and imbalanced Push-DefaultParameterValueStack/Pop-DefaultParameterValueStack calls (2 files).
* add tests
* fix formatting issues
* Make redirection to variable an experimental feature.
Update test to check for experimental feature status.
Set-Variable will still have the -append parameter, but if used when the experimental feature is disabled, a parameter binding error will result.
* Check to be sure provider is not null.
* update to use different FullyQualifiedErrorId
* use Experimental attribute for append parameter rather than runtime check.
* Revert "update to use different FullyQualifiedErrorId"
This reverts commit 8b34af1ac19ecdb821b34534e446ab129830c92f.
* Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs
Co-authored-by: Ilya <darpa@yandex.ru>
* Move remediation steps into resource.
Update Set-Variable -Append to be correct when -name and -value are used.
Add tests for the new behavior in Set-Variable.
* Change expected error for contrained language mode and redirection.
* Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs
Co-authored-by: Ilya <darpa@yandex.ru>
* Support redirection of native app.
Add tests to validate.
* testexe needs proper case to run on linux.
* Address codefactor issues 01.
* Update src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
Co-authored-by: Steve Lee <slee@microsoft.com>
* Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs
Co-authored-by: Steve Lee <slee@microsoft.com>
* Update src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
Co-authored-by: Steve Lee <slee@microsoft.com>
---------
Co-authored-by: Ilya <darpa@yandex.ru>
Co-authored-by: Steve Lee <slee@microsoft.com>
This is based on an issue, where Enter-PSHostProcess on a locked down (WDAC enforced) machine allows any admin to connect to any another local hosted PowerShell process and execute commands as that user. This amounts to privilege escalation on the policy locked down machine and something we want to prevent.
Fix is to check for system lock down and disable Enter-PSHostProcess cmdlet with an error message.
Moved check if able to write to $PSHome as way to skip test to `BeforeAll` which already contained a check if running on Windows.
## PR Context
As part https://github.com/PowerShell/PowerShell/pull/9279, tests were updated to be skipped if the test requires writing to `$PSHome` but is not able to. However, these tests already had a skip mechanism in place so the additional check caused the test to run when it should have skipped.
Co-authored-by: Travis Plunk <github@ez13.net>