Jump to content

[RELEASE] testelev.cmd


Recommended Posts

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 :thumbup 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

@DosProbie

Can you try adding the above snippet just above the ":just_do_it" label and re-test?

@Yzöwl

Or maybe something *like*:

 

VER | FINDSTR /i "[6-10]\.[0-3]\." > nul

IF %ERRORLEVEL% EQU 0 (

ECHO Vista :ph34r:, or later, ...

would be better?

 

But then what if the good MS guys decide that Windows 11 will be 10.3 :w00t: and change the Admin/Elevated SID's? :unsure:

 

jaclaz

Edited by jaclaz
Link to comment
Share on other sites


 

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 :thumbup 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

@DosProbie

Can you try adding the above snippet just above the ":just_do_it" label and re-test?

@Yzöwl

Or maybe something *like*:

 

VER | FINDSTR /i "[6-10]\.[0-3]\." > nul

IF %ERRORLEVEL% EQU 0 (

ECHO Vista :ph34r:, or later, ...

would be better?

 

But then what if the good MS guys decide that Windows 11 will be 10.3 :w00t: and change the Admin/Elevated SID's? :unsure:

 

jaclaz

 

 

As Requested ..

~DP

10_ADMIN.jpg

Link to comment
Share on other sites

 

@DosProbie

Can you try adding the above snippet just above the ":just_do_it" label and re-test?

 

 

As Requested ..

~DP

 

Good :thumbup

 

It is still to be determined if it makes more sense to have just two three "categories":

  1. Xp or 2003 (conventionally pre-Vista :ph34r:)
  2. Vista :ph34r: or later up to Windows 10
  3. this must be a crappy new OS

 

or differentiate them in three four of them:

 

  1. Xp or 2003 (conventionally pre-Vista :ph34r:)
  2. Vista :ph34r: or later up to Windows 8.1
  3. Windows 10
  4. this must be a crappy new OS

But 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 :blushing: 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

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

jaclaz, 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

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 :EOF

jaclaz

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...