Share This Post

Finding hidden files/folders using PowerShell

To display hidden files or folders, use the Force parameter with the get-childitem cmdlet.

Please see below recorded session in PowerShell:

PS C:\> Get-ChildItem

Directory: Microsoft.PowerShell.Core\FileSystem::C:\

Mode LastWriteTime Length Name
—- ————- —— —-
d—- 5/13/2005 11:29 PM DELL
d—- 5/9/2005 8:23 PM Documents and Settings
d—- 8/3/2006 10:45 PM i386
d—- 8/25/2007 6:06 PM My Downloads
d—- 8/25/2007 10:33 PM mytest
d—- 3/1/2007 1:55 PM Office 2007
d—- 7/22/2007 1:09 PM Opsware
d—- 8/27/2007 7:22 PM Program Files
d—- 9/5/2007 10:13 PM PS
d—- 8/28/2007 9:36 PM Temp
d—- 9/15/2007 8:09 PM WINDOWS
d—- 5/10/2005 12:39 AM winnt
-a— 5/9/2005 7:58 PM 0 AUTOEXEC.BAT
-a— 12/28/2005 10:12 PM 8717 caavsetup.log
-a— 12/14/2006 7:19 PM 35041 caavsetupLog.txt
-a— 8/28/2007 2:57 PM 68896 caisslog.txt
-a— 2/2/2007 8:36 PM 219 cmd.txt
-a— 1/4/2007 7:55 PM 0 COMLOG.txt
-a— 5/9/2005 7:58 PM 0 CONFIG.SYS
-a— 4/3/2007 10:10 PM 81 DVDPATH.TXT
-a— 7/22/2007 3:34 PM 1346 nonav.log

Now add -force switch
PS C:\> Get-ChildItem -force

Directory: Microsoft.PowerShell.Core\FileSystem::C:\

Mode LastWriteTime Length Name
—- ————- —— —-
d–h- 9/11/2007 8:57 PM Config.Msi
d—- 5/13/2005 11:29 PM DELL
d—- 5/9/2005 8:23 PM Documents and Settings
d—- 8/3/2006 10:45 PM i386
d-rh- 3/1/2007 2:37 PM MSOCache
d—- 8/25/2007 6:06 PM My Downloads
d—- 8/25/2007 10:33 PM mytest
d—- 3/1/2007 1:55 PM Office 2007
d—- 7/22/2007 1:09 PM Opsware
d—- 8/27/2007 7:22 PM Program Files
d—- 9/5/2007 10:13 PM PS
d–hs 5/10/2005 12:38 AM RECYCLER
d–hs 5/9/2005 8:16 PM System Volume Information
d—- 8/28/2007 9:36 PM Temp
d—- 9/15/2007 8:09 PM WINDOWS
d—- 5/10/2005 12:39 AM winnt
-a— 5/9/2005 7:58 PM 0 AUTOEXEC.BAT
-arhs 3/19/2007 4:58 PM 211 boot.ini
-a— 12/28/2005 10:12 PM 8717 caavsetup.log
-a— 12/14/2006 7:19 PM 35041 caavsetupLog.txt
-a— 8/28/2007 2:57 PM 68896 caisslog.txt
-a— 2/2/2007 8:36 PM 219 cmd.txt
-a— 1/4/2007 7:55 PM 0 COMLOG.txt
-a— 5/9/2005 7:58 PM 0 CONFIG.SYS
-a— 4/3/2007 10:10 PM 81 DVDPATH.TXT
-arhs 5/9/2005 7:58 PM 0 IO.SYS
-a-h- 3/16/2006 7:02 PM 437 IPH.PH
-arhs 5/9/2005 7:58 PM 0 MSDOS.SYS
-a— 7/22/2007 3:34 PM 1346 nonav.log
-arhs 8/12/2004 9:25 AM 47564 NTDETECT.COM
-arhs 8/12/2004 9:25 AM 250032 ntldr
-a-hs 9/15/2007 7:58 PM 804089856 pagefile.sys

What a difference –force make! The hidden folders RECYCLER, System Volume Information or files pagefile.sys, NTDETECT.com, etc. all show up…

Share This Post

Ying Li obtained a Master degree of Medicine in China and worked in the medical field before he came to the states in 1996. He made the career switch from troubleshooting people to troubleshooting computers after he came to the states. Not entirely a surprise there, if you know that his second preference for college is Mathematics. Ying is two times Admin Framework MVP awardee (2007-2008).His previous employment experience in the US includes UUNET, MCI WorldCom. MMC (Marsh & McLennan Companies), Merrill Lynch. He is currently employed by Related Companies as a Senior Infrastructure Engineer. He is proficient in virtually all Microsoft products (Office/Back office). His craving for efficiency naturally leads him to scripting, automation and before you know it, PowerShell! He is currently a MCSE (NT4, 2000, 2003) and MCITP Server Administrator. Ying enjoys wines and love to travel. His non work related passion is to advocate Health Living!

Leave a Reply