jaclaz Posted February 10, 2015 Author Share Posted February 10, 2015 (edited) jaclaz, here are the results from my console windows testing the commands you gave above.Good , so the "S-1-5-32-544" and "S-1-16-12288" remained the same and the version is at the moment 10.0, so this should do: VER | FINDSTR /i "10\.[0]\." > nulIF %ERRORLEVEL% EQU 0 (ECHO Windows 10 ...whoami /groups | find "S-1-5-32-544" >nul && ECHO OK, I am a local admin ...whoami /groups | find "S-1-16-12288" >nul || ECHO I am NOT running elevated, BAD.&&GOTO :do_elevateFSUTIL DIRTY QUERY %systemdrive% >nul || ECHO ... wait a minute, I need elevation anyway&&GOTO :do_elevateECHO ... and I am running elevated, good.PAUSEGOTO :just_do_it)ECHO NOT Xp/2003, NOR Vista and later up to 10.0, this must be a crappy new OS...exiting...&PAUSE&GOTO :EOF@DosProbieCan you try adding the above snippet just above the ":just_do_it" label and re-test?@YzöwlOr maybe something *like*: VER | FINDSTR /i "[6-10]\.[0-3]\." > nulIF %ERRORLEVEL% EQU 0 (ECHO Vista , or later, ...would be better? But then what if the good MS guys decide that Windows 11 will be 10.3 and change the Admin/Elevated SID's? jaclaz Edited February 10, 2015 by jaclaz Link to comment Share on other sites More sharing options...
DosProbie Posted February 11, 2015 Share Posted February 11, 2015 jaclaz, here are the results from my console windows testing the commands you gave above.Good , so the "S-1-5-32-544" and "S-1-16-12288" remained the same and the version is at the moment 10.0, so this should do: VER | FINDSTR /i "10\.[0]\." > nulIF %ERRORLEVEL% EQU 0 (ECHO Windows 10 ...whoami /groups | find "S-1-5-32-544" >nul && ECHO OK, I am a local admin ...whoami /groups | find "S-1-16-12288" >nul || ECHO I am NOT running elevated, BAD.&&GOTO :do_elevateFSUTIL DIRTY QUERY %systemdrive% >nul || ECHO ... wait a minute, I need elevation anyway&&GOTO :do_elevateECHO ... and I am running elevated, good.PAUSEGOTO :just_do_it)ECHO NOT Xp/2003, NOR Vista and later up to 10.0, this must be a crappy new OS...exiting...&PAUSE&GOTO :EOF@DosProbieCan you try adding the above snippet just above the ":just_do_it" label and re-test?@YzöwlOr maybe something *like*: VER | FINDSTR /i "[6-10]\.[0-3]\." > nulIF %ERRORLEVEL% EQU 0 (ECHO Vista , or later, ...would be better? But then what if the good MS guys decide that Windows 11 will be 10.3 and change the Admin/Elevated SID's? jaclaz As Requested ..~DP Link to comment Share on other sites More sharing options...
jaclaz Posted February 11, 2015 Author Share Posted February 11, 2015 @DosProbieCan you try adding the above snippet just above the ":just_do_it" label and re-test? As Requested ..~DP Good It is still to be determined if it makes more sense to have just two three "categories":Xp or 2003 (conventionally pre-Vista ) Vista or later up to Windows 10 this must be a crappy new OS or differentiate them in three four of them: Xp or 2003 (conventionally pre-Vista ) Vista or later up to Windows 8.1 Windows 10 this must be a crappy new OSBut I guess that since it is a batch and essentially the only needed mod (apart the check for "crappy new os" that I completely forgot to put originally in the thingy) everyone will be able - depending on the specific need to modify the FINDSTR argument and corresponding ECHO lines and add/remove checks for specific OSes, as anyway the "final scope" of the small batch is to provide a "reference" for use in batches that need elevation to do their work, such as the one(s) that prompted for putting together the testelev.cmd :http://www.msfn.org/board/topic/173265-formatting-an-external-drive-using-different-interfaces/http://www.msfn.org/board/topic/173265-formatting-an-external-drive-using-different-interfaces/?p=1094177 jaclaz Link to comment Share on other sites More sharing options...
Yzöwl Posted February 11, 2015 Share Posted February 11, 2015 whoami /groups | find "S-1-5-32-544" >nul && ECHO OK, I am a local admin ...whoami /groups | find "S-1-16-12288" >nul || ECHO I am NOT running elevated, BAD.&&GOTO :do_elevateFSUTIL DIRTY QUERY %systemdrive% >nul || ECHO ... wait a minute, I need elevation anyway&&GOTO :do_elevateECHO ... and I am running elevated, good.PAUSEGOTO :just_do_it)ECHO NOT Xp/2003, NOR Vista and later up to 10.0, this must be a crappy new OS...exiting...&PAUSE&GOTO :EOFjaclaz, could you explain the purpose of the first 'whoami' line quoted above, (it appears to me to serve no purpose other than to echo a pointless message). Link to comment Share on other sites More sharing options...
jaclaz Posted February 11, 2015 Author Share Posted February 11, 2015 Yep, you are correct of course , the idea (in my perverted mind) was to have reports on what happens if the batch is run by a non-admin. I have NO idea if the UAC/elevation prompt "triggered" by the elevate.exe happens at all or if it allows to change user (if the right Administrator credentials or supplied) or what else. Let's call it for the moment a "place holder", that can be either removed altogether (because it is pointless) or reversed to something *like*:whoami /groups | find "S-1-5-32-544" >nul || ECHO Wait a minute I cannot elevate from non-admin&&PAUSE&&GOTO :EOFjaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now