@@ -467,35 +467,6 @@ function ExportOperation {
467467 }
468468}
469469
470- filter Where-PSResource {
471- param (
472- [string ]$name ,
473- [string ]$version ,
474- [Scope ]$scope ,
475- [string ]$repositoryName
476- )
477-
478- process {
479- $nameMatch = if ($name ) { $_.Name -eq $name } else { $true }
480- $versionMatch = if ($_.Version ) {
481- try {
482- SatisfiesVersion - version $_.Version - versionRange $version
483- }
484- catch {
485- $_.Version.ToString () -eq $version
486- }
487- }
488- else { $true }
489- $scopeMatch = if ($_.Scope ) { $_.Scope -eq $scope } else { $true }
490- $repositoryMatch = if ($_.Repository ) { $_.Repository -eq $repositoryName } else { $true }
491-
492- if ($nameMatch -and $versionMatch -and $scopeMatch -and $repositoryMatch ) {
493- Write-Trace - message " Resource matches filter criteria: Name=$ ( $_.Name ) , Version=$ ( $_.Version ) , Scope=$ ( $_.Scope ) , Repository=$ ( $_.Repository ) " - level trace
494- $_
495- }
496- }
497- }
498-
499470function SetPSResourceList {
500471 param (
501472 $inputObj
@@ -516,7 +487,7 @@ function SetPSResourceList {
516487 $scope = if ($resourceDesiredState.scope ) { $resourceDesiredState.scope } else { " CurrentUser" }
517488
518489 # Resource should not exist - uninstall if it does
519- $currentState.resources | Where - PSResource - name $name - version $version - scope $scope - repositoryName $repositoryName | ForEach-Object {
490+ $currentState.resources | ForEach-Object {
520491
521492 $isInDesiredState = $_.IsInDesiredState ($resourceDesiredState )
522493
@@ -564,7 +535,8 @@ function SetPSResourceList {
564535
565536 Write-Trace - message " Installing resources: $ ( $resourcesToInstall.Values | ForEach-Object { " $ ( $_.Name ) -- $ ( $_.Version ) " }) "
566537 $resourcesToInstall.Values | ForEach-Object {
567- Install-PSResource - Name $_.Name - Version $_.Version - Scope $scope - Repository $repositoryName - ErrorAction Stop - TrustRepository:$inputObj.trustedRepository
538+ $usePrerelease = if ($_.preRelease ) { $true } else { $false }
539+ Install-PSResource - Name $_.Name - Version $_.Version - Scope $scope - Repository $repositoryName - ErrorAction Stop - TrustRepository:$inputObj.trustedRepository - Prerelease:$usePrerelease - Reinstall
568540 }
569541
570542 $resourcesChanged = $true
0 commit comments