Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Uinstall-PSResource on OneDrive Error: Access to the path is denied #1793

Open
@BohrenAn

Description

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

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\ExchangeOnlineManagement3円.7.0' could not be deleted: Access to the path '\?\C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.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\ExchangeOnlineManagement3円.7.0
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\en-US
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\ref
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes\win-arm64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes\win-x64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes\win-x86
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes\win-arm64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes\win-x64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netCore\runtimes\win-x86\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\ref
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes\win-arm64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes\win-x64
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes\win-x86
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes\win-arm64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes\win-x64\native
Microsoft.PowerShell.Core\FileSystem::C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\netFramework\runtimes\win-x86\native

Expected behavior

Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck
Will uninstall the Module and delete the Folders of the Module

Actual behavior

Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck
throws Acces to the path is denied and Folders are not deleted

Error details

get-error
Exception :
 Type : System.ArgumentException
 Message : Parent directory 'C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0' could not be deleted: Access to the path
'\\?\C:\Users\a.bohren\OneDrive - Icewolf\Dokumente\PowerShell\Modules\ExchangeOnlineManagement3円.7.0\en-US' is denied.
 HResult : -2147024809
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.UninstallPSResource
CategoryInfo : PermissionDenied: (Microsoft.PowerShel...UninstallPSResource:UninstallPSResource) [Uninstall-PSResource], ArgumentException
FullyQualifiedErrorId : ErrorDeletingDirectory,Microsoft.PowerShell.PSResourceGet.Cmdlets.UninstallPSResource
InvocationInfo :
 MyCommand : Uninstall-PSResource
 ScriptLineNumber : 1
 OffsetInLine : 1
 HistoryId : 9
 Line : Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck
 Statement : Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck
 PositionMessage : At line:1 char:1
 + Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUse ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 InvocationName : Uninstall-PSResource
 CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
 0
 1

Environment data

Get-Module Microsoft.PowerShell.PSResourceGet; $PSVersionTable
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.1.0 Microsoft.PowerShell.PSResourceGet {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository...}
Key : PSVersion
Value : 7.5.0
Name : PSVersion
Key : PSEdition
Value : Core
Name : PSEdition
Key : GitCommitId
Value : 7.5.0
Name : GitCommitId
Key : OS
Value : Microsoft Windows 10.0.26100
Name : OS
Key : Platform
Value : Win32NT
Name : Platform
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name : PSCompatibleVersions
Key : PSRemotingProtocolVersion
Value : 2.3
Name : PSRemotingProtocolVersion
Key : SerializationVersion
Value : 1.1.0.1
Name : SerializationVersion
Key : WSManStackVersion
Value : 3.0
Name : WSManStackVersion

Visuals

Uninstall-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck
Image

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

Tried to figure out with Sysinternals ProcessMonitor
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /