Question: - I need a help to list the created web sites' name on txt configured on an IIS server with NT4.0, currently I can only list the SiteID with adsutil.vbs, but it would not list the Web sites' name.
i.e:
Server
Default web site
Administration web site
website1.ve
website3.com
Any suggestions are much appreciated.
Solution : -
You may use Script for that
i.e:
Server
Default web site
Administration web site
website1.ve
website3.com
Any suggestions are much appreciated.
Solution : -
You may use Script for that
OPTION EXPLICIT DIM strServer, strServerType, strServerMetaType DIM objService strServer = "localhost" strServerType = "Web" strServerMetaType = "W3SVC" IF WScript.Arguments.Length >= 1 THEN strServer = WScript.Arguments( 0 ) END IF IF WScript.Arguments.Length = 2 THEN strServerType = WScript.Arguments( 1 ) IF UCASE( strServerType ) = "FTP" THEN strServerType = "Ftp" strServerMetaType = "MSFTPSVC" ELSE strServerType = "Web" strServerMetaType = "W3SVC" END IF END IF WScript.Echo "Enumerating " & strServerType & "sites on " & strServer & VbCrLf SET objService = GetObject( "IIS://" & strServer & "/" & strServerMetaType ) EnumServersites objService SUB EnumServersites( objService ) DIM objServer, strBindings FOR EACH objServer IN objService IF objServer.Class = "IIs" & strServerType & "Server" THEN WScript.Echo _ "Site ID = " & objServer.Name & VbCrLf & _ "Comment = """ & objServer.ServerComment & """ " & VbCrLf & _ "State = " & State2Desc( objServer.ServerState ) & VbCrLf & _ "LogDir = " & objServer.LogFileDirectory & _ "" ' Enumerate the HTTP bindings (ServerBindings) and ' SSL bindings (SecureBindings) for HTTPS only strBindings = EnumBindings( objServer.ServerBindings ) IF strServerType = "Web" THEN strBindings = strBindings & _ EnumBindings( objServer.SecureBindings ) END IF IF NOT strBindings = "" THEN WScript.Echo "IP Address" & VbTab & _ "Port" & VbTab & _ "Host" & VbCrLf & _ strBindings END IF END IF NEXT END SUB FUNCTION EnumBindings( objBindingList ) DIM i, strIP, strPort, strHost DIM reBinding, reMatch, reMatches SET reBinding = NEW RegExp reBinding.Pattern = "([^:]*):([^:]*):(.*)" FOR i = LBOUND( objBindingList ) TO UBOUND( objBindingList ) ' objBindingList( i ) is a string looking like IP:Port:Host SET reMatches = reBinding.Execute( objBindingList( i ) ) FOR EACH reMatch in reMatches strIP = reMatch.SubMatches( 0 ) strPort = reMatch.SubMatches( 1 ) strHost = reMatch.SubMatches( 2 ) ' Do some pretty processing IF strIP = "" THEN strIP = "All Unassigned" IF strHost = "" THEN strHost = "*" IF LEN( strIP ) < 8 THEN strIP = strIP & VbTab EnumBindings = EnumBindings & _ strIP & VbTab & _ strPort & VbTab & _ strHost & VbTab & _ "" NEXT EnumBindings = EnumBindings & VbCrLf NEXT END FUNCTION FUNCTION State2Desc( nState ) SELECT CASE nState CASE 1 State2Desc = "Starting (MD_SERVER_STATE_STARTING)" CASE 2 State2Desc = "Started (MD_SERVER_STATE_STARTED)" CASE 3 State2Desc = "Stopping (MD_SERVER_STATE_STOPPING)" CASE 4 State2Desc = "Stopped (MD_SERVER_STATE_STOPPED)" CASE 5 State2Desc = "Pausing (MD_SERVER_STATE_PAUSING)" CASE 6 State2Desc = "Paused (MD_SERVER_STATE_PAUSED)" CASE 7 State2Desc = "Continuing (MD_SERVER_STATE_CONTINUING)" CASE ELSE State2Desc = "Unknown state" END SELECT
END FUNCTION
No comments:
Post a Comment