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: $_" }