/build/static/layout/Breadcrumb_cap_w.png

File Synchronizations and/or Script cannot copy files to system32 folder

No matter what I try, either script or file synch, I can't get a file to copy over into the C:\windows\system32 folder. Status shows it goes successfully, but the file is no where to be seen. For example: 

@echo off


xcopy OEMDefaultAssociations.xml C:\

move OEMDefaultAssociations.xml C:\windows\system32

del C:\OEMDefaultAssociations.xml

exit

That's the above batch command I'm running in Script - if i change the folder to anything other than system32, like C:\temp, for example, it works. Whats the deal? I've tried with all credentials as well, local admin, domain admin etc.

Anyone have any suggestions/ideas, thanks.


0 Comments   [ + ] Show comments

Answers (2)

Posted by: SMal.tmcc 5 years ago
Red Belt
1

"system" owns the existing file in system32 and you need to take control of that file first.


takeown /f c:\windows\system32\OEMDefaultAssociations.xml /a
icacls c:\windows\system32\OEMDefaultAssociations.xml /grant everyone:F /c
rename c:\windows\system32\OEMDefaultAssociations.xml OEMDefaultAssociationsold.xml

xcopy your file.


Also FYI you are using a move command so no need to delete the move actually does a "copy and delete" function


Comments:
  • or run a script to take control and then file sync should work - SMal.tmcc 5 years ago
Posted by: kayroccs 4 years ago
Yellow Belt
0

Hey guys, 

So I ran into this issue when trying to copy to System32\GroupPolicy folder. Here's what I did rather than taking ownership. 


Script Type: Can be an Online Kscript or offline kscript

Windows Run AS: Local System

Directory: windir%\sysnative

File: xcopy.exe

Parameters: $(KACE_DEPENDENCY_DIR)\* C:\Windows\System32\GroupPolicy\ /s /e /v /i /h /y


H2AUaTrAGUJlAAAAAElFTkSuQmCC

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ