Can't delete file - Can't access folder


  1. Posts : 21
    Windows 7 Pro 64bit
       #1

    Can't delete file - Can't access folder


    Running Windows 7 Pro with Microsoft Security Essentials as my antivirus...

    In my D:\TEMP folder there is a folder named CR_98F43.tmp. If I try to go into that folder I am denied permission. I'm told that I need to use the security tab to gain access. If I go to the folder properties, into the security tab, everything is greyed out... I can't alter anything.

    I'm able to access the content of the folder in an Administrator command prompt. Inside this directory is a file named "SETUP_PATCH.PACKED.7Z". I cannot delete this file from the command line. I've even tried a utility named "BootDelete" to try and delete the directory without success.

    What can I do to remove this file and folder?
      My Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    Hi Calab,

    You can tell us the permission settings of the outer most item you are denied access from.

    Open a PowerShell session, run the below line and post it's output here for us.
    Code:
    "D:\TEMP" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
      My Computer


  3. Posts : 21
    Windows 7 Pro 64bit
    Thread Starter
       #3

    Pyprohly said:
    Hi Calab,

    You can tell us the permission settings of the outer most item you are denied access from.

    Open a PowerShell session, run the below line and post it's output here for us.
    Code:
    "D:\TEMP" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
    Opened Powershell:
    Code:
    PS D:\> "D:\TEMP" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; 
    $a.AccessToString
     
    Steve
    StevesPC\Steve
     
    Everyone Allow  -1
    PS D:\>
    PS D:\> "D:\TEMP\CR_98F43.tmp" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
    Get-Acl : Attempted to perform an unauthorized operation.
    At line:1 char:40
    + "D:\TEMP\CR_98F43.tmp" | %{$a = Get-Acl <<<<  $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
        + CategoryInfo          : NotSpecified: (:) [Get-Acl], UnauthorizedAccessException
        + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetAclCommand
     
    Steve
    StevesPC\Steve
    Everyone Allow  -1
    PS D:\>
    Opened Powershell as administrator:
    Code:
    PS D:\> "D:\TEMP\CR_98F43.tmp" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
    Steve
    NT AUTHORITY\SYSTEM
    NT AUTHORITY\SYSTEM Allow  FullControl
    BUILTIN\Administrators Allow  ReadAndExecute, Synchronize
    PS D:\>
    PS D:\temp\CR_98F43.tmp> "D:\TEMP\CR_98F43.tmp\SETUP_PATCH.PACKED.7Z" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner
    ; ''; $a.AccessToString
    Steve
    NT AUTHORITY\SYSTEM
    NT AUTHORITY\SYSTEM Allow  FullControl
    BUILTIN\Administrators Allow  ReadAndExecute, Synchronize
    PS D:\temp\CR_98F43.tmp>
    When I attempt to delete the file, in Powershell as administrator:
    Code:
    PS D:\temp\CR_98F43.tmp> del .\SETUP_PATCH.PACKED.7Z
    Remove-Item : Cannot remove item D:\temp\CR_98F43.tmp\SETUP_PATCH.PACKED.7Z: Access to the path 'D:\temp\CR_98F43.tmp\S
    ETUP_PATCH.PACKED.7Z' is denied.
    At line:1 char:4
    + del <<<<  .\SETUP_PATCH.PACKED.7Z
        + CategoryInfo          : PermissionDenied: (D:\temp\CR_98F4...PATCH.PACKED.7Z:FileInfo) [Remove-Item], Unauthoriz
       edAccessException
        + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
      My Computer


  4. Posts : 21
    Windows 7 Pro 64bit
    Thread Starter
       #4

    One item I should mention is that my %TEMP% and %TMP% variables point to E:\Temp. Nothing should be using D:\Temp. I moved my temp directory to a dedicated drive last week, as I had a small spare SSD laying around.
      My Computer


  5. Posts : 1,025
    Linux Lite 3.2 x64; Windows 7, 8.1
       #5

    Would it be cheating to pop in a linux boot stick and give it a try? DSL is a mere 50MB download.
      My Computer


  6. Posts : 1,025
    Linux Lite 3.2 x64; Windows 7, 8.1
       #6

    Actually I wouldn't recommend DSL. It requires too much work to set up. Puppy or LinuxLite would be a better choice.
      My Computer


  7. Posts : 21
    Windows 7 Pro 64bit
    Thread Starter
       #7

    Finally got it fixed...

    1- Boot into safe mode (not sure if it was necessary)
    2- Open PowerShell as administrator
    3- Used TAKEOWN to take ownership of the 7z file
    4- Went to the properties of the file in Windows Explorer
    5- I was able to give myself full control of the file
    6- Deleted the file.

    Tada!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:39.
Find Us