How to access old user folder?

ShadowGamer3 5 Reputation points
2023-03-01T08:26:01.7766667+00:00

I recently had an issue which caused me to have to reinstall windows onto a different drive, and now that I've got that done, I'm trying to copy over my old files to the new drive. Problem: I can't access my old user folder.

Now, I'm no stranger to messing with settings and stuff, so I tried to grant my new user access to the folder, but then it tells me the whole folder and its contents are write-protected. And its not like the whole drive can't be accessed, literally every other file, even the old system files can be accessed. It's just my old user folder that I can't get into. I've even tried running Windows Explorer as Admin, and even that doesn't work. Why?

Another idea I had was to try and access the folders via an elevated Powershell prompt, and that actually worked. Through that, I've been able to use Copy-Item to get certain folders over, but its extremely tedious to use a command prompt to figure out what needs to come over, and actually copy them over. I'd really rather use a GUI like Windows Explorer to make it more streamlined, (which Explorer should effectively be doing the same thing as Powershell, right?)

So, my question is: if an elevated Powershell prompt can get into my old user folder, but Windows Explorer when run as admin can't, is there a way to remove the write protection and let me into the folder normally? Is there another tool that will help me more quickly go through the files and copy them over to my new drive? Or am I just gonna have to write my own tool for this? (Python for the win)

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,645 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,073 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Limitless Technology 43,946 Reputation points
    2023-03-01T16:38:59.64+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query

    You can follow these steps to access the old user folder:

    1. Choose "Properties" from the drop-down list.
    2. Click the "Security" tab in the Property box.
    3. Click the "Advanced" option to the right of the table.
    4. Choose the "Change" button next to the Owner.
    5. Click the "Advanced" option to open the "Choose User or Group" dialog.
    6. Click the "Find Now" button.
    7. . Click OK after selecting a user name.

    8 Choose OK.

    1. Uncheck the "Replace owner on subcontainers and objects" box. Then click the Apply button.
    2. If the Windows Security dialog appears, click OK.

    If you followed the procedures above, you should be able to access your folder now.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    7 people found this answer helpful.

  2. MotoX80 31,581 Reputation points
    2023-03-04T20:44:13.8766667+00:00

    Open Powershell with run as administrator and run this script. Set the TargetFolder variable to your folder name.

    $TargetFolder = "c:\users\testuser"                   # put your folder name in this variable 
    takeown.exe /d Y /a /r /SKIPSL  /f "$TargetFolder"
    # Avoid the recursive "application data" mess. 
    # First reset the folder, then the files in the folder (that may or may not inherit perms from the folder) 
    (Get-ChildItem "$TargetFolder" -Recurse -directory -force).fullname | foreach { 
        icacls.exe "$_\*" /reset 
    }
    # Give admins and users full control. 
    icacls.exe  "$TargetFolder"  /inheritance:r /grant "administrators:(OI)(CI)(F)" /grant "users:(OI)(CI)(F)" 
    
    

    That's when it told me the folder was write-protected.

    Was that the exact phrase in the error message? Or was it "access denied"? If the above script does not reset the permissions and allow you to access the files, please share a screen image of the error message.

    1 person found this answer helpful.