diff --git a/profile.d/Test-MyModules.ps1 b/profile.d/Test-MyModules.ps1 new file mode 100644 index 0000000..c8d7e9b --- /dev/null +++ b/profile.d/Test-MyModules.ps1 @@ -0,0 +1,18 @@ +if( -not $global:MyModulesWarning ) { + $global:MyModulesWarning = @() +} +[MyConfig]::GetConfigPaths('mymodules',$false) | + ForEach-Object { + $( Get-Content $_ | ConvertFrom-Json ).Modules + } | Where-Object { + $local:m = $_ + if( $( try { + -not (Get-Module -ListAvailable $m -ErrorAction stop) + } catch { $true } + )) { + $m -notin $global:MyModulesWarning + } + } | ForEach-Object { + $global:MyModulesWarning += $_ + Write-Warning "Missing module: $_" + } diff --git a/profile.d/test-modules.ps1 b/profile.d/test-modules.ps1 deleted file mode 100644 index d3adfc5..0000000 --- a/profile.d/test-modules.ps1 +++ /dev/null @@ -1 +0,0 @@ -$(Get-Content $MyPSScriptRoot/src/modules.json | ConvertFrom-Json).Modules | Where-Object { try{-not (Get-Module -ListAvailable $_aaa -ErrorAction stop) }catch{} } | ForEach-Object { Write-Warning "Missing module: $_" }