Hmm.. Well here's something weird, I decided to rely on a batch file to check administrative access before the install. So, I created a file that contains nothing more simply..
..and included it as a temporary file in my setup. Testing this file on it's own, if I run it from a normal command prompt, it fails and I get an "errorlevel" of "2". From an elevated command prompt, it succeeds and I have an "errorlevel" of "0".
After this, I added this file to a "Launch EXE With Working Directory" custom action and (due to needing to wait for setup package file extraction) set it to the first action after "Add Resources". It's rules are configured to "Wait for custom action to finish before proceeding" and "Fail installation if custom action returns an error". My initial thought was that if this fails, my installation fails and the file extraction process would roll back..
However, now when I run this same setup package on a PC that was installing my service then failing to start it afterwards, instead it installs and runs correctly.. Even without me needing to use "Run as administrator" on the setup executable. So now I'm stuck in a "it works! but I don't know why!" situation..
I would still prefer a solution that checks for admin rights before even configuring the application and clicking "Install", so this doesn't resolve my initial query, I'm just sharing it for future reference.
FOLLOW US
Get the latest news in Application Packaging