introlux
asked on
Method to export all site headers
Hi Experts,
I would like to know if there is a method to copy all site headers to a csv file. Rather than copy and paste each host header one by one.
Any suggestions how this can be done? I am using windows server 2003.
Regards,
introlux
I would like to know if there is a method to copy all site headers to a csv file. Rather than copy and paste each host header one by one.
Any suggestions how this can be done? I am using windows server 2003.
Regards,
introlux
ASKER
I have at the moment to script below in VB that produces too much info. I only need the host header and preferably in alphabetical order.
Regards,
introlux
Regards,
introlux
' Enumerate IIS Configuration for Auditing
OPTION EXPLICIT
DIM strServer, strServerType, strServerMetaType, objFile, strGuyFile, strFilePath
DIM objService
strServer = "localhost"
strServerType = "Web"
strServerMetaType = "W3SVC"
strFilePath = "C:\IISAudit.csv"
Set objFile = CreateObject("Scripting.FileSystemObject")
Set strGuyFile = objFile.CreateTextFile(strFilePath, True)
strGuyFile.WriteLine("ID,IP Address,Port,Host Header")
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
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
strGuyFile.WriteLine( _
objServer.Name & _
strBindings)
' 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 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 & "," & _
strPort & "," & _
strHost & ","
NEXT
EnumBindings = EnumBindings & VbCrLf
NEXT
END FUNCTION
FUNCTION State2Desc( nState )
SELECT CASE nState
CASE 1
State2Desc = "Starting"
CASE 2
State2Desc = "Started"
CASE 3
State2Desc = "Stopping"
CASE 4
State2Desc = "Stopped"
CASE 5
State2Desc = "Pausing"
CASE 6
State2Desc = "Paused"
CASE 7
State2Desc = "Continuing"
CASE ELSE
State2Desc = "Unknown"
END SELECT
END FUNCTION
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
forget alphabetical order. will do it in excel
i have run this but does not do anything
i have run this but does not do anything
ASKER
sorry it works!
thanks
thanks
ASKER
top answer
ASKER