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

Warning on First Use of Export-Configuration #48

Open
aproposts opened this issue Aug 7, 2022 · 1 comment
Open

Warning on First Use of Export-Configuration #48

aproposts opened this issue Aug 7, 2022 · 1 comment
Assignees

Comments

@aproposts
Copy link

The first time Export-Configuration is used, it generates a warning message:

WARNING: The Enterprise path C:\Users\<username>\AppData\Roaming\powershell cannot be found

...and it cannot be suppressed with any of the usual methods:

$callerWarningPreference = $WarningPreference
$WarningPreference = 'SilentlyContinue'

$new | Export-Configuration -WarningAction Ignore

$WarningPreference = $callerWarningPreference

I'm trying to present a clean experience to users and this error message is a bit cryptic and not at all helpful: Export-Configuration creates the path and writes the file without issue. Surely this message is better suited to the Verbose stream? Searching the source, it appears to be coming from Get-ConfigurationPath and the flags to suppress warning aren't being pushed down into its scope.

I suppose I could call Get-ConfigurationPath myself first--suppressing the warning there--but I think the issue still deserves attention in either the code or the documentation.

@Jaykul
Copy link
Member

Jaykul commented Aug 17, 2022

Yeah, I think I can take a look at that. It's likely the extra locations are basically going unused anyway ;-)

@Jaykul Jaykul self-assigned this Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants