Ask the Community
Groups
Agent Procedures - WriteFile() fails to write files to C:\Windows\system32 - Connect IT Community | Kaseya
<main> <article class="userContent"> <p><strong>PROBLEM<br><br></strong>You have an Agent Procedure that tries to write a file to the <strong>C:\Windows\system32\</strong> directory.</p> <p>The procedure executes without failure, but the file does not appear to be written to the specified directory</p> <p><strong>CAUSE</strong></p> <p>The Agent service <strong>Agentmon.exe </strong>is a 32bit Application.</p> <p>32bit Applications are not able to access the 64bit file system on 64bit machines.</p> <p>When a 32bit process tries to write to a 64bit directory, registry key or other 64bit only part of the OS, Windows will intercept this and redirect the process to the 32bit location silently.</p> <p>In this case, Windows will intercept the call to the 64bit <strong>C:\Windows\system32\ </strong>directory and will in fact save the file in the 32bit folder <strong>C:\Windows\syswow64\</strong></p> <p><strong>RESOLUTION</strong></p> <p>Add a step to your Agent Procedure to <strong>ExecuteShellCommand()</strong> and either copy, or move the file from the <strong>C:\Windows\syswow64\</strong> directory to the <strong>C:\Windows\system32\</strong> directory.</p> <p>Make sure that you execute this step in a <strong>64bit shell</strong> as <strong>System</strong>.</p> <div><img src="/attachments/token/pLtFybfj30ZLwXAEbHnKT4O05/?name=copy1.png" alt="copy1.png" width="676" height="372" class="embedImage-img importedEmbed-img"></img></div> <div> </div> <div><strong>APPLIES TO</strong></div> <div> </div> <div><strong>All versions.</strong></div> <div> </div> <div><strong>ADDITIONAL INFORMATION</strong></div> <p><a href="/home/leaving?allowTrusted=1&target=http%3A%2F%2Fwww.samlogic.net%2Farticles%2F32-64-bit-windows-folder-x86-syswow64.htm">http://www.samlogic.net/articles/32-64-bit-windows-folder-x86-syswow64.htm</a></p> </article> </main>