vbs实现windows通过文本导入批量增加用户

adduser.vbs

——————————————————————————---

dim os,cmd,myfile,myarray

Set WshShell = CreateObject("Wscript.Shell")
set fso=createobject("scripting.filesystemobject")
set userFile=fso.opentextfile("用户帐号及密码.txt",1)

do while Not userfile.atendofstream
   readlinetextfile=userfile.readline
   wscript.echo readlinetextfile
   myarray=split(readlinetextfile,",",-1,1)
   user=myarray(0)
   password=myarray(1)
cmd="cmd /c net user "&user&" "&password&" /add /active:yes /expires:never /passwordchg:no" 
wscript.echo cmd
WshShell.run cmd,0,false
loop

 

用户账号及密码.txt   (注:必须与上面的vbs文件放在一个文件夹内)

--------------------------------------------------------------------------

test1,password
test2,password


你可能感兴趣的:(运维管理)