0

I'm developing small app using visual studio 2013, VB to scan range of IP addresses in same network

my app will take IP's and return

Ping status (True or False)

Computer Name

MAC address

and all OK

my question is if i need to get remote computer windows (xp or 7 or 8 )

using IP address or computer name how i can do that?

E R
  • 480
  • 1
  • 8
  • 20

3 Answers3

0
Dim osVer As String
osVer = System.Environment.OSVersion.ToString
CodeBrewer
  • 15
  • 1
  • 9
  • That's true for the current process/computer running the code, I think OP needs to be able to derive that based solely from an IP address – KyleMit May 11 '18 at 20:48
0

Finally I used system management as below

(after importing System.Management)

I used two Functions

first one to connect remote Computer then collect data

Private Function tryConnect(SystemName As String)
        Try
            Dim ComputerConnection As New System.Management.ConnectionOptions
            ' to add user name and password
            'ComputerConnection.Username = "UserName"
            'ComputerConnection.Password = "Password"

            With ComputerConnection
                .Impersonation = System.Management.ImpersonationLevel.Impersonate
                .Authentication = System.Management.AuthenticationLevel.Packet

            End With
            'connect to WMI
            MyMgtScope = New System.Management.ManagementScope("\\" & SystemName & "\root\CIMV2", ComputerConnection)
            MyMgtScope.Connect()
            Return MyMgtScope.IsConnected
        Catch ex As Exception
            Return False
        End Try
End Function

private sub GetOsdata()
    if tryConnect(remoteComputerName) = False then Exit Sub ' or show some message
    Dim MyMgtScope As System.Management.ManagementScope
    Dim MyObjSearcher As System.Management.ManagementObjectSearcher
    Dim MyColl As System.Management.ManagementObjectCollection
    Dim MyObj As System.Management.ManagementObject
    Dim ComputerOSVersion , ComputerOSServiceBack ,OSbit As String
    MyObjSearcher = New System.Management.ManagementObjectSearcher(MyMgtScope.Path.ToString, "Select * FROM Win32_OperatingSystem")
                ' Execute the query
    MyColl = MyObjSearcher.Get
                For Each MyObj In MyColl
                    ComputerOSVersion = MyObj.GetPropertyValue("Caption").ToString
                    ComputerOSServiceBack = MyObj.GetPropertyValue("ServicePackMajorVersion").ToString
                    OSbit = MyObj.GetPropertyValue("OSArchitecture").ToString
               Next

               MyObjSearcher = Nothing
               MyColl = Nothing
End Sub
E R
  • 480
  • 1
  • 8
  • 20
-1
   Using wClient As New WebClient
                   dim myip as string = wClient.DownloadString("http://tools.feron.it/php/ip.php")

                End Using

maybe help for find ip easly. good luck

  • The OP wants to get a remote computer's _Windows version_ by specifying its IP or hostname. This code only gets his/her public IP. – Visual Vincent May 13 '18 at 09:31