PackageManagement Is Currently in Use? The Proven Install-Module Fix

By Ahmet Tolga KAYA 8 min read
PackageManagement Is Currently in Use? The Proven Install-Module Fix

PackageManagement is currently in use, says PowerShell, and the module you actually wanted (ExchangeOnlineManagement, Microsoft.Graph, Az, PnP) refuses to install or update. The full line is WARNING: The version ‘1.4.8.1’ of module ‘PackageManagement’ is currently in use. Retry the operation after closing the applications. It is a common sight on admin workstations that collect a lot of modules, and the frustrating part is that rebooting does not always clear it. The good news: it is a file-lock problem, not a broken PowerShell install. Below is the order I work through, from the two-second check to the permanent fix, with every cmdlet checked against Microsoft Learn.

What “PackageManagement Is Currently in Use” Actually Means

PowerShellGet v2 (the module that gives you Install-Module and Update-Module) is built on top of the PackageManagement module, also known as OneGet. The current PowerShell Gallery release of PackageManagement is 1.4.8.1, the version shown in Microsoft’s guide to updating PowerShellGet on Windows PowerShell 5.1. PackageManagement ships a compiled .NET assembly, and once a PowerShell process loads that DLL, Windows keeps the file locked until the process exits.

So when Install-Module needs to write or overwrite files in a PackageManagement folder that some running process has loaded, it gives up and prints the warning instead. The message is honest: something has the files open. The hard part is finding out what.

PackageManagement is currently in use warning for PackageManagement 1.4.8.1 after Install-Module in Windows PowerShell (illustration)

When PackageManagement is currently in use on one of my machines, the culprit is almost always one of these:

  • The current session itself. Install-Module imports PowerShellGet, which loads PackageManagement (PackageManagement 1.4.8.1 on an updated system) the moment you run it, so overwriting that same version from the same window cannot succeed.
  • Another PowerShell host: a second console, PowerShell ISE, a scheduled script, or the PowerShell Extension terminal inside VS Code.
  • A profile script that imports modules at startup, so even a “fresh” window is not clean.
  • OneDrive Known Folder Move. If Documents is redirected to OneDrive, the per-user module folder lives there too, and the sync client can hold files while it uploads them. A comment on the Microsoft Q&A thread about this warning reports that simply quitting OneDrive during the update fixed it.
  • -Force on an existing version. Per the Install-Module documentation, if a module with the same name and version already exists, -Force overwrites it. Overwriting a loaded version is exactly what triggers the lock.

Step 1: Check Whether Install-Module Actually Failed

The first time I saw PackageManagement is currently in use, I assumed the whole install had failed. It usually had not.

This is a warning, not a terminating error, and I have lost time before chasing a problem that did not exist. Often the module you asked for was installed fine and only the dependency refresh was skipped. Check before you change anything:

Get-InstalledModule -Name ExchangeOnlineManagement | Select-Object Name, Version, InstalledLocation
Get-Module -Name PackageManagement, PowerShellGet -ListAvailable |
    Select-Object Name, Version, ModuleBaseCode language: JavaScript (javascript)

If the target module shows the version you wanted, you are done; the PackageManagement is currently in use warning was about a dependency that was already present. If the old version is still there, carry on.

Step 2: Close Every Process That Has PackageManagement Loaded

If PackageManagement is currently in use for real, the reliable fix is a brand-new process. Remove-Module PackageManagement removes the module from the session, but on Windows PowerShell 5.1 (.NET Framework) a loaded assembly cannot be unloaded from the process, so the DLL stays locked. I stopped relying on the Get-Module | Remove-Module trick for that reason.

First, see which PowerShell processes are running. Run this from an elevated window so it can read the module list of other processes too:

Get-Process -Name powershell, pwsh, powershell_ise -ErrorAction SilentlyContinue |
    Where-Object {
        try { $_.Modules.FileName -match 'PackageManagement' } catch { $false }
    } |
    Select-Object Id, ProcessName, StartTime, PathCode language: JavaScript (javascript)

Every process listed is a reason PackageManagement is currently in use. Close those windows (and VS Code, which restarts its PowerShell terminal on its own), or stop them if they are orphaned. Then open one clean Windows PowerShell session as administrator, without a profile:

powershell.exe -NoProfile -NoLogoCode language: CSS (css)

In that new window, enable TLS 1.2 exactly as Microsoft documents it, and run the install once, with an explicit scope and without -Force unless you really need to overwrite the same version:

[Net.ServicePointManager]::SecurityProtocol =
    [Net.ServicePointManager]::SecurityProtocol -bor
    [Net.SecurityProtocolType]::Tls12

Install-Module -Name ExchangeOnlineManagement -Scope AllUsers -Repository PSGalleryCode language: PHP (php)

For an update, Update-Module -Name ExchangeOnlineManagement installs the newer version side by side, which avoids touching the loaded files at all. If TLS or NuGet provider errors appear instead, that is a different problem; my Install-Module not working guide covers the NuGet and TLS 1.2 fixes.

Step 3: Fix OneDrive and Duplicate Module Paths

If PackageManagement is currently in use even in a clean session with nothing else running, look at where your modules live. According to about_PSModulePath, Windows PowerShell 5.1 uses $HOME\Documents\WindowsPowerShell\Modules for the current user and $env:ProgramFiles\WindowsPowerShell\Modules for all users. When Documents is redirected, the first path ends up inside OneDrive. Check it:

[Environment]::GetFolderPath('MyDocuments')
$env:PSModulePath -split ';'
Get-Module -Name PackageManagement -ListAvailable | Select-Object Version, ModuleBaseCode language: PHP (php)

If the Documents path points into a OneDrive folder and you see PackageManagement or PowerShellGet copies there, this is what I do:

  • Pause syncing or quit OneDrive from the system tray while you install or update modules.
  • Install admin modules with -Scope AllUsers from an elevated session, so they land in Program Files, outside OneDrive. The Install-Module documentation lists both scope paths, and I always pass the scope explicitly instead of relying on the default, which differs between PowerShellGet versions and elevated sessions.
  • If an old per-user PackageManagement copy is shadowing the one in Program Files, close every PowerShell window first and then rename the per-user folder rather than deleting it, so you can roll back.
$userModules = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'WindowsPowerShell\Modules'
Rename-Item -Path (Join-Path $userModules 'PackageManagement') -NewName 'PackageManagement.old'Code language: PHP (php)

Only rename the per-user copy when a working PackageManagement is also present under Program Files (Windows ships version 1.0.0.1 there). Never delete files under C:\Program Files\WindowsPowerShell\Modules while a session has them loaded.

PackageManagement is currently in use fix flowchart: check the install, unlock the session, clean up scope and OneDrive, switch to PSResourceGet

Step 4: Avoid the Warning for Good with PSResourceGet

The long-term fix is to stop depending on PackageManagement for installs. Microsoft’s guidance is clear: Microsoft.PowerShell.PSResourceGet is the new package manager for PowerShell, ships in PowerShell 7.4 and later, and with it “you no longer need to use PowerShellGet and PackageManagement”. On Windows PowerShell 5.1 you install it once, from a clean session:

Install-Module -Name Microsoft.PowerShell.PSResourceGet -Repository PSGallery -Scope AllUsersCode language: CSS (css)

Then open a new window and use the PSResourceGet cmdlets from then on. See the Install-PSResource reference for every parameter:

Install-PSResource -Name ExchangeOnlineManagement -Scope AllUsers -TrustRepository
Update-PSResource -Name ExchangeOnlineManagement
Get-InstalledPSResource -Name ExchangeOnlineManagement

This is the route I recommend for admin workstations: PSResourceGet does not depend on PackageManagement, so a locked PackageManagement DLL no longer matters and the PackageManagement is currently in use warning has nothing to trip over. The same approach works for Microsoft Graph; my Microsoft Graph PowerShell guide shows the connection side once the module is in place.

How to Verify the Fix

To prove that PackageManagement is currently in use no longer blocks you, open a new session, run the install or update again and confirm three things: no warning, the expected module version, and no stray copies in a OneDrive path.

Get-InstalledModule -Name ExchangeOnlineManagement | Select-Object Name, Version
Get-Module -Name PackageManagement -ListAvailable | Select-Object Version, ModuleBase
Import-Module ExchangeOnlineManagement
Get-Command -Name Connect-ExchangeOnlineCode language: JavaScript (javascript)
PackageManagement is currently in use fixed: Install-Module runs without the warning and Get-InstalledModule shows the module (illustration)

If Connect-ExchangeOnline resolves and the module bases point to Program Files (or a local, non-synced Documents path), the PackageManagement is currently in use problem is gone.

Preventing PackageManagement Is Currently in Use Warnings

  • Update modules from one dedicated, elevated -NoProfile session, never from the VS Code terminal you are also using for work.
  • Keep profile scripts light; do not import PowerShellGet or PackageManagement in $PROFILE.
  • Use Update-Module or Update-PSResource for updates instead of Install-Module -Force.
  • Install shared admin modules with -Scope AllUsers, away from OneDrive-redirected folders.
  • Clean up old versions now and then with Uninstall-Module -Name <name> -RequiredVersion <old version>, from a session where that version is not loaded.

One lesson this error taught me: when PowerShell says a file is in use, believe it. If you are working through module updates in this PowerShell November 2026 cycle, start by looking for a process holding the DLL before you suspect corruption. Read more about a related PowerShell surprise in my AD drive does not exist fix.

FAQ

Is “PackageManagement is currently in use” an error or a warning?

It is a warning from PowerShellGet. The command does not terminate, but the file it wanted to replace was skipped. Check with Get-InstalledModule whether the module you asked for was installed anyway.

Why does a reboot not always fix it?

A reboot releases the lock, but a profile script, the VS Code PowerShell terminal or a OneDrive-synced module folder can load or hold PackageManagement again before you run Install-Module. Start powershell.exe -NoProfile right after closing those.

Does Remove-Module PackageManagement release the lock?

Not reliably. Remove-Module removes the module from the session, but in Windows PowerShell 5.1 a loaded .NET assembly stays in the process until it exits. Open a new process instead.

Should I use -Force with Install-Module?

Only when you really need to overwrite the same version. Per Microsoft Learn, -Force overwrites an existing module with the same name and version, which is exactly what fails when that version is loaded. Use Update-Module for updates.

What is the permanent fix for PackageManagement 1.4.8.1 lock warnings?

Install Microsoft.PowerShell.PSResourceGet and use Install-PSResource and Update-PSResource. Microsoft states that with PSResourceGet you no longer need PowerShellGet and PackageManagement, so the lock no longer matters.

References

Microsoft Learn: Install a package manager for PowerShell (update PowerShellGet on 5.1)

Microsoft Learn: Install-Module (PowerShellGet 2.x)

Microsoft Learn: about_PSModulePath

Microsoft Learn: Install-PSResource

Microsoft Q&A: WARNING: The version ‘1.4.8.1’ of module ‘PackageManagement’ is currently in use

Ahmet Tolga KAYA

Systems Engineer and Technical Writer focused on Windows, Microsoft technologies, infrastructure, cybersecurity, automation, and platform reliability.