Solved

Count Computers on Network?

Posted on 2012-03-28
4
343 Views
Last Modified: 2012-04-12
I have to get a count of how many computers are at our facility. I'm hoping for a easier way other than physically walking and counting each one here.

Q1:Is there a way to count how many computers is on the network?

If possible

Q1 Part 2: Is there a way to count also the computers not on the network along with it? (meaning counting workgroups)
If not just having the ones on the network will cut a lot of time down in counting them all.

If it helps any we have SBS 2011, and a Cisco ASA 5510.
0
Comment
Question by:Pancake_Effect
4 Comments
 
LVL 10

Assisted Solution

by:pclinuxguru
pclinuxguru earned 125 total points
Comment Utility
Fast and furious way is to count your DHCP leases. Subtract the ones you know aren't machines.

If you not in a hurry you could setup a spiceworks (www.spiceworks.com) server and let it run for a week or so and it should give you an accurate count. I say let it run for a week or so for the machines that are turned off or laptops.
0
 

Assisted Solution

by:aitg
aitg earned 125 total points
Comment Utility
You can use the arp -a command to report all devices in the arp table, but that would not distinguish computers from other networked devices. If you want a definitive list of networked devices, with graphical output, you can download jNetMap.
0
 
LVL 3

Assisted Solution

by:john M
john M earned 125 total points
Comment Utility
here is now to do it in .net
i use this to read all the event logs on our network

Imports System.Data
Imports System.Net.NetworkInformation
Imports System.Runtime.InteropServices
Imports System.IO.File
Imports System.Configuration
Imports Registration.Exams
Imports System.Data.SqlClient
Imports System
Imports System.IO
Imports System.Xml
Imports Microsoft.VisualBasic
Imports System.Net
Imports System.Web

Imports System.Net.Sockets
Imports System.Text.RegularExpressions
#Region "Get network computers"
    Public Function GetNetworkComputers() As ArrayList
        Dim networkComputers As New ArrayList()
        Const MAX_PREFERRED_LENGTH As Integer = -1
        Dim SV_TYPE_WORKSTATION As Integer = 1
        Dim SV_TYPE_SERVER As Integer = 2
        Dim buffer As IntPtr = IntPtr.Zero
        Dim tmpBuffer As IntPtr = IntPtr.Zero

        Dim entriesRead As Integer = 0
        Dim totalEntries As Integer = 0
        Dim resHandle As Integer = 0
        Dim sizeofINFO As Integer = Marshal.SizeOf(GetType(_SERVER_INFO_100))

        Try
            Dim ret As Integer = NetServerEnum(Nothing, 100, buffer, MAX_PREFERRED_LENGTH, entriesRead, totalEntries, _
                                               SV_TYPE_WORKSTATION Or SV_TYPE_SERVER, Nothing, resHandle)

            If ret = 0 Then
                For i As Integer = 0 To totalEntries
                    tmpBuffer = New IntPtr(CType(buffer, Integer) + (i * sizeofINFO))
                    Dim svrInfo As _SERVER_INFO_100 = CType(Marshal.PtrToStructure(tmpBuffer, _
                                                            GetType(_SERVER_INFO_100)), _SERVER_INFO_100)
                    ' If svrInfo.sv100_name.Substring(0, 1) <> "A THRU Z" Then
                    'If (svrInfo.sv100_name.Substring(0, 10)) = "DANB-HOMER" Then
                    '    networkComputers.Add(svrInfo.sv100_name)
                    'Else


                    If svrInfo.sv100_name.Length < 4 And svrInfo.sv100_platform_id = "400" Then
                        networkComputers.Add(svrInfo.sv100_name)
                    Else
                        If (svrInfo.sv100_platform_id = "400") Then
                            networkComputers.Add(svrInfo.sv100_name)
                            'End If

                        End If
                    End If
                    ' If (svrInfo.sv100_name.Substring(0, 10)) = "DANB-HOMER" Then
                    'networkComputers.Add(svrInfo.sv100_name)
                    'End If
                Next
            End If
        Catch ex As Exception
            Console.WriteLine("Error getting network computers.")
        Finally
            NetApiBufferFree(buffer)
        End Try

        Return networkComputers
    End Function
#End Region

    ' Example Usage
    Public Sub getall()
        Dim networkComps As ArrayList = GetNetworkComputers()
        For Each Str As String In networkComps
            MsgBox(Str)
        Next

        'Next
    End Sub
0
 
LVL 11

Accepted Solution

by:
Khandakar Ashfaqur Rahman earned 125 total points
Comment Utility
arp -a command will only show those physical addresses which are already resolved.If any host has ICMP reply disabled by firewall can't be shown into ARP cache.

Most of the tools are ICMP based.If you ICMP scan into your network it might not be correct because some machines won't reply if ICMP is blocked by firewall.

However, I'd request you to use NMAP:
http://nmap.org/dist/nmap-5.51-setup.exe

If your network is 192.168.0.0/24 then:

Target: 192.168.0.0/24
Profile: Intense Scan No ping

You also can choose Intense Scan to determine about OS and device type and open ports.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Setting up SSH Cisco We are all told that you should not use Telent for connecting to devices because it is unsecure and all clear text. Much better is to use SSH, but it can seem a bit of a challenge setting it all up and especially in a small n…
The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now