07 September 2018

Robocopy User Profile Contents to UNC Path

The Windows 10 upgrades required us to move profile contents off of the machines to a file share and then move them back. This was because USMT could not be used due to the architecture changing from 32-bit to 64-bit.

This script I wrote will copy all of the pertinent data from a user profile to a specified UNC path. I made two text files to include all exclusions for directories and files. The exclusion files need to reside in the same directory as this script. I have added the examples of the files and directories exclusion files that we excluded. The other variable you need to define is the DestinationUNC which is the path to the folder where the profile will be backed up to. The script also creates a 0RobocopyLogs directory at the specified UNC path containing a log of each transfer. One more thing I added to the script is the ability to check if the computer name is correct, which includes is online and if the username is correct. At the end of the process, it will return the robocopy error code.

You can download the script from my GitHub Repository.

Below is the contents of the DirectoryExclusions.txt file.

Application*
LocalService
*Games*
NetworkService
*Links*
*temp
*TEMPOR~1
*cache
Local*
cookies

Below is the contents of the FileExclusions.txt file.

ntuser.*
*.exd
*.nk2
*.srs
extend.dat
*cache*
*.oab
index.*
{*
*.ost
UsrClass.*
SharePoint*.pst
history*
*tmp*

Related Posts:

  • Import and Apply Local GPOs This script will import and apply a local GPO using the local GPO utility, ImportRegPol.exe, located here. The script is a wrapper that makes implementing this utility a snap. All that has to be done is to use the Micr… Read More
  • Cleaning up old systems in Active Directory, SCCM, and Antivirus Every place I have worked, there has been the issue of systems being in SCCM, AD, and antivirus that no longer existed. The is often caused by systems being overlooked when a user departs the company, a laptop that gets put… Read More
  • OS Detection Recently, we added the Windows 8.1 operating system to the company domain. I ran into the problem of deploying Adobe Flash Player to these systems because the ActiveX does not get installed. The issue came up in SCCM where … Read More
  • MSI Analysis Reporting Tool Here is a tool I have written that generates a report on all of the variables used for each entry during an MSI installation. I wrote this script to make customizing the installation of MSI files much easier and quicker. Th… Read More
  • Application List This script will generate a list of installed applications minus those in the exclusion list text file. I created this script so the help desk could have a concise list of applications that need to be installed post-build. … Read More

2 comments:

  1. "16 - Fatal error" every time I attempt to run this.

    ReplyDelete
    Replies
    1. The error is coming from robocopy, not the script. Have you tried to run robocopy manually?

      Delete