综合

img tainkai

批量创建win帐号的脚本程序.

发表于2004/10/20 22:54:00  654人阅读

很久以前做压力测试,模拟多用户访问,批量创建win帐号的脚本程序.文件名为 createuser.js,运行命令是:

createuser.js /user:share /password:qazw /start:1 /count:120


function run()
{
WshShell = WScript.CreateObject("WScript.Shell")
//msg = WshShell.run("net user share1 qazw /ADD",1,true)

var argsUnnamed = WScript.Arguments.Named;
var count = argsUnnamed("count")
userName = argsUnnamed("user")
password = argsUnnamed("password")
start = argsUnnamed("start")
if(start ==null)
{
 
 start=1
}
else
{
 start=parseInt(start) 
}

if(userName==null)
{
 WScript.Echo("no userName")
 return 
}


if(password==null)
{
 WScript.Echo("no password") 
 return 
}
if(count==null)
{
 WshShell.run("net user "+ userName +" " + password + " /delete",1,true) 
}
else
{
 count=parseInt(count) 
 var i =0; 
 for( ;i<count;i++)
 {
  WshShell.run("net user "+ userName+(start+i)+" " + password + " /ADD",0)  
 }
}

}

run()


//WshShell.Popup(msg)

阅读全文
0 0

相关文章推荐

img
取 消
img