CODE: [Copy to clipboard]
:禁用Administrator以外的所有用户
set f=%temp%\GetAllusername.vbs
echo.>%f%
echo Set objNetwork = CreateObject("Wscript.Network") >>%f%
echo strComputer = objNetwork.ComputerName >>%f%
echo Set colAccounts = GetObject("WinNT://" ^& strComputer ^& "") >>%f%
echo colAccounts.Filter = Array("user") >>%f%
echo For Each objUser In colAccounts >>%f%
echo Wscript.Echo objUser.Name >>%f%
echo Next >>%f%
set ff=%temp%\GetAllusername.txt
cscript %f%>%ff%
set fff=%temp%\userlist.ini
echo Administrator >%fff%
:删除
:for /f "tokens=* skip=3" %%i in (%ff%) do find "%%i" %fff%||net user /delete "%%i"
:禁用
for /f "tokens=* skip=3" %%i in (%ff%) do find "%%i" %fff%||net user /active:n "%%i"