none
PowerShell & Robocopy Errors RRS feed

  • Question

  • While calling RoboCopy on a remote computer I get the following RoboCopy errors:

    ERROR 5: Getting File System Type of Destination \\dest\year\ Access is denied.

    ERROR : You do not have the Manage Auditing user right.

    I am running the script as domain admin, and have full rights to both source and destination shares. I have tried multiple destinations, even one on the same server as the source.  According to the console output, my RoboCopy command is getting passed to the source server and read correctly.

    My script below is an excerpt set up for testing.

    RemoteRobo "\\source\team\year,\\dest\year"
    
    function RemoteRobo
    {
    	[CmdletBinding()]
    	param(
    		[Parameter(Mandatory = $true)]
    		$argsSource
    	)
    	foreach($argpair in $argsSource){
    			invoke-command -computername $argpair.split("\")[2] {
    			param($argpair)robocopy $($argpair.split(",")[0]) $($argpair.split(",")[1]) /COPYALL /MIR /XO /E /W:0 /R:0
    			} -ArgumentList $argpair 
    	}
    }


    • Edited by yogibear79 Wednesday, March 26, 2014 12:18 PM
    Wednesday, March 26, 2014 12:16 PM

All replies

  • First off a function must be declared before calling it, so your script above will not work as you are calling the function first.

    Second why use the Invoke-Command cmdlet? Robocopy should work with the UNC paths, so if you run the script on a machine that has Robocopy installed it should work


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    Don't Retire Technet

    Wednesday, March 26, 2014 12:43 PM
  • Thanks for the reply.

    I am using the Invoke-Command cmdlet because the script will be migrating 30,400+ directories from one set of servers to a new set of servers.  The plan is run the script which builds a list of directories, based on naming structure determines the destination, then passes the robocopy commands to the various source servers to distribute the load more evenly.

    The script works, as it passes the robocopy command to the remote server(s).  I get the following error regardless of the destination directory. I have tried a destination on the same server as the source. And just to rule out the remote issue, I tried running it locally to the same client the script is running from.

    -------------------------------------------------------------------------------

       ROBOCOPY     ::     Robust File Copy for Windows                             

    -------------------------------------------------------------------------------

      Started : Wed Mar 26 09:22:55 2014

    2014/03/26 09:22:55 ERROR 5 (0x00000005) Getting File System Type of Destination \\dest\\year\

    Access is denied.

     

       Source : \\source\team\year\

         Dest - \\dest\year\

        Files : *.*

       

      Options : *.* /S /E /COPYALL /PURGE /MIR /XO /R:0 /W:0

    ------------------------------------------------------------------------------

    NOTE : NTFS Security may not be copied - Destination may not be NTFS.

    ERROR : You do not have the Manage Auditing user right.

    Wednesday, March 26, 2014 1:33 PM
  • hmm definitely weird, I have not used robocopy much so never really ran into any issues, but looking at your original script, the params you are sending to robocopy are /COPYALL /MIR /XO /E /W:0 /R:0

    /MIR is equivalent to /E plus /PURGE so I dont think you need the /E param

    Don't think that is the issue, but I would try it just in case


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    Don't Retire Technet


    • Edited by clayman2 Wednesday, March 26, 2014 2:00 PM typo
    Wednesday, March 26, 2014 1:59 PM
  • I've tried about every argument combo I can think of.

    I've settled on this one:

    robocopy \\source\team\year \\dest\year /COPY:DATSO /E /W:0 /R:0

    If I put that syntax in a command window on the \\source machine it works fine. But when passed via PS it fails.  I have even tried passing the credentials. Same Results!

    $cred = Get-Credential

    ....

    invoke-command .... } -argumentlist $argpair -credential $cred

    This way works, where I just run it local from the machine running the script.

    robocopy $($argpair.split(",")[0]) $($argpair.split(",")[1]) /COPY:DATSO /E /W:0 /R:0
    This way would defeat distributing the load across four servers, and making one do all of the work. If This is how it has to be, then I am thinking my best bet is to export the array of 30,000+ migrations dividing it into four files. Then have another script to read that file and run robocopy locally.  And start that from all four servers

    • Edited by yogibear79 Wednesday, March 26, 2014 3:47 PM
    Wednesday, March 26, 2014 3:36 PM
  • How are you running the script, I found one article that said to open your console by right clicking and choosing run as administrator

    http://social.technet.microsoft.com/Forums/en-US/c4486f3d-45cb-4bfd-a6ae-f4a797d5b4ee/robocopy-error-you-do-not-have-the-manage-auditing-user-right?forum=winservergen


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    Don't Retire Technet

    Wednesday, March 26, 2014 3:44 PM
  • Tried that too. :(
    Wednesday, March 26, 2014 4:02 PM