使用ASP设置指定站点CPU最大使用程度 '================================================= '函数介绍:设置指定站点CPU最大使用程度 '本函数使用ADSI,需要Administrators组用户权限 '函数名称:SetCPULimitVar (Computer,SiteNum,LimitVar) '用法:SetCPULimitVar 计算机名,站点编号,最大限制值(100=1%,1000=10%) '例:SetCPULimitVar "LocalHost","2","2000" '================================================= Function SetCPULimitVar(Computer,SiteNum,LimitVar) Set MyObj001 = GetObject("IIS://"&Computer&"/W3SVC/"&SiteNum) '设置启用CPU限制 MyObj001.CpuLimitsEnabled = True '设置限制使用额度值 MyObj001.CpuLimitLogEvent=LimitVar MyObj001.setinfo Set MyObj001=Nothing End Function |
使用ASP在IIS创建WEB站点的函数
|
使用ASP启动/停止指定WEB站点 '============================================================= '函数介绍:使用ASP启动/停止指定WEB站点 '本函数使用ADSI,需要Administrators组用户权限 '函数名称:AdminWebSite(Computer,WebSiteNum,DoWhat) '用法:AdminWebSite(计算机名称,站点编号,启动/停止) '例:启动127.0.0.1计算机上站点编号为1的站点 'AdminWebSite "127.0.0.1","1",1 '例:停止127.0.0.1计算机上站点编号为1的站点 'AdminWebSite "127.0.0.1","1",0 '============================================================= Function AdminWebSite(Computer,WebSiteNum,DoWhat) On Error Resume Next Set objServer = GetObject("IIS://" & Computer & "/W3SVC/" & WebSiteNum) If Err.Number <> 0 Then Response.Write Now & ". 错误码: " & Hex(Err)& " - " & "无法开启指定站点<br>" End If if Dowhat=1 then '使用Start启动站点 objServer.Start If Err.Number <> 0 Then Response.Write "无法启动指定Web站点<br>" else Response.Write "已经启动指定Web站点<br>" End If elseif DoWhat=0 then '使用Stop停止站点 objServer.Stop If Err.Number <> 0 Then Response.Write "无法停止指定Web站点<br>" else Response.Write "已经停止指定Web站点<br>" End If end if End Function |
使用ASP列出服务器WEB站点信息 '============================================================= '函数介绍:列出当前服务器WEB站点信息 '本函数使用ADSI,需要Administrators组用户权限 '函数名称:ListWebSite (Computer,Num) '用法:ListWebSite (计算机名称,显示站点数量) '例:显示127.0.0.1计算机上1000个站点信息 'ListWebSite "127.0.0.1","1000" '============================================================= Function ListWebSite(Computer,Num) On Error Resume Next Set SiteObj = GetObject("IIS://"&Computer&"/w3svc/"&i) for i=0 to Num Err.Clear if Err.Number=0 then response.write "<p><b>以下显示为计算机:"&Computer&"上所有站点信息</b></p>" ShowWebSite = SiteObj.Get("ServerBindings") '获得站点IP地址:端口:主机头 Info=split(ShowWebSite(0),":") response.write "站点编号:"&i&"<br>" response.write "站点IP地址:"&Info(0)&"<br>" response.write "站点端口:"&Info(1)&"<br>" response.write "站点主机头:"&Info(2)&"<br><br>" end if next set SiteOjb=nothing End Function |
使用ASP删除指定IIS站点 |
通过ASP管理NT帐号 '============================================================= '函数介绍:通过ASP管理NT帐号 '本函数使用ADSI,需要Administrators组用户权限 '============================================================= '填加用户 '函数用法:AddUser(Computer,UserName,PassWord,FullName,Info) '参数:计算机名,帐号名称,帐号密码,帐号全名,帐号说明 '例:AddUser "127.0.0.1","Test","Test","测试管理员帐号","本帐号通过ASP填加" '修改指定用户基本信息 '函数用法:EditUser(Computer,UserName,OldPassWord,PassWord,FullName,Info) '参数:计算机名,帐号名称,帐号密码,帐号全名,帐号说明 '例:EditUser "127.0.0.1","Test","Test2","测试管理员帐号修改","本帐号通过ASP修改过" '删除指定用户 '函数用法:DelUser(Computer,UserName) '参数:计算机名,用户名' '例:DelUser "127.0.0.1","Test" ============================================================= Function AddUser(Computer,UserName,PassWord,FullName,Info) '执行创建帐号命令 Set ComputerObj = GetObject("WinNT://"&Computer) Set NewUser = ComputerObj.Create( "User" , UserName ) NewUser.SetInfo '进行帐号设置 NewUser.SetPassword ( PassWord ) '帐号密码 NewUser.FullName = FullName '帐号全名 NewUser.Description = Info '帐号说明 NewUser.UserFlags = &H10000 '&H20000(使用者下次登入时须变更密码) &H0040(使用者不得变更密码) &H10000(密码永久正确) &H0002(帐户暂时停用) NewUser.SetInfo response.write "帐号"&UserName&"创建成功!" Set ComputerObj=nothing End Function
Function DelUser(Computer,UserName) |
使用ASP控制指定站点解析脚本语言函数 Function AdminAegis(Computer,SiteNum) Set IIsWebServiceObj = GetObject("IIS://"&Computer&"/W3SVC/"&SiteNum) dim Aegis(1) Aegis(0)=".asp,C:/WINNT/system32/inetsrv/asp.dll,5,GET,HEAD,POST,TRACE" 'Aegis(1)=".aspx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG" '解析其它文件请同样使用Aegis(Num)=""这种格式,记得要将dim Aegis(Num)定义 '.htw,C:/WINNT/system32/webhits.dll,3,GET,HEAD,POST '.ida,C:/WINNT/system32/idq.dll,7,GET,HEAD,POST '.idq,C:/WINNT/system32/idq.dll,7,GET,HEAD,POST '.asp,C:/WINNT/system32/inetsrv/asp.dll,5,GET,HEAD,POST,TRACE '.cer,C:/WINNT/system32/inetsrv/asp.dll,5,GET,HEAD,POST,TRACE '.cdx,C:/WINNT/system32/inetsrv/asp.dll,5,GET,HEAD,POST,TRACE '.asa,C:/WINNT/system32/inetsrv/asp.dll,5,GET,HEAD,POST,TRACE '.idc,C:/WINNT/system32/inetsrv/httpodbc.dll,5,GET,POST<br> '.shtm C:/WINNT/system32/inetsrv/ssinc.dll,5,GET,POST<br> '.shtml C:/WINNT/system32/inetsrv/ssinc.dll,5,GET,POST<br> '.stm C:/WINNT/system32/inetsrv/ssinc.dll,5,GET,POST<br> '.asax C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.ascx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.ashx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.asmx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.aspx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.axd,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.vsdisco,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.rem,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.soap,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG '.config,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.cs,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.csproj,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.vb,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.vbproj,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.webinfo,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.licx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.resx,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG '.resources,C:/WINNT/Microsoft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG IIsWebServiceObj.ScriptMaps=Aegis IIsWebServiceObj.SetInfo '显示支持脚本语言 response.write "当前站点支持解析列表:<br>" For ValueIndex = 0 To UBound(IIsWebServiceObj.ScriptMaps) response.write IIsWebServiceObj.Get("ScriptMaps")(ValueIndex) response.write "<br>" Next End Function |
使用ASP列出NT用户组及用户 '============================================================= '列出指定用户组用户 |