Have you tried this?
install-module "msonline" -Scope CurrentUser
Cannot install any power modules
When I try to install any powershell modules i get the same error, that a file is being used by another process. This relates to the temp folders and files that are created when downloading the modules. it is almost as if the same download is holding open the file so the install process can not install it. this is happening on all modules I try to install.
PowerShell 7.1.3
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
PS C:\Windows\System32> install-module msonline
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
Install-Package: C:\Users########\Documents\PowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711
Line |
9711 | … talledPackages = PackageManagement\Install-Package @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Package 'MSOnline' failed to be installed because: The process cannot access the file
| 'C:\Users########\AppData\Local\Temp\ffmrzguy\Microsoft.Data.OData.dll' because it is being used by
| another process.
PS C:\Windows\System32>
2 answers
Sort by: Most helpful
-
Aydin, Serkar 6 Reputation points
2021-07-10T05:15:26.767+00:00 -
Rich Matheisen 46,551 Reputation points
2021-07-10T14:47:31.423+00:00 Use "Process Explorer" to find the process holding the file handle.