ASP Control Virtual Host Function ADSI

xiaoxiao2021-03-06  39

ASP Control Virtual Host Function ADSI

Use the ASP to set the specified site CPU maximum degree '======================================== ========= 'Function introduction: Set the specified site CPU maximum use of the Site CPU' This function uses ADSI, requires the Administrators Group User Permissions 'Function Name: SetCpulimitvar (Computer, Sitenum, Limitvar)' Usage: SetCpulimitvar computer name, Site number, maximum limit value (100 = 1%, 1000 = 10%) 'example: setcpulimitvar "localhost", "2", "2000"' ================ ========================================= function set culimitvar (Computer, Sitenum, Limitvar) set myobj001 = getObject ("IIS: / / "& Computer &" / W3SVC / "& SiteNum) 'Settings Enable CPU Limit MYOBJ001.CPULIMITSENABED = True' Set limit usage = limited number = limited to = limited number myobj001 = nothingend function

Use ASP to create a web site function '======================================================================================== ======================= Function introduction: Create a Website 'This function uses ADSI, requires the Administrators Group User Permissions' Function Name: CreateWebsite (Computer, Ipaddr, Portnum, Hostname, Websitedirectory, WebsiteInfo, GuestUsername, GuestUSERPASS, STARTORSTOP) 'Usage: CreateWebsite Computer Name (One Move to LocalHost or 127.0.0.1), Site IP Address, Port Name, Host Name, Site Root Directory, Log File Directory Site description : / UserData / usernum001 "," e: / userdata / usernum001 / logfiles "," wwwtest.net "," IUSR_NUM001_TEST.NET "," ABC888 ", TRUE '============== ======================================================= Function CreateWebsite Computer, IPAddr, PortNum, HostName, WebSiteDirectory, LogDirectory, WebSiteInfo, GuestUserName, GuestUserPass, StartOrStop) Dim w3svc, WebServer, NewWebServer, NewDirDim Bindings, BindingString, NewBindings, SiteNum, SiteObj, bDoneOn Error Resume NextErr.Clear 'detects whether the loading W3SVC Service (ie Web Service) SET W3SVC = GetObject ("IIS: //" & Computer & "IIS: //") if Err.Number <> 0 THEN 'Display Error Tips Respon SE.WRITE "Unable to open:" & "Iis: //" & Computer & Computer &

"/ W3SVC" response.Endend IF 'detects whether there is a set of Sites of the same IP address, port and hostname, have bindingstring = ipaddr & ": & portnum &": "& Hostnamefor Each Webserver In W3SVC IF Webserver.class =" IisWeb Server "the bindings = Webserver.serverbindings if bindingstring = bindings (0) THEN RESPONSE.WRITE" IP address conflict: "& ipaddr &", please detect the IP address! "EXIT function end if end ifxt 'Determines a site that does not exist Number is made as a new site number, the system default Website site number is 1, so starts from 2 SiteNum = 2bdone = falseWhile (not bdone) Err.clearset siteobj = getObject ("IIS: //" & computer & "/ w3svc /" & siteenum) ' Loading Specify Site if (Err.Number = 0) Then 'response.write "Step_1 Site" & Sitenum & "exists" Sitenum = SiteNum 1ELSE' response.write "Step_1 Site" & Sitenum & "does not exist" Err.clear set newwebserver = W3SVC. Create ("IisWeb Server", Sitenum) 'Creates a Specify Site if (Err.Number <> 0) Then' response.write "Step_2 Site" & Sitenum & "Creation Failed" SiteNum = SiteNum 1 else 'response.write "Step_2 Site" & Sitenum & Sites "Creating success" BDONE = TRUE END IFEEND IFIF (Sitenum> 50) THEN 'server Maximum Creative Site Click Response.Write "Beyond the server's maximum number of sites, the serial number of the site being created is:" & Sitenum & "." Response.ende nd IfWend 'site for basic configuration NewBindings = Array (0) NewBindings (0) = BindingStringNewWebServer.ServerBindings = NewBindingsNewWebServer.ServerComment = WebSiteInfoNewWebServer.AnonymousUserName = GuestUserNameNewWebServer.AnonymousUserPass = GuestUserPassNewWebServer.KeyType = "IIsWebServer" NewWebServer.FrontPageWeb =

TrueNewWebServer.EnableDefaultDoc = TrueNewWebServer.DefaultDoc = "Default.htm, Default.asp, Index.htm, Index.asp" NewWebServer.LogFileDirectory = LogDirectoryNewWebServer.SetInfoSet NewDir = NewWebServer.Create ( "IIsWebVirtualDir", "ROOT") NewDir.Path = & WebSiteInfoNewDir.AppCreate TrueNewDir.AccessScript = TrueErr.ClearNewDir.SetInfoIf (Err.Number <> 0) Then response.write "error main directory is created." WebSiteDirectoryNewDir.AccessRead = trueNewDir.AppFriendlyName = "application" response.endEnd IfIf StartOrStop = True Then Err.clear set newwebserver = getObject ("IIS: //" & Computer & "/ W3SVC /" & Sitenum) Newwebserver.Start if Err.Number <> 0 Then Response.write "Running the site When you start the site!" Response .end Err.clear End IfResponse.write Site creation success, site number: "& Sitenum &", domain name: "& HostnameEnd Function

Use ASP boot / stop specified Web site '========================================= ====================== Function: Use ASP boot / stop Specify the Web site 'This function uses ADSI, you need administrators group user rights' function name: adminWebsite (Computer , Websitenum, Dowhat) 'Usage: AdminWebsite (Computer Name, Site No., Start / Stop)' Example: Start 127.0.0.1 Site No. 1 Site 'AddWebsite "127.0.0.1", "1", 1' : Stop 127.0.0.1 Site No. 1 Site No. 1 'AddWebsite "127.0.0.1", "1", 0' ======================= =============================================== Function AdminWebsite (Computer, Websitenum, Dowhat) ON Error ResMe NextSet ObjServer = getObject ("IIS: //" & Computer & "/ W3SVC /" & Websitenum) if Err.Number <> 0 Ten Response.write now & "error code:" & HEX (ERR) & "-" & "Unable to turn on the specified site
" end ifif downht = 1 THEN 'uses the Start Start Site ObjServer.Start if Err.Number <> 0 Then Response.write "Unable to start the designated Web site
" else response.write " The designated Web site has been launched
"end ifelseif downhat = 0 THEN 'Using the STOP stop site objserver.stop if err.Number <> 0 Then Response.write" Unable to stop designating Web site
"else response.write" Stop Specify Web Site
"End IFEND IFEND FUNCTION

Use ASP to list server web site information '========================================= ===================== Function introduction: List the current server Web site information 'This function uses ADSI, requires the Administrators group user rights' function name: Listwebsite (Computer, Num) 'Usage: ListWebsite (Number of Computer Name, Display Site)' Example: Display 127.0.0.1 Computer 1000 Site Information 'ListWebsite "127.0.0.1", "1000" =========== ============================================================================================================================================================================================================= Function ListWebsite (Computer, Num) on Error ResMjext ("IIS: //" & Computer & "/ W3SVC /" & i) for i = 0 to num err.clear if err.number = 0 Then Response.write < P> The following is displayed as computer: "& Computer &" All Site Information "Showwebsite = Siteobj.get (" Serverbindings ") 'Get site IP Address: Port: Host Head Info = Split Showwebsite (0), ":") response.write Site No .: "& I &"
"Response.write" Site IP Address: "& Info (0) &"
"Response.write" site port: " & Info (1) & "
" response.write "site host header:" & Info (2) & "

" end ifnextset SiteOjb = nothingEnd Function

Use ASP to delete the specified IIS site '=========================================== =================== Function introduction: Delete Specify IIS Site 'This function uses ADSI, need administrators group user rights' function name: Delwebsite (Computer, Sitenum)' Usage: Delwebsite computer name, Site number: Delwebsite "127.0.0.1", "2" ============================== ======================================= Function Delwebsite (Computer, Sitenum) Set W3SVC = GetObject ("Iis: //" & Computer & Computer & Computer & Computer & Computer & Computer & Computer & Computer & Computer & Computer & Computer & Computer & Computer "/W3SVC" W3SVC.DELETE "IisWeb Server", SitenumResponse.write "delete success!" End function

Manage NT account '================================================================================ ========================================================================================================================================================================================================= =================================================== Fill user 'function usage: adduser (computer, username, password, fullname, info) parameter: computer name, account name, account password, account full name, account description' example: adduser "127.0.0.1", "test" , "Test", "Test Administrator Account", "This account fills" "Modified by ASP" 'Modification Specify User Basic Information' Function Usage: Edituser (Computer, Username, Oldpassword, Password, Fullname, Info) parameters: computer name, Account name, account password, account full name, account description 'example: edituser "127.0.0.1", "test", "test2", "test administrator account modification", "This account is modified" "delete the specified user 'Function Usage: DELUSER (Computer, Username)' parameters: computer name, username '' example: DELUSER "127.0.0.1", "test" ================== ==================================================== function adduser (Computer, Username, PASSWORD, FULLNAME, INFO) 'Execution Create Account Command Set ComputerObj = GetObject ("Winnt: //" &

Computer) Set NewUser = ComputerObj.Create ( "User", UserName) NewUser.SetInfo 'accounts were set NewUser.SetPassword (PassWord)' account password NewUser.FullName = FullName 'account full name NewUser.Description = Info' account description NewUser. Userflags = & h10000 '& H20000 (Change password when the user is logged in) & H0040 (user must not change the password) & H10000 (password permanently correct) & H0002 (account temporary deactivation) newuser.setinforesponse.write "Account" & UserName & "creation success! "Set ComputerObj = nothingEnd Function Function EditUser (Computer, UserName, oldPassWord, PassWord, FullName, info) 'user information is read Set ChangeUserObj = GetObject (" WinNT: // "& Computer &" / "& UserName &", user ")' modify account password if passWord <> "" then ChangeUserObj.SetPassword passWord response.write "account password changed successfully!
" end if 'modify the account's full name if FullName <> "" then UserFullName = ChangeUserObj.get ( "FullName") ChangeUserObj .FullName = FullName ChangeUserObj.SetInfo response.write "account full name changed successfully!
" end if 'modify the account description if Info <> "" then UserFullName = ChangeUserObj.get ( "Description") ChangeUserObj.Description = Info ChangeUserObj .Setinfo response.write "account Description Modification is successful!
" End ifset ChangeUserobj = Nothingend Function FU nction DelUser (Computer, UserName) Set DelUserObj = GetObject ( "WinNT: //" & Computer & "/" & UserName) If Err = & H800401E4 Then Response.Write "user" & UserName & "does not exist" Response.EndEnd IfSet DelObj = GetObject (DelUserObj. PARENT) DELOBJ.DELETE "User", DELUSEROBJ.NAMESET DELUSEROBJ = NothingSet Delobj = NothingResponse.write "Delete Success" End Function

Using ASP Control Specifies Site Resolution Script Language Function 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 , 1, get, head, post, debug "" Analysis other files Please use Aegis (NUM) = "", remember to define 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, fulam ,post ,trace'.asa ,c: /winnt/system32/inetsrv/asp.dll, 5 , Get, head, post, trace'.idc, c: /winnt/system32/inetsrv/httpodbc.dll, 5, get ,post
'.shtm c: /winnt/system32/inetsrv/ssinc.dll, 5 , Get, Post
'.shtml C: /Winnt/System32/inetsrv/ssinc.dll, 5, get ,post
' .stm C: /winnt/system32/inetsrv/ssinc.dll, 5, get , Pos
'.asax C: / WinNT / Microsof T.NET/Framework/v1.1.4322/ASPNET_ISAPI.DLL, 5, Get, Head, Post, debug'.scx, cost/microsoft.net/framework/v1.1.4322/ASPNET_ISAPI.DLL, 5, Get, Head, post, debug'.ashx, c: /winnt/microsoft.net/framework/v1.1.4322/ASPNET_IAPI.DLL, 1, ful, head ,post ,debug'.asmx ,c: /winnt/microsoft.net/ Framework / v1.1.4322 / askNET_IAPI.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_IAPI.DLL, 1, Get, Head, Post, Debug '

. VDISCO, 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_IAPI.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, cost/winnt/microsoft.net/framework/v1.1.4322/ASPNET_ISAPI.DLL, 5, Get, HEAD, POST, Debug'.Webinfo, C: /Winnt/MICROFT.NET/Framework/v1.1.4322/ASPNET_ISAPI.DLL, 5, GET, HEAD ,POST, DEBUG'.LICX, C: /Winnt/MICROFT.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 / Micro soft.NET/Framework/v1.1.4322/aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGIIsWebServiceObj.ScriptMaps=AegisIIsWebServiceObj.SetInfo 'show support for scripting languages ​​response.write "Support to resolve the current site list:
" For ValueIndex = 0 to Ubound (IisWebserviceObj.scriptmaps) Response.write IisWebserviceObj.get ("Scriptmaps") (ValueIndex) Response.write "
" Nextend Function

转载请注明原文地址:https://www.9cbs.com/read-62367.html

New Post(0)