Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit-remoting modules, at least as used by the Windows PowerShell Compatibility feature, do not honor $ProgressPreference #19063

Closed
5 tasks done
mklement0 opened this issue Jan 30, 2023 · 5 comments
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. Resolution-No Activity Issue has had no activity for 6 months or more WG-Remoting PSRP issues with any transport layer

Comments

@mklement0
Copy link
Contributor

mklement0 commented Jan 30, 2023

Prerequisites

Steps to reproduce

The Windows PowerShell Compatibility feature auto-generates script modules that use implicit remoting, such as for the Appx module.

Several of the Appx module's cmdlets put up a progress bar, such as Add-AppxPackage.

It is currently impossible to silence their progress display via implicit remoting, even with $global:ProgressPreference = 'SilentlyContinue' (the use of a global variable is - unfortunately - required due to a fundamental problem with how script modules (don't) see a caller's preference variables - see #4568)

$global:ProgressPreference = 'SilentlyContinue'

# Note: for the progress bar shown during *creation of the script module*,
#  `$ProgressPreference = 'SilentlyContinue' *is* effective.
Import-Module Appx -UseWindowsPowerShell 3>$null

# Note: Pick any *.appx file on your system that is suitable for experimentation
$packagePath = 'C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.Midi.GmDls\10.0.22621.0\Appx\Neutral\MidiVoices.appx'

Add-AppxPackage $packagePath

[Console]::Write("`nPress a key to exit."); $null = [Console]::ReadKey()

Expected behavior

No progress bar should show.

Actual behavior

A progress bar generated by Add-AppxPackage is shown.

Note: The fact that the progress bar stays visible even though Add-AppxPackage has already terminated is a separate problem stemming from the cmdlet neglecting to hide the progress bar on termination:

Error details

No response

Environment data

PowerShell Core 7.3.2
PowerShell Core 7.4.0-preview.1

Visuals

No response

@mklement0 mklement0 added the Needs-Triage The issue is new and needs to be triaged by a work group. label Jan 30, 2023
@SteveL-MSFT
Copy link
Member

It seems feasible to copy the current preference variables to the remote session, but not to keep them dynamically updated if they change after creating the session.

@SteveL-MSFT SteveL-MSFT added the WG-Remoting PSRP issues with any transport layer label Jan 30, 2023
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

1 similar comment
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-No Activity Issue has had no activity for 6 months or more labels Nov 15, 2023
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. Resolution-No Activity Issue has had no activity for 6 months or more WG-Remoting PSRP issues with any transport layer
Projects
None yet
Development

No branches or pull requests

2 participants