When there are several repositories registered and one of them is currently not available (for example private repository when machine is out of office), then Find-PSResource stops with terminating error and refuses to search from available repositories.
PS ❯ Find-PSResource sqlserver
Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
SqlServer 22.4.5.1 PSGallery This module allows SQL Server developers, administrators and business intelligence professionals to au…
PS ❯ Find-PSResource sqlserver -ErrorAction Ignore
Find-PSResource: The network path was not found. : '\\server\share\folder'.
Exception :
Type : System.IO.IOException
TargetSite :
Name : Init
DeclaringType : [System.IO.Enumeration.FileSystemEnumerator`1[TResult]]
MemberType : Method
Module : System.Private.CoreLib.dll
Message : The network path was not found. : '\\server\share\folder'.
Source : System.Private.CoreLib
HResult : -2147024843
StackTrace :
at System.IO.Enumeration.FileSystemEnumerator`1.Init()
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
at Microsoft.PowerShell.PSResourceGet.Cmdlets.LocalServerAPICalls.FindNameHelper(String packageName, String[] tags, Boolean includePrerelease
, ResourceType type, ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\LocalServerApiCalls.cs:line 266
at Microsoft.PowerShell.PSResourceGet.Cmdlets.LocalServerAPICalls.FindName(String packageName, Boolean includePrerelease, ResourceType type,
ErrorRecord& errRecord) in C:\__w\1\s\PSResourceGet\src\code\LocalServerApiCalls.cs:line 109
at Microsoft.PowerShell.PSResourceGet.Cmdlets.FindHelper.SearchByNames(ServerApiCall currentServer, ResponseUtil currentResponseUtil, PSRepos
itoryInfo repository, Boolean shouldReportErrorForEachRepo)+MoveNext() in C:\__w\1\s\PSResourceGet\src\code\FindHelper.cs:line 792
at Microsoft.PowerShell.PSResourceGet.Cmdlets.FindHelper.FindByResourceName(String[] name, ResourceType type, VersionRange versionRange, NuGe
tVersion nugetVersion, VersionType versionType, String version, Boolean prerelease, String[] tag, String[] repository, Boolean includeDependenci
es, Boolean suppressErrors)+MoveNext() in C:\__w\1\s\PSResourceGet\src\code\FindHelper.cs:line 223
at Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource.ProcessResourceNameParameterSet() in C:\__w\1\s\PSResourceGet\src\code\FindPSRes
ource.cs:line 249
at Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource.ProcessRecord() in C:\__w\1\s\PSResourceGet\src\code\FindPSResource.cs:line 148
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Find-PSResource], IOException
FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
InvocationInfo :
MyCommand : Find-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 13
Line : find-psresource sqlserver
Statement : find-psresource sqlserver
PositionMessage : At line:1 char:1
+ find-psresource sqlserver
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : find-psresource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Prerequisites
Steps to reproduce
When there are several repositories registered and one of them is currently not available (for example private repository when machine is out of office), then
Find-PSResourcestops with terminating error and refuses to search from available repositories.Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response