Skip to content

Remove-Item fails on FAT32 drive when encountering some Unicode characters #16804

@sba923

Description

@sba923

Prerequisites

Steps to reproduce

Consider the data in
RADWIMPS.zip
(note: this is copyrighted material I rip-ped from a CD I legally own; please don't redistribute).

When this is found on a FAT32 drive, you cannot delete the file tree using Remove-Item:

image

This repro's both in 7.2.1 and 7.3.0-preview.1.

CMD.EXE has no problem with the same data:

image

Expected behavior

`Remove-Item` should remove the entire directory tree.

Actual behavior

`Remove-Item` fails with `Remove-Item: No mapping for the Unicode character exists in the target multi-byte code page.`

Error details

Exception             :
    Type            : System.ComponentModel.Win32Exception
    NativeErrorCode : 1113
    ErrorCode       : -2147467259
    TargetSite      :
        Name          : IsReparsePointLikeSymlink
        DeclaringType : Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message         : No mapping for the Unicode character exists in the target multi-byte code page.
    Source          : System.Management.Automation
    HResult         : -2147467259
    StackTrace      :
   at
Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods.IsReparsePointLikeSymlink(FileSystemInfo
fileInfo)
   at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory,
Boolean recurse, Boolean force, Boolean rootOfRemoval)
   at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory,
Boolean recurse, Boolean force, Boolean rootOfRemoval)
   at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
   at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String
path, Boolean recurse, CmdletProviderContext context)
CategoryInfo          : NotSpecified: (:) [Remove-Item], Win32Exception
FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand
InvocationInfo        :
    MyCommand        : Remove-Item
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 78
    Line             : Remove-Item -Recurse -Force -LiteralPath J:\RADWIMPS -Verbose
    PositionMessage  : At line:1 char:1
                       + Remove-Item -Recurse -Force -LiteralPath J:\RADWIMPS -Verbose
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Remove-Item
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0-preview.1
PSEdition                      Core
GitCommitId                    7.3.0-preview.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions