Data Domain Retention Lock: Compliance Scripting

Today I had the opportunity to develop a quick and dirty PowerShell script for the EMC DataDomain Retention Lock: Compliance feature.  When using Retention lock, you have to update the last accessed date/time in order for it to trigger the retention feature on the DataDomain for any files that you want to have retained.  In my case, we are using a CIFS share and copying a bunch of files out to the share daily to be stored for a period of time — effectively using the DataDomain as a Write Once Read Many (WORM) device.  To update all the files at one time, we developed a quick script that will, once a day, scan the directory and update the access date/time.  That script is included here for reference:

#Set the directory root for the script to run.
$dirlook=”P:\”
#This is setting the script to only check files with a modified date within the last 1 day.
$backdate=$(Get-Date).AddDays(-1)
#This is the number of days to set the access date to.  Currently 7 Years.
$forwarddate=$(Get-Date).AddDays(+2555).ToString(‘MMddHHmmyyyy’)
#Find the files which are modified and modify the last access date.
Get-Childitem $dirlook -Recurse | `
where-object {!($_.psiscontainer)} | `
where { $_.LastWriteTime -gt $backdate } | `
foreach {C:\touch.exe -a -t $forwarddate $_.fullname}

Now, in order to use this, you will need to update the values a bit to mimic your requirements and you will need to get the “touch” program available here: http://sourceforge.net/projects/unxutils/?source=typ_redirect

Hope it helps you.