homepage
Open menu
Go one level top
  • Train and Certify
    Train and Certify

    Immediately apply the skills and techniques learned in SANS courses, ranges, and summits

    • Overview
    • Courses
      • Overview
      • Full Course List
      • By Focus Areas
        • Cloud Security
        • Cyber Defense
        • Cybersecurity and IT Essentials
        • DFIR
        • Industrial Control Systems
        • Offensive Operations
        • Management, Legal, and Audit
      • By Skill Levels
        • New to Cyber
        • Essentials
        • Advanced
        • Expert
      • Training Formats
        • OnDemand
        • In-Person
        • Live Online
      • Course Demos
    • Training Roadmaps
      • Skills Roadmap
      • Focus Area Job Roles
        • Cyber Defence Job Roles
        • Offensive Operations Job Roles
        • DFIR Job Roles
        • Cloud Job Roles
        • ICS Job Roles
        • Leadership Job Roles
      • NICE Framework
        • Security Provisionals
        • Operate and Maintain
        • Oversee and Govern
        • Protect and Defend
        • Analyze
        • Collect and Operate
        • Investigate
        • Industrial Control Systems
    • GIAC Certifications
    • Training Events & Summits
      • Events Overview
      • Event Locations
        • Asia
        • Australia & New Zealand
        • Latin America
        • Mainland Europe
        • Middle East & Africa
        • Scandinavia
        • United Kingdom & Ireland
        • United States & Canada
      • Summits
    • OnDemand
    • Get Started in Cyber
      • Overview
      • Degree and Certificate Programs
      • Scholarships
    • Cyber Ranges
  • Manage Your Team
    Manage Your Team

    Build a world-class cyber team with our workforce development programs

    • Overview
    • Why Work with SANS
    • Group Purchasing
    • Build Your Team
      • Team Development
      • Assessments
      • Private Training
      • Hire Cyber Professionals
      • By Industry
        • Health Care
        • Industrial Control Systems Security
        • Military
    • Leadership Training
  • Security Awareness
    Security Awareness

    Increase your staff’s cyber awareness, help them change their behaviors, and reduce your organizational risk

    • Overview
    • Products & Services
      • Security Awareness Training
        • EndUser Training
        • Phishing Platform
      • Specialized
        • Developer Training
        • ICS Engineer Training
        • NERC CIP Training
        • IT Administrator
      • Risk Assessments
        • Knowledge Assessment
        • Culture Assessment
        • Behavioral Risk Assessment
    • OUCH! Newsletter
    • Career Development
      • Overview
      • Training & Courses
      • Professional Credential
    • Blog
    • Partners
    • Reports & Case Studies
  • Resources
    Resources

    Enhance your skills with access to thousands of free resources, 150+ instructor-developed tools, and the latest cybersecurity news and analysis

    • Overview
    • Webcasts
    • Free Cybersecurity Events
      • Free Events Overview
      • Summits
      • Solutions Forums
      • Community Nights
    • Content
      • Newsletters
        • NewsBites
        • @RISK
        • OUCH! Newsletter
      • Blog
      • Podcasts
      • Summit Presentations
      • Posters & Cheat Sheets
    • Research
      • White Papers
      • Security Policies
    • Tools
    • Focus Areas
      • Cyber Defense
      • Cloud Security
      • Digital Forensics & Incident Response
      • Industrial Control Systems
      • Cyber Security Leadership
      • Offensive Operations
  • Get Involved
    Get Involved

    Help keep the cyber community one step ahead of threats. Join the SANS community or begin your journey of becoming a SANS Certified Instructor today.

    • Overview
    • Join the Community
    • Work Study
    • Teach for SANS
    • CISO Network
    • Partnerships
    • Sponsorship Opportunities
  • About
    About

    Learn more about how SANS empowers and educates current and future cybersecurity practitioners with knowledge and skills

    • SANS
      • Overview
      • Our Founder
      • Awards
    • Instructors
      • Our Instructors
      • Full Instructor List
    • Mission
      • Our Mission
      • Diversity
      • Scholarships
    • Contact
      • Contact Customer Service
      • Contact Sales
      • Press & Media Enquiries
    • Frequent Asked Questions
    • Customer Reviews
    • Press
    • Careers
  • Contact Sales
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  • Log In
  • Join
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Robocopy - a Computer Forensics tool?
J. Michael Butler

Robocopy - a Computer Forensics tool?

January 8, 2009

The usual practice for obtaining potential evidence would be to acquire a bit for bit forensic image of the drive and to lock the image up in an evidence safe. Depending upon the legal team's request, one may also replace the original hard drive and keep it in the safe instead of just an image. Another option I like is having a third party acquire the drive on our behalf and keep it in their secure area for us. Sometimes, however, for various reasons, a forensic image may not be feasible. So, then, what is another option?

In a recent e-mail exchange with Rob Lee, I asked him what he thought about using Robocopy as a tool for acquiring files for forensics purposes. What if I wanted to simply preserve files for a litigation hold? I was concerned that using copy tools may affect metadata if those tools change the "last accessed" date on the file(s) collected. (See http://csrc.nist.gov/publications/nistpubs/800-86/SP800-86.pdf section 4.2.3 for a discussion of metadata).

My question to Rob was, for litigation hold purposes, when the case is mainly about the content of the files and not the date and time they were last accessed, could we say that files acquired with Robocopy would be acceptable to opposing counsel? Of course, all my legal type friends would immediately respond, "It depends." I understand that. On the other hand, the files I needed were on a remote PC — (like several states away remote) — and the litigation was not even in the discovery phase.

The upshot of our e-mail exchange was that, sometimes you get the evidence any way you can! We need to show the court, in case of litigation, that we performed due diligence in a timely manner. Armed with that view, I set out to write a script to execute on the computer that would acquire all the files that might be relevant.

To find out the capabilities of Robocopy, refer to the Microsoft TechNet Robocopy page where the parameters are spelled out. In building such a script, you will want to use parameters to avoid copying files you know you don't need. For example, in a single Robocopy command, you can specify all the file extensions you wish to acquire. You may only be interested in .doc and .xls files. If so, only getting those files can simplify your life. In my case, we were looking for files that could have been created in the normal course of business, so — as you will see in my example — we were "grabbing" a fairly extensive list of file types.

Here is a script I wrote for quick acquisition of files for review purposes. The script expects the user to have a portable drive plugged in to which he/she can copy files. This script acquires all files modified since the date specified, and gets everything in all subdirectories that match the file extensions specified. I designed the script to require two parameters. The first parameter is the drive to be searched (letter only — no colon). The second parameter is the earliest date desired. If I enter 20080101, only files modified since 1/1/08 will be acquired. The file extensions are built into the script. So to execute this script, you might type:

NameOfScript c 20080101

Where "NameOfScript" = whatever you named your script, c=drive C:, and 20080101 represents the oldest files you wish to acquire, based on the last date the file was modified.

Also note that every time this script runs, it creates a directory with the same name as the computer name, and appends a dash and the letter of the drive acquired. That way, if you copy a C drive and a D drive, you will end up with two different subdirectories on your target drive.

echo off
cls
if "%1" == "" goto error
if "%2" == "" goto error
echo About to copy files from %1: to %computername%-%1 on portable drive.
echo.
echo.
echo If this is not what you want to do,
echo Use CTRL C to abort now, or else
pause
md %computername%-%1
cd
attrib -h -s %computername%-%1
ver | find "Microsoft" > %computername%-%1Version.txt
type %computername%-%1Version.txt
find "XP" %computername%-%1Version.txt
if "%errorlevel%" == "0" goto XPCommand
echo.
echo Error Level not equal to 0
echo VISTA System....
rem Call the Vista version of Robocopy for the XJ parm. Note no path to robocopy provided.
pause
robocopy %1: %computername%-%1 *.pst *.ost *.out *.xls* *.txt *.doc* *.zip *.csv *.mdb *.ldif *.rtf *.dbf *.prt *.pdf *.tif* /S /COPY:DAT /IA:RASHCNETO /MAXAGE:%2 /TS /FP /XJ /NC /NS /NP /W:0 /R:0 /TEE /LOG:%computername%-%1ROBOLOG.TXT
goto VistaCommand

:XPCommand
echo.
echo Error Level 0
echo XP System....
pause
Scriptsrobocopy %1: %computername%-%1 *.pst *.out *.xls* *.txt *.doc* *.zip *.csv *.mdb *.ldif *.rtf *.dbf *.prt *.pdf *.tif* /S /COPY:DAT /IA:RASHCNETO /MAXAGE:%2 /TS /FP /XJ /NC /NS /NP /W:0 /R:0 /TEE /LOG:%computername%-%1ROBOLOG.TXT

:VistaCommand
echo.
echo.
echo NOTE: This script will NOT automatically acquire files from
echo additional drives or partitions.
echo To acquire from additional drives/partitions, run this script again
echo with the added drive designation as the source.
echo.
echo.
scriptstail %computername%-%1ROBOLOG.TXT
echo.
echo.
echo (Message indicating failed copies: "Access is Denied")
echo Hit CTRL C to exit now, or else Opening log next...
pause
notepad %computername%-%1ROBOLOG.TXT
goto End
:error
echo.
echo.
echo.
echo ERROR - Invalid Syntax
echo.
echo Syntax: ScriptName source yyyymmdd
echo.
echo.
echo NOTE: Do NOT include a : in the source designation! Use only the drive letter.
echo.
echo.
echo For example, ScriptName c 20080101
echo will acquire selected files from the C: drive. Dated from 1/1/08
echo.
echo To acquire from additional drives/partitions, run ScriptName again with
echo the added drive designation as the source.
pause:End

One parameter you may play with is a date range. Robocopy will allow you to establish a minage (minimum age) and a maxage for each file by specifying a date in the format: yyyymmdd. There are a number of other parameters that I use in the above script, also intended to make sure I get what I want and don't get what I don't want. Here are the other parameters I typically use:

/s=get files in subdirectories
/copyall=copy all ntfs metadata (including acls, owner, and audit information)
/copy:DAT=data, attributes, timestamps (no acls, owner info, or audit info)
/eta=estimate % complete (remove to save log space - not helpful if creating a log file)
/IA=include files with these attributes
/maxage=only get files newer than yyyymmdd
/minage=don't get files newer than yyyymmdd
/fp=Displays full path in log whether files are copied or not
/nc=supress output of robocopy file classes
/xj=exclude junctions - for Vista version only to avoid looping through junctions
/ts=display time stamps from source in log
/ns=suppress output of file and directory sizes (saves log space)
/np=turn off % complete so it doesn't clog up log file
/W:0 wait on error for 0 seconds (default is 30 seconds on EVERY failure!)
/R:0 retry on error 0 times (default 1 million!!!)
/tee=echo to terminal in addition to sending to log file
/log:=log to this file name (the script places a file called robocopy.txt in the created directory for future reference)

One other important note on the age parameters: Make sure that the files you need will really fall between the dates you specify! For example, if you want e-mail files (like Outlook pst files) that have messages within your date range, you will not get them if the file has been modified in the last couple of days. Say you want all messages sent/received between 1/1/06 and 1/1/07. If you specify those dates and the pst file was modified yesterday, you will not get the older messages. Therefore, you may wish to add another command to copy the pst files regardless of date, just so you can get the older messages. There may be other files that fall into this category. If that is the case, you may wish to only specify a maximum age (maxage) without specifying a minimum age (minage). That way you will be sure to get everything you need.

There are many other parameters that may be applicable in your situation. Again, I point you to the TechNet Robocopy page for more information.

In short, if the files you need to acquire have not been deleted, Robocopy can be an effective and quick means of grabbing the files you need, especially if the main purpose is a quick review of a particular set of files meeting specific parameters.

J. Michael Butler, GCFA Gold #00056, is an Information Security Consultant employed by a fortune 500 application service provider who processes approximately half of the $5 trillion of residential mortgage debt in the US. He is a certified computer forensics specialist. In addition, he authored the enterprise wide security incident management plan and information security policies for his corporation. He can be reached at jmbutler_1 at hotmail dot com.

  1. https://blogs.sans.org/computer-forensics/2008/12/01/keeping-evidence-safe-for-litigation/
  2. http://www.sans.org/training/instructors.php#Lee
  3. http://en.wikipedia.org/wiki/Discovery_(law)
  4. http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
  5. http://www.law.com/jsp/legaltechnology/pubArticleLT.jsp?id=1184231195691
  6. http://csrc.nist.gov/publications/nistpubs/800-86/SP800-86.pdf
  7. http://technet.microsoft.com/en-us/library/cc733145.aspx
Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tags:
  • Digital Forensics and Incident Response

Related Content

Blog
Top_10_Summit_Talks_2022.png
Cybersecurity Insights, Digital Forensics and Incident Response, Cyber Defense, Cloud Security, Open-Source Intelligence (OSINT), Security Management, Legal, and Audit, Security Awareness
December 5, 2022
Top 10 SANS Summits Talks of 2022
This year, SANS hosted 13 Summits with 246 talks. Here were the top-rated talks of the year.
370x370-person-placeholder.png
Alison Kim
read more
Blog
FOR577.png
Digital Forensics and Incident Response
September 22, 2022
NEW SANS DFIR COURSE IN DEVELOPMENT | FOR577: LINUX Incident Response & Analysis
FOR577: Linux Incident Response & Analysis course teaches how Linux systems work and how to respond and investigate attacks effectively.
Viv_Ross_370x370.png
Viviana Ross
read more
Blog
Untitled_design-43.png
Digital Forensics and Incident Response, Cybersecurity and IT Essentials, Industrial Control Systems Security, Purple Team, Open-Source Intelligence (OSINT), Penetration Testing and Red Teaming, Cyber Defense, Cloud Security, Security Management, Legal, and Audit
December 8, 2021
Good News: SANS Virtual Summits Will Remain FREE for the Community in 2022
They’re virtual. They’re global. They’re free.
370x370-person-placeholder.png
Emily Blades
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters & Cheat Sheets
  • White Papers
  • Focus Areas
  • Cyber Defense
  • Cloud Security
  • Cybersecurity Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • © 2023 SANS™ Institute
  • Privacy Policy
  • Contact
  • Careers
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn