Getting the last shadow copy date of a file


when looking @ particular  file on server (2008), see entries under previous version tab. need script enumerate through entire directory (and subdirectories), , print out file name if modified date before last shadow copy date.  

first things first, how can last shadow copy date of particular file?  of course if know whole solution (enumeration, etc.) i'd appreciate well.


when looking @ particular  file on server (2008), see entries under previous version tab. need script enumerate through entire directory (and subdirectories), , print out file name if modified date before last shadow copy date.  

first things first, how can last shadow copy date of particular file?  of course if know whole solution (enumeration, etc.) i'd appreciate well.

this should give date of last shadow copy:

get-wmiobject win32_shadowcopy | sort-object installdate | select-object -last 1 -expandproperty installdate

store in datetime variable run list through filter:

$lastshadowcopydate = get-date (get-wmiobject win32_shadowcopy | sort-object installdate | select-object -last 1 -expandproperty installdate);
get-childitem -recurse | where-object { $_.lastwritetime -lt $lastshadowcopydate };

what trying @ this?




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...