title: VBS access denied
body: <p>I want to make a program that can copy a file to <code>c:\windows\system32\whatever.vbs</code>. The problem is that I get "access denied" when its running.</p>
  
  <p>I have tried to get administrator privileges but the UAC still appears. Can anybody give me a script to run my vbs as administrator and disable UAC when its running?</p>
  
  <p>Here is the code :</p>
  
  <pre><code>option explicit
  dim folder, root, f1, source, destination, regedit, WshNetwork
  
  function CopyFile(source, destination)
  dim filesys
  
  set filesys=CreateObject("Scripting.FileSystemObject")
    If filesys.FileExists(source) Then
       filesys.CopyFile source, destination
    End If
  end function
  
  Set WshNetwork = WScript.CreateObject("WScript.Network")
  
  set folder = CreateObject("Scripting.FileSystemObject")
  set root = folder.GetFile(Wscript.ScriptFullName)
  
  source = root
  destination = "c:\Documents And Settings\" &amp; WshNetwork.UserName &amp;"\Start Menu\Programs\Startup\whatever.vbs"
  
  call CopyFile(source,destination)
  
  destination = "c:\Windows\System32\whatever.vbs"  -&gt; in here access is denied
  
  call CopyFile(Source,destination)
  </code></pre>