Accidently deleted attributes of all files inside my user directory


  1. Posts : 2
    Windows 11
       #1

    Accidently deleted attributes of all files inside my user directory


    My Big Mistake

    It all began when I wanted to use PowerShell to set the attribute of some personal folders matching a specific regex to "Hidden". (For my defense of what follows: I was way overslept! I didn't even use the regex to begin with...)

    I quickly found the following suggestion on a forum here, which I blindly executed ('.' here is my user directory)

    Code:
    Get-ChildItem -path "." -Recurse -Force | ForEach-Object { $_.Attributes += "Hidden" }
    I noticed afterwards that this was just a troll, and all my files where hidden...

    Well, I then tried to quickly fix it via

    Code:
    Get-ChildItem -path "." -Recurse -Force | ForEach-Object { $_.Attributes = ""  }
    I instantly realized that this was probably a stuuuupid idea... And well... Turns out it was.

    My Current Fix

    After some back and forth I decided that I could just create a new dummy user on my Windows machine and copy over the file attributes from there. For the following, my user directory is "seawe", the dummy user folder is "test".

    Code:
    cd "C:\Users\test\" 
    $x = Get-ChildItem -path "." -Recurse -Force | Resolve-Path -Relative 
    foreach ($y in $x){ 
    	if (Test-Path -Path "C:\Users\seawe\$y") { 
    		$s = Get-Item -Force -Path $y;  
    		$d = Get-Item -Force -Path "C:\Users\seawe\$y";  
    		$d.Attributes = $s.Attributes 
    	} 
    }
    Seems like the most important folders and files have their file attributes restored. Yehaaa...

    My Question

    Is this enough? All of my user specific AppData folders and files now are still without attributes. I also saw that Windows stores e.g. some certificates (probably SSL?) inside the AppData folder, which are still without attributes. Does this pose a security threat?

    Windows version: Windows 11 OSBuild 22000.434
      My Computer


  2. Posts : 869
    Windows 10 Professional x64 21H2
       #2

    Seeing that you on Windows 11 you should head over to the Windows 11 Help Forum and recreate your post there. You'll need to create an acount account.
      My Computers


  3. Posts : 2
    Windows 11
    Thread Starter
       #3
      My Computer


  4. Posts : 23,197
    Win 10 Home ♦♦♦19045.4291 (x64) [22H2]
       #4

    drdonut1 said:


    The folks I mentioned in post #3 (bottom), in your topic in ElevenForums, will SEE those mentions, when they come online.
      My Computer


 

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

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




Windows 10 Forums