0

I have a msi installer that needs to be run in silent mode. For that I need to run the installer in silent mode through an elevated command prompt. How can I launch the cmd in elevated mode and then run the command to execute installer from that elevated cms using a batch file?

Siddhant
  • 571
  • 1
  • 8
  • 32
  • same question : http://stackoverflow.com/questions/11525056/how-to-create-a-batch-file-to-run-cmd-as-administrator – r3ap3r Mar 13 '14 at 05:52
  • I need to schedule the batch file on a daily basis.So, I cannot enter the password every time. It has to be automated. Is there any other way out? – Siddhant Mar 13 '14 at 05:55
  • This might help you : http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-admin-rights – r3ap3r Mar 13 '14 at 05:58
  • nah..nothing..What if I schedule my batch file to run with highest privileges? What happens in that case? – Siddhant Mar 13 '14 at 06:04
  • 1
    That should probably work. – r3ap3r Mar 13 '14 at 06:06
  • Scheduling the batch file with highest privileges does work for me. – Siddhant Mar 13 '14 at 07:02

2 Answers2

1
  1. Make a batch file and call the msi installer from it.
  2. Then create a shortcut to the batch file.
  3. Right click on the shortcut -> Properties -> Shortcut tab -> Advanced.
  4. Click Run as administrator. Execute the batch script from the shortcut.
  5. In the scheduler, give the path to this shortcut.
r3ap3r
  • 2,775
  • 2
  • 17
  • 16
1

If you want all programs (including command prompt) to run in admin mode by default, then disable UAC by making enableLUA=0 in registry. Note that this change will prompt for system restart.

EnableLUA can be found under HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System.

Once the system comes up, then all programs will run in elevated (admin) mode by default.