PowerShell

Script to reset “Hidden files and folders” to normal using PowerShell

 

Hi,

yesterday one of my users laptop get infected with virus. After removal of virus i saw that “Virus” hide every file and folder in the laptop.  It was quite a pain to “Choose file and folder” right click on it, choose properties and un-tick the hidden option.

Then i decide to write a script which can do this for me.

download it from here: http://gallery.technet.microsoft.com/scriptcenter/Reset-Hidden-files-and-27d70766

so here is the script:

## Change “D:\P-temp” with your folder path

$Filepath = Get-ChildItemRecursepath “D:\P-Temp\” –Force 

$HSfiles = $Filepath | where { $_.Attributes -match “Hidden”}

$HSfiles

foreach ( $Objectin$HSfiles ) {

       $Object.Attributes = “Archive”

       }

### End of script #####

This script search for “Hidden file and folder” in the path you defined in $Filepath and the it sets the “Archive” attribute on every file and folder it found.

Screen Shots:

You can see that the i highlighted the “hidden” files and folder below.

25-01-2012 17-05-46

we run the Script  and it done something 😉

25-01-2012 18-15-42

You can see that , all hidden folder are back to normal. 🙂

25-01-2012 17-06-33

 

download it from here: http://gallery.technet.microsoft.com/scriptcenter/Reset-Hidden-files-and-27d70766

Thanks for viewing .

Aman Dhally

messenger_freak_adp1 (8)

2 thoughts on “Script to reset “Hidden files and folders” to normal using PowerShell

  1. $Filepath = Get-ChildItem -Recurse -path “C:\Rahman Data\” -Force

    $Filepath | foreach {$_.attributes -match “Hidden”} { $_.attributes=”Archive”}

  2. Hello, how to get-content of txt.file and this file contains UNC path and these paths having thousands of sub folders and files .DVS ?

    Then apply to reset archive bit on the sub folders and files *.*

Comments are closed.