Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Build status


The xRobocopy module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC Resources. This module is used to facilitate large file copies with complex requirements such as multithreading, restarts, and exclusions when recursing content., with simple declarative language.

All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service. The "x" in xRobocopy stands for experimental, which means that these resources will be fix forward and monitored by the module owner(s).

Please leave comments, feature requests, and bug reports in the Q & A tab for this module.

If you would like to modify the xRobocopy module, feel free. When modifying, please update the module name, resource friendly name, and MOF class name (instructions below). As specified in the license, you may copy or modify this resource as long as they are used on the Windows Platform.

For more information about Windows PowerShell Desired State Configuration, check out the blog posts on the PowerShell Blog (this is a good starting point). There are also great community resources, such as, or PowerShell Magazine. For more information on the DSC Resource Kit, checkout this blog post.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.


To install xRobocopy module

  • If you are using WMF4 / PowerShell Version 4: Unzip the content under the C:\Program Files\WindowsPowerShell\Modules folder

  • If you are using WMF5 Preview: From an elevated PowerShell session run "Install-Module xRobocopy"

To confirm installation

  • Run Get-DSCResource to see that the resources listed above are among the DSC Resources displayed


This module requires the latest version of PowerShell (v4.0, which ships in Windows 8.1 or Windows Server 2012R2). To easily use PowerShell 4.0 on older operating systems, install WMF 4.0. Please read the installation instructions that are present on both the download page and the release notes for WMF 4.0.


xRobocopy resource has following properties

  • Source: Source Directory, Drive or UNC path.
  • Destination: Destination Dir, Drive or UNC path.
  • Files: File(s) to copy (names/wildcards: default is all files).
  • Retry: Number of Retries on failed copies: default 1 million.
  • Wait: Wait time between retries: default is 30 seconds.
  • SubdirectoriesIncludingEmpty: Copy subdirectories, including Empty ones.
  • Restartable: Copy files in restartable mode.
  • MultiThreaded: Do multi-threaded copies with n threads (default 8). N must be at least 1 and not greater than 128. This option is incompatible with the /IPG and /EFSRAW options. Redirect output using /LOG option for better performance.
  • ExcludeFiles: Exclude Files matching given names/paths/wildcards.
  • LogOutput: Output status to LOG file.
  • AppendLog: Determine whether to overwrite log file or append.
  • AdditionalArgs: Robocopy has MANY configuration options. Too many to present them all as DSC parameters effectively. Use this option to set additional parameters. Each parameter should be a separate array member. This array will be combined with main argument array. For a list of options run Robocopy /??? in a shell window.
  • Ensure: (Readonly). Will indicate whether Destination is in sync with Source.

Renaming Requirements

When making changes to these resources, we suggest the following practice

  1. Update the following names by replacing MSFT with your company/community name and replacing the **"x" with **"c" (short for "Community") or another prefix of your choice
  • Module name (ex: xModule becomes cModule)
  • Resource folder (ex: MSFT_xResource becomes Contoso_xResource)
  • Resource Name (ex: MSFT_xResource becomes Contoso_cResource)
  • Resource Friendly Name (ex: xResource becomes cResource)
  • MOF class name (ex: MSFT_xResource becomes Contoso_cResource)
  • Filename for the <resource>.schema.mof (ex: MSFT_xResource.schema.mof becomes Contoso_cResource.schema.mof)
  1. Update module and metadata information in the module manifest
  2. Update any configuration that use these resources

We reserve resource and module names without prefixes ("x" or "c") for future use (e.g. "MSFT_Resource"). If the next version of Windows Server ships with a "WindowsEventForwarding" resource, we don't want to break any configurations that use any community modifications. Please keep a prefix such as "c" on all community modifications.



  • Update appveyor.yml to use the default template.
  • Activated the GitHub App Stale on the GitHub repository.
  • Fixed new line in example xRobocopy.NetworkAndCredentials.ps1 that failed tests.
  • Added .gitignore file.
  • Added default template files .codecov.yml, .gitattributes, and .gitignore, and .vscode folder.

  • Improved Test-TargetResource method to run robocopy with the same parameters as in Set-TargetResource
  • Bug fix in Test-TargetResource when evaluating return code from robocopy
  • Updated example to use correct PsDscRunAsCredential parameter
  • Breaking Change: Changed AditionalArgs parameter to Array of String
  • Added additional examples with different copy options.

  • Improvements in error handling

  • Updated Get-TargetResource function

  • Initial public release of xRobocopy module with following resources:
    • xRobocopy


Example 1: Copy a directory from one location to another with multithreading and restartable mode. Note that this example is using PSRunAsCredential which is a common parameter only available in WMF5 and later.

    configuration DeployContent
        param (
            [PsCredential] $Credential

        Import-DscResource -ModuleName xRobocopy
        Node 'localhost'
            xRobocopy Content
                Source                = '\\server\share\ReleaseVersion'
                Destination           = 'C:\inetpub\wwwroot\sitename'
                MultiThreaded         = $true
                Restartable           = $true
                PsDscRunAsCredential  = $Credential
    $configData = @{
        AllNodes = @(
                NodeName                    = 'localhost';
                CertificateId               = 'Your Certificate thumbprint here'
    DeployContent -ConfigurationData $configData -Credential (get-credential) -OutputPath 'c:\DSC'
    Start-DscConfiguration -Wait -Force -Verbose -Path 'c:\DSC'

    # Validate results
    Get-ChildItem C:\inetpub\wwwroot\sitename


Please check out common DSC Resources contributing guidelines.


DSC Module to automate Robocopy transfers







No packages published