-
Notifications
You must be signed in to change notification settings - Fork 98
Uinstall-PSResource on OneDrive Error: Access to the path is denied #1793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've just encountered the exact same issue in both PowerShell 7.4.6 and Windows PowerShell 5.1, using Microsoft.PowerShell.PSResourceGet 1.1.0. With PowerShell it specifically complains about access being denied to subdirectories of the module being uninstalled, but I've found that if you manually delete any subdirectories before running the uninstall command, (just leaving behind the files in the module's root), then the command actually seems to succeed. However, with Windows PowerShell it more generically complains about the module's root directory not being empty, and even if you manually delete the subdirectories before running the uninstall command, it still fails. I've also tried running the command as Administrator and that makes no difference. |
I would say, that this did allready happen with Microsoft.PowerShell.PSResourceGet 1.0.6 and i hoped it would be fixed with Microsoft.PowerShell.PSResourceGet 1.1.0. |
The same still happens with Microsoft.PowerShell.PSResourceGet 1.1.1 |
I have the same issue as well (with Microsoft.PowerShell.PSResourceGet 1.1.1) the same thing happened with PowerShellGet and there was fixed in v 3.0.0-beta-19 |
Also unable to catch this exception - so can't really handle it nicely 😢 |
Any updates here @SydneyhSmith ? |
We are looking into debugging it-- will put in our upcoming quality sprint |
Great to hear that. Thank you @SydneyhSmith |
In case it helps:
|
Prerequisites
Steps to reproduce
Hi All,
I am using Windows 11 (2024H2 26100.3194). My Document Folder is Redirected to Onedrive.
I am using Onedrive Build 25.015.0126.0002 (64-bit)
I am using PowerShell 7.5.0 and Microsoft.PowerShell.PSResourceGet 1.1.0
I regularly have Errors when uninstalling PowerShell Modules
Install the Module works fine
Install-PSResource -Name ExchangeOnlineManagement -Version 3.7.0 -Scope CurrentUser
Uninstalling the Module throws: Acces to the path is denied
Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck
Uninstall-PSResource: Parent directory 'C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0' could not be deleted: Access to the path '\?\C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\en-US' is denied
Result:
All the Files are deleted, but the Folder Structure is still there
Get-ChildItem -Path "C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement" -Recurse | ft PSPath
PSPath
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\en-US
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\ref
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes\win-arm64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes\win-x64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes\win-x86
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes\win-arm64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes\win-x64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netCore\runtimes\win-x86\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\ref
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes\win-arm64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes\win-x64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes\win-x86
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes\win-arm64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes\win-x64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement\3.7.0\netFramework\runtimes\win-x86\native
Expected behavior
Actual behavior
Error details
Environment data
Visuals
Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck

Get-ChildItem -Path "C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement" -Recurse | ft PSPath

Tried to figure out with Sysinternals ProcessMonitor

The text was updated successfully, but these errors were encountered: