c:\windows\system32\dns deleting .dns file
<p>I'm having trouble deleting zone files using scripts from </p>

<p><code>c:\windows\system32\dns</code></p>

<p>If I delete using a vbscript, the zone is removed from the DNS server, but the zone file (.dns) remains with Windows saying "The system cannot find the file specified". I have tried this using powershell and ASP.net, but all with the same result.</p>

<p>However, if I try directly from the command line on the console, it works fine, so something appears to be 'hiding' the files in <code>c:\windows\system32\dns</code> to prevent script access, but I don't know what. Anyone else seen this and have ideas?</p>

<p>It's Windows 2012 R2.</p>

<pre><code>Dim ObjExecutor : Set ObjExecutor = CreateObject("ASPExec.Execute")

ObjExecutor.Application = "dnscmd localhost /ZoneDelete domain.com /f"
ObjExecutor.ExecuteDosApp 

ObjExecutor.Application = "cmd /c del c:\windows\system32\dns\domain.com.dns"
ObjExecutor.ExecuteDosApp 

set ObjExecutor  = nothing
</code></pre>