Можно:
Код:
@echo off
setlocal enableextensions enabledelayedexpansion
for /f "usebackq delims=" %%i in (
`wmic.exe useraccount where "LocalAccount='True' and Name='%username%'" get SID /value ^|find.exe /i "SID"`
) do set "s%%i"
if defined sSID echo SID=%sSID%
endlocal
exit /b 0
NB! Не ниже Windows XP.