Script directory for a PowerShell profile. https://blog.lksz.me/keeping-track-of-everything/#-mypsscriptroot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
757 B

  1. param([switch]$Force)
  2. $local:currentSys = [SystemName]::_GetValidValues('',$true,$true);
  3. if( -not $global:MyModulesWarning -or $Force ) {
  4. $global:MyModulesWarning = @()
  5. }
  6. [MyConfig]::GetConfigPaths('mymodules',$false) |
  7. ForEach-Object {
  8. $local:modules = $( Get-Content $_ | ConvertFrom-Json );
  9. $modules.Always;
  10. $currentSys | ForEach-Object { $modules."$_" } | Where-Object { $_}
  11. } | Where-Object {
  12. $local:m = $_
  13. if( $( try {
  14. -not (Get-Module -ListAvailable $m -ErrorAction stop)
  15. } catch { $true }
  16. )) {
  17. $m -notin $global:MyModulesWarning
  18. }
  19. } | ForEach-Object {
  20. $global:MyModulesWarning += $_
  21. Write-Warning "Missing module: $_"
  22. }