Ying Li at myITforum.com

PowerShell & System Center

Finding fidden 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…

Posted: Sep 18 2007, 09:12 PM by yli628 | with no comments
Filed under:

Comments

No Comments