title: VBScript Admin CMD Command Executed Remotely
body: <p>Trying to execute a simple dns flush remotely from a machine, but for one reason or the other - I need to run the cmd as admin. The cmd runs fine under the account physically in person, but you need to do the whole right click -> run as admin bit.</p>
  
  <p>Right now, remotePC is set to local or '.'</p>
  
  <pre><code> Set shl = WScript.CreateObject("WScript.Shell")
  
  'Input remote PC
   remotePC = "."
  
  'Command which will be executed
   strCommand = "cmd.exe /C cd C:\WINDOWS\system32 &amp; ipconfig.exe /flushdns &amp; pause"
  
  'Connect to the remote PC
  'Impersonate with the default level?
  Set objWMIService = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; remotePC &amp; "\root\cimv2")
  
  Set objProcess = objWMIService.Get("Win32_Process")
  
  errReturn = objProcess.Create(strCommand, null, null, intProcessID)
  </code></pre>