title: elevate without prompt - verb runas start-process
body: <p>This may not be possible, but I'm looking to run a .ps1 powershell script from a command line, it needs to be run with Elevated privileges, without or bypassing any UAC prompts.</p>
  
  <p>This is from a scripting perspective, with no user interaction. So "Run as administrator" for CMD or Powershell is not an option. There cannot be any UAC prompts to click on as these will most likely be hidden from view.</p>
  
  <p>My command started off like this -</p>
  
  <p><code>powershell.exe -executionpolicy bypass -file .\remove-default-apps.ps1</code></p>
  
  <p>This would launch the .ps1 fine, but the script would ultimately fail, as the commands in the script require elevation (Get-AppxPackage | Remove-AppxPackage)</p>
  
  <p>My next attempt was using Powershell to run the script using -</p>
  
  <p><code>Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File MyScript.ps1' -Verb RunAs</code></p>
  
  <p>But still this prompts for elevation.
  I can replicate the errors running the script from a non-elevated cmd window manually, but running elevated it works fine.</p>
  
  <p>Anyone know if this is at all possible? Or have any tips to point me in the right direction, Ive tried a lot of other methods (psexec, scheduled task..) but am unable to achieve this.</p>