Post by TPost by TWindows 11 pro 22H2
C:\NtUtil>type Windows.RaidCheck.pl6.bat
@echo off
fsutil /? > nul
echo %ERRORLEVEL%
C:\NtUtil>Windows.RaidCheck.pl6.bat
1
This is because
fsutil /?
/? is an invalid parameter.
RATS !!!
Hi JJ,
You put me on the right path though
net sessions & echo %ERRORLEVEL%
System error 5 has occurred.
Access is denied.
2
net sessions & echo %ERRORLEVEL%
There are no entries in the list.
0
Thank you!
Whoops. With fsutil, the /? shouldn't be specified. i.e. just `fsutil`
without any command line argument.
Another alternative which is longer to type but not without advantages, is
to simply check the content of the `systemprofile` folder. e.g.
@echo off
if exist %systemroot%\system32\config\systemprofile\* (
echo elevated
) else (
echo not elevated
)
Or try going into that folder...
@echo off
2>nul pushd %systemroot%\system32\config\systemprofile
if errorlevel 1 (
echo not elevated
) else (
popd
echo elevated
)
The advantages of checking that folder is because it's faster than executing
a tool. And a tool may be blocked by group policy, or be excluded by
debloater software from the OS installer to create a minimal OS installation
which is intended to only do specific thing.