AskTechGurus Get help now →

PowerShell & Scripting Errors

Import-Module Microsoft.Graph fails: function capacity 4096 has been exceeded

Loading the Microsoft Graph PowerShell module on Windows PowerShell 5.1 errors out about function capacity, or takes forever and then breaks other modules in the same session.

What you’re seeing

  • Loading the Microsoft.Graph module stops with 'Function capacity 4096 has been exceeded for this scope'.
  • PowerShell takes many minutes to load the module, then throws errors.
  • Other modules, such as Exchange Online, stop working in the same session once Graph is loaded.
  • The problem happens in Windows PowerShell 5.1 but not in PowerShell 7.
  • Scripts that worked on one admin PC fail on another with a different module setup.

Common causes

Every environment is different, but these are the causes our engineers find most often:

  • The full Microsoft.Graph module contains thousands of commands, exceeding the default function limit in Windows PowerShell 5.1.
  • The script loads the entire Graph meta-module instead of only the sub-modules it needs.
  • Multiple versions of the Graph modules are installed side by side, adding even more functions.
  • Profile scripts automatically load several large modules at startup.
  • Windows PowerShell 5.1 handles large modules less efficiently than PowerShell 7.

Why it matters

When admin tools fail to even load, user management, license changes and reporting all grind to a halt. IT staff lose time fighting the shell instead of doing the work, and scheduled tasks that rely on Graph fail overnight without warning. Workarounds like reinstalling everything can break other tools. For small businesses with one admin PC or a single automation server, this can stall all Microsoft 365 administration.

How AskTechGurus fixes it

Skip the trial and error. A certified engineer works on your actual system, finds the root cause, and fixes it properly.

Tell us what’s happening

Submit a ticket in about two minutes. Paste the error, describe what changed, and pick your tier. No charge to submit.

A certified engineer diagnoses it

A vetted, US-based systems engineer claims your ticket, usually within minutes during business hours, and investigates over a secure remote session you can watch and end at any time.

Fixed and verified with you

The engineer resolves the root cause and confirms with you that it’s working. You don’t just get a workaround, and you get a plain-English summary of what was wrong.

Pay only when it’s resolved

Fixed price from $99, invoiced only after you approve the fix. If it isn’t resolved, you don’t pay.

Frequently asked questions

Why does this only happen in Windows PowerShell 5.1?

Windows PowerShell 5.1 has a default limit of 4,096 functions per scope, which the full Graph module can exceed. PowerShell 7 handles this differently.

Do we have to move to PowerShell 7?

It's often the cleanest long-term answer, but scripts may need testing first. There are also ways to load only the parts of Graph a script really needs.

Can AskTechGurus fix this remotely?

Yes. A certified US engineer reviews the module setup and scripts in a secure remote session, often in a single session. It starts at $99, and you pay only once it's resolved.

Still stuck? Let a pro take it from here.

AskTechGurus connects you with vetted, US-based systems engineers who fix this every day. No call centers, no scripts, no surprise bills.

Start now →