- @echo off & setlocal enabledelayedexpansion
-
- set targe=''
- for /f %%i in (user.txt) do (
- set target=%%i
- call :getpw
- net user !target! !pw! /add
- net user !target! /FULLNAME:!target! /COMMENT:"由bat创建"
- net localgroup users !target! admintemp /delete
- C:\Windows\System32\inetsrv\appcmd.exe add apppool /apppool.name:!target!
- C:\Windows\System32\inetsrv\appcmd.exe set config /section:applicationPools /[name='!target!'].processModel.identityType:SpecificUser /[name='!target!'].processModel.userName:!target! /[name='!target!'].processModel.password:!pw!
- )
- pause
- exit /b
-
- :getpw
- set pw=
- set ws=14
- set str=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
- for /l %%a in (1,1,%ws%) do (
- set /a num=!random!%%62
- call set zf=%%str:~!num!,1%%
- set pw=!pw!!zf!
- )
- exit /b
复制代码
|