How to get IP Addresses of all the Subdomains in a Domain ? [modified]
-
Hi all, I have a requirement where I need to get the IPs of all Subdomains in a Domain using VB.Net2005. for example , I have the IP of the Domain "codepro.xyz.net".. under this server there are many subserver(or subdomains) exists like "codepro.xyz.net\code$" Here my requirement is to get all such subserver names or their ip addresses . Any cade samples for this Thanks in advance..
modified on Monday, June 30, 2008 6:31 AM
-
Hi all, I have a requirement where I need to get the IPs of all Subdomains in a Domain using VB.Net2005. for example , I have the IP of the Domain "codepro.xyz.net".. under this server there are many subserver(or subdomains) exists like "codepro.xyz.net\code$" Here my requirement is to get all such subserver names or their ip addresses . Any cade samples for this Thanks in advance..
modified on Monday, June 30, 2008 6:31 AM
Hello i read ur question and i want to know some more details of ur question. R u want IP address for local Domain or for particular site.... i m sending u code which is used to find Work group/Domain in ur LAN. and check that which is pc is Active in that LAN and will also show the IP Address... '--------------------------------------------------- 'Method for Finding Domain/WorkGruop Public Function GetDomain() As String Dim WGroup As String = "" Dim query As New SelectQuery("Win32_ComputerSystem") Dim searcher As New ManagementObjectSearcher(query) For Each mo As ManagementObject In searcher.Get() WGroup = mo("Domain") 'MsgBox(WGroup) Next Return WGroup End Function '--------------------------------------------------- '--------------------------------------------------- 'Method for Finding IP Address of and node no which are Active in LAN Public Sub ListComputers(ByVal TView As TreeView, ByVal WorkGroup As String) Try TView.Nodes.Clear() Dim AllComp As New TreeNode AllComp.Text = Form1.groupname AllComp.ImageIndex = 1 AllComp.SelectedImageIndex = 1 TView.Nodes.Add(AllComp) If WorkGroup.Trim() = "" Then MessageBox.Show("Please provide a Domain Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If Dim DomainEntry As New DirectoryEntry("WinNT://" & WorkGroup.Trim()) DomainEntry.Children.SchemaFilter.Add("computer") For Each Machine As DirectoryEntry In DomainEntry.Children Dim CompNode As New TreeNode(), CompInfo(1) As String CompInfo(0) = Machine.Name Dim Tempaddr As System.Net.IPHostEntry = Nothing Try Tempaddr = DirectCast(Dns.GetHostByName(Machine.Name), System.Net.IPHostEntry) Dim TempAd As System.Net.IPAddress() = Tempaddr.AddressList, str As String = "" For Each TempA As IPAddress In TempAd CompInfo(1) = TempA.ToString() Form1.ListBox1.Items.Add(TempA) Next Catch ex As Exception CompInfo(1) = "" End Try CompNode.Text = CompInfo(0) CompNode.ToolTipText = CompInfo(1) CompNode.ImageInde
-
Hello i read ur question and i want to know some more details of ur question. R u want IP address for local Domain or for particular site.... i m sending u code which is used to find Work group/Domain in ur LAN. and check that which is pc is Active in that LAN and will also show the IP Address... '--------------------------------------------------- 'Method for Finding Domain/WorkGruop Public Function GetDomain() As String Dim WGroup As String = "" Dim query As New SelectQuery("Win32_ComputerSystem") Dim searcher As New ManagementObjectSearcher(query) For Each mo As ManagementObject In searcher.Get() WGroup = mo("Domain") 'MsgBox(WGroup) Next Return WGroup End Function '--------------------------------------------------- '--------------------------------------------------- 'Method for Finding IP Address of and node no which are Active in LAN Public Sub ListComputers(ByVal TView As TreeView, ByVal WorkGroup As String) Try TView.Nodes.Clear() Dim AllComp As New TreeNode AllComp.Text = Form1.groupname AllComp.ImageIndex = 1 AllComp.SelectedImageIndex = 1 TView.Nodes.Add(AllComp) If WorkGroup.Trim() = "" Then MessageBox.Show("Please provide a Domain Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If Dim DomainEntry As New DirectoryEntry("WinNT://" & WorkGroup.Trim()) DomainEntry.Children.SchemaFilter.Add("computer") For Each Machine As DirectoryEntry In DomainEntry.Children Dim CompNode As New TreeNode(), CompInfo(1) As String CompInfo(0) = Machine.Name Dim Tempaddr As System.Net.IPHostEntry = Nothing Try Tempaddr = DirectCast(Dns.GetHostByName(Machine.Name), System.Net.IPHostEntry) Dim TempAd As System.Net.IPAddress() = Tempaddr.AddressList, str As String = "" For Each TempA As IPAddress In TempAd CompInfo(1) = TempA.ToString() Form1.ListBox1.Items.Add(TempA) Next Catch ex As Exception CompInfo(1) = "" End Try CompNode.Text = CompInfo(0) CompNode.ToolTipText = CompInfo(1) CompNode.ImageInde
Hi Dharmchand, Thanks for your help , but my requirement is to get Ip addresses of a particular domain . whose IPAddress is known.