Slow importing modules

Welcome Forums General PowerShell Q&A Slow importing modules

Viewing 2 reply threads
  • Author
    • #247212
      Topics: 1
      Replies: 1
      Points: 54
      Rank: Member

      I know already this is a case of “works on my machine”, or in this case…doesn’t.

      But in Cloud Shell or a different machine if i use

      #requires az

      or import module

      In a script then all 64 az modules get loaded in 10 seconds.
      On a corporate laptop it takes 15+ minutes!  I’ve tried to dig in to why this is without much luck


      I’ve tried putting an exclusion in windows defender but still the same.

      Any tips on getting more details on what’s slowing things down would be most appreciated, it’s making using
      #Requires -Module




    • #247306
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,782
      Helping Hand
      Rank: Community Hero

      What is the PowerShell version you use in local machine ?

      Just a guess, In cloudshell, az modules might have already loaded, so reimporting wont make time, check if Import-Module with -Force is also quick in couldshell.

    • #247483
      Topics: 1
      Replies: 1
      Points: 54
      Rank: Member

      I’m running 7.02 currently (I know 7.0.3 is out) but it’s been happening since 6.x


      I tried unloading (remove-module) the modules in cloud shell and it still imported them in <10 seconds.

      On my home pc they don’t load on start up and it can import them in <10 seconds there too.


      On my work laptop I can’t see anything in task manager consuming high cpu/disk etc. when it’s taking >20 minutes to import them.

      I could start digging in procmon or similar but was hoping to avoid that low level

Viewing 2 reply threads
  • You must be logged in to reply to this topic.