diff --git a/lib/puppet/provider/package/powershellcore.rb b/lib/puppet/provider/package/powershellcore.rb index e9bf471..081b06b 100644 --- a/lib/puppet/provider/package/powershellcore.rb +++ b/lib/puppet/provider/package/powershellcore.rb @@ -73,7 +73,7 @@ def install_options(options) def self.instances_command # Get-Package is way faster than Get-InstalledModule <<-COMMAND - Get-Package -AllVersions -ProviderName PowerShellGet -Scope AllUsers -Type Module | + Get-Package -AllVersions -ProviderName PowerShellGet -Scope AllUsers -Type Module -WarningAction 'SilentlyContinue' | Group-Object -Property Name | % { [ordered]@{ 'name' = $_.Name diff --git a/lib/puppet/provider/psrepository/powershellcore.rb b/lib/puppet/provider/psrepository/powershellcore.rb index 37296e2..1b047e6 100644 --- a/lib/puppet/provider/psrepository/powershellcore.rb +++ b/lib/puppet/provider/psrepository/powershellcore.rb @@ -67,7 +67,7 @@ def flush def self.instances_command <<-COMMAND - @(Get-PSRepository).foreach({ + @(Get-PSRepository -WarningAction SilentlyContinue).foreach({ [ordered]@{ 'name' = $_.Name 'source_location' = $_.SourceLocation