Getting Access is denied error while using robocopy - robocopy

net use Z: https://mink.mycomp.com/EnUNew/G1/G2/G3/TestDocument ne569 /USER:mycmp\b569
Z:
dir
C:
robocopy \CODFS1.CON.EXACO.NET\SHARE\Dropbox\test\ Z:\ /MAXAGE:1 /E /XO
net use Z: /d
I use the above code , I get Access is denied ERROR 5 (0x00000005).
How to get rid of the error . I am trying to copy a folder from a Sharedrive to a sharepoint site. ?

If you doing this on Windows 2008 or later try using a Administrative command prompt. I just discovered this 'security feature' copying data from one server to another where I was admin on both

Related

Special permissions causing issues with Sharegate to sharepoint migration

I am using ShareGate to migrate data from our network drive to our 365 SharePoint sites.
When doing a migration for certain folders I am getting errors that the SharePoint library cannot contain more than 50,000 unique permissions.
We primarily use security groups to add permissions to folders on the network drive but after the years we have had this data a lot of permissions are messed up and don't even allow admin accounts to change them.
To get around them I am using psexec to open powershell as NT Authority\System and run the following command to make Administrator owner of all the files/folders.
takeown /d Y /a /r /f "folder path"
After doing that I use icacls with the following two commands:
icacls "Folder path" /inheritancelevel:e /t /c /q
icacls "Folder path" /grant "username":f /t /c /q
For username I will use an administrator account to reduce issues with sharegate migration.
This has allowed access to all the files/folders within a main folder of a network drive, but after doing so I get errors for the 50k unique permissions.
I believe I've narrowed it down to icacls making every permission unique when I force add the username with full access. I have tried resetting permissions and forcing inherited permissions which will work for the folders and subfolders, but the files will not take the parent permissions and still recreate the permissions that they had before.
I am currently using powershell v2.0 on a windows server 2008 R2. I have ShareGate version 16.0.0
I installed powershell version 5.0 but have to restart the server after hours tonight so it can do the update and install.
Does anyone know how I would be able to make all permissions the same for future folders and also fix the current permissions so none are unique?

PS Script permission issues

world !
I'm very new to the scripting world but I'm currently trying to automate a process a work that involves in moving a folder and its contents to the windows directory on C:.
currently, I have this
Copy-Item -Path "C:\Java Config Files*" -Destination "C:\Windows\" -R
it's returning with an error message
Copy-Item : Access to the path 'C:\Windows\Java Config Files' is denied.
any thoughts how I can elevate privileges without having to run the script as admin? or if there is a cmdlet that could achieve this?
fixed by running as admin by adding runAS cmdlet

Robocopy Access Denied Error 5 From Powershell

I am copying files from my build server to a web server on Windows Server 2016. I am running the following from PowerShell. I am running this script with an administer account which has read/write access to the destination directory.
robocopy $Path\Items $_\Items /Sec /copy:DT /MIR /NDL /NS /NP /MT /w:1 /r:1 /R:20 2>&1 | out-host
I get the following error
ERROR 5 (0x00000005) Creating Destination Directory
\SOMEPATH\Data\Items\ Access is denied.
Ensure that you open your powershell session as an administrator (runas)
Also check the NTFS permission on the destination path and not only the security permissions.
If you are using a DFS path you should be better with the UNC path of the actual servername.
Hope this helps.
Actually I was not able to post this as a comment under your question, because I don't have 50 rep points yet.

Robocopy - ERROR 124 (0x0000007C) Creating Destination Directory

Hoping someone familiar with Windows 10 and Robocopy can help.
I am using the following robocopy command in backup script that is being run as Administrator (yes the real Administrator user ID)
runas /user:Administrator backup.bat
robocopy N:\FNL E:\FNL /MIR /E /Z /R:1 /W:1 /V /NP /LOG+:backup.log
As long as there have been no new files for directories created in the source folder, in this case N:\FNL it seems to run fine. As soon as I create a directory, for example "Fred", I get the following error:
ERROR 124 (0x0000007C) Creating Destination Directory N:\FNL\Fred
The system call level is not correct.
I have changed file permission for "Authenticated Users" to Full Control and as well have taken ownership of all folders and sub-folders/child objects on the target drive but still get the same error.
Anyone have an idea what I might be doing wrong?

Copy files and folders using robocopy

I need to copy directory from a server to the Program Files folder on desktop using local admin. This is what I have so far.
robocopy "server source" "C:\Program Files\Test" /MIR
I get the follwoing error
2014/05/23 17:53:04 ERROR 5 (0x00000005) Creating Destination Directory C:\Program Files\Test\
Access is denied.
I'm running the bat on logon via GPO.
Can someone please help me?
Thanks.
I changed the location to %appdata% from program files.