IIS Information Retrieval 1

IIS Information Retrieval Via “IIsWebService,” which gives you much ore information than the previous class which was “IIsWebInfo” class.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim dt As DataTable = getPropertyStruct()
Dim dr As DataRow
Dim searcher As New ManagementObjectSearcher("root\MicrosoftIISv2", "SELECT * FROM IIsWebService")
For Each queryObj As ManagementObject In searcher.Get()

dr = dt.NewRow
dr("Name") = "Name"
dr("value") = queryObj("Name")
dt.Rows.Add(dr)

dr = dt.NewRow
dr("Name") = "DisplayName"
dr("value") = queryObj("DisplayName")
dt.Rows.Add(dr)

dr = dt.NewRow
dr("Name") = "PathName"
dr("value") = queryObj("PathName")
dt.Rows.Add(dr)

dr = dt.NewRow
dr("Name") = "Started"
dr("value") = queryObj("Started")
dt.Rows.Add(dr)


dr = dt.NewRow
dr("Name") = "State"
dr("value") = queryObj("State")
dt.Rows.Add(dr)

dr = dt.NewRow
dr("Name") = "Status"
dr("value") = queryObj("Status")
dt.Rows.Add(dr)

dr = dt.NewRow
dr("Name") = "SystemName"
dr("value") = queryObj("SystemName")
dt.Rows.Add(dr)

Next
Me.GridView1.DataSource = dt
Me.GridView1.DataBind()
Catch err As ManagementException
Response.Write(err.Message)
End Try
End Sub

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.