I'm working on an unattended automated install of SQL 2008, 2012 and 2014 which so far is working with my batch command. The one issue I'm encountering is that in order to use a core function found in each program (management studio) properly on Windows 10, it needs to run as an admin.
In Windows 10 this can be done manually by opening the file location of the program shortcut - right click - properties - "compatibility" tab - "change settings for all users" - check the box "run this program as an administrator". Is there a way to have a batch command check that box? This way staff won't need to manually run it as an admin each time, it'll just open Management Studio automatically as an admin.
My batch command can be found below to automate the install. The beginning finds the installation files, sets the sa password to whatever I want and pulls the custom settings for the SQL installer from the configurationfile.ini file. I need the "run as an admin" for all users to run after all that.
start "" "%~dp0SQL2008\setup.exe" /SAPWD="XXXXXXXX" /ConfigurationFile="ConfigurationFile.ini" /quiet
The code is set to write a test entry. The test entry will add Windows XP SP3 and Run As Admin compatibility for that filepath.
For actual use change the arguments to call the label
:reg_compat
with the fullpath to the file as the 1st argument and the reg_data compatibility arguments as the 2nd argument. The compatibility arguments are uppercase and separated with a space.The label
:reg_compat
will write new entries or update entries with adding new compatibility arguments. Theerrorlevel
from the called label is set to not 0 ifreg add
fails.Minimal code instead if you need just that: