Retrieving SMTP, FTP, POP3 Information

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 IIsSmtpService")
For Each queryObj As ManagementObject In searcher.Get()

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") = "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

To retrieve information about SMTP, we need to work with the class “IIsSmtpService.” Similarly, to work with FTP, we need to work with “IIsFtpService,” and so on.

0 comments:

Post a Comment

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