locked
help parse all drives within a local network using VB.Net 2012 RRS feed

  • Question

  • Hi I've been working on a small utility application that scans all the fixed drives on a PC to find a specific application, returning version information etc. using code similar to the following

    Dim driveList as List(Of String) = new List(Of String)
    
    for each iDrive as DriveInfo in DriveInfo.GetDrives()
     if iDrive.IsReady and iDrive.Type = DriveType.Fixed Then
    driveList.Add(drive.name + "   " + sizeToString(drive.TotalSize))
     End If
    Next

    I'm now looking to expand this functionality to return the same information for every PC connected to our company network!

    I am able to get a list of PC names using the following

    Dim compList As List(Of String) = New List(Of String)
    Dim ipProperties As NetworkInformation.IPGlobalProperties = NetworkInformation.IPGlobalProperties.GetIPGlobalProperties()
    
    Dim domain As String = ipProperties.DomainName
    Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain)
    domainEntry.Children.SchemaFilter.Add("computer")
    
    For Each computer As DirectoryEntry In domainEntry.Children
      If computer.Name IsNot Nothing Then compList.Add(computer.Name)
    Next

    I can't figure out how to use this to get a list of the drives each PC has or for that matter how to find if a specific folder and application is installed and what version?

    I can only get my code working on the local PC, I'd like to pass 'Environment.UserDomainName\.Environment.MacineName' or similar to get a list of drives!

    Any Ideas or assistance would be appreciated,

    I've searched the NET but nothing I've found appears to be of any help

    Thanks


    Monday, September 4, 2017 11:11 AM

All replies

  • With VB you have no access to all trials which has Microsoft taken to speed up and make more reliable the searches for files. (And in my perception they still did not succeed).

    Therefore simple, don't try it. 


    Success
    Cor


    Monday, September 4, 2017 1:06 PM
  • Seems a bit pointless being able to see all the PCs on a local network if you can't get any information from them i.e.

    Hardware Manufacturer, Model, CPU, Memory, Drives etc.

    OS Name, Version, Platform etc.

    Specific Installed Software Office, Virus Checker, VMware versions etc.

    The software I have already collects all this data from the local running machine, but I'd like to expand this to process all the remote machines on our company network too.

    Tuesday, September 5, 2017 2:10 PM
  • How about using WMI?
    Tuesday, September 5, 2017 2:14 PM
  • How about using WMI?

    RLWA, that is what he does probably, but with that you can not use over a LAN. Or it should be with Terminal Service but I'm sure that is not meant. 

    Only the AD can give some information. Despite that it started a long ago with all kind of marketing slogans that what Alan asked could be reached. I think it never was. 

    However, it is not something which you can solve with VB. 


    Success
    Cor


    Tuesday, September 5, 2017 2:58 PM
  • RLWA, that is what he does probably, but with that you can not use over a LAN. Or it should be with Terminal Service but I'm sure that is not meant. 

    Maybe I'm misunderstanding, but the documentation seems to ndicate that WMI can be used to query remote systems (assuming all the necessary configuration has been done).  See Connecting to WMI on a Remote Computer
    Tuesday, September 5, 2017 3:10 PM
  • RLWA, that is what he does probably, but with that you can not use over a LAN. Or it should be with Terminal Service but I'm sure that is not meant. 

    Maybe I'm misunderstanding, but the documentation seems to ndicate that WMI can be used to query remote systems (assuming all the necessary configuration has been done).  See Connecting to WMI on a Remote Computer
    Yea that is what I did mean with Terminal Service

    Success
    Cor

    Tuesday, September 5, 2017 3:49 PM
  • The below link has a WMI project that should help:

    https://www.codeproject.com/Articles/286994/Use-WMI-to-obtain-remote-computer-details-Memory-d

    Pretty sure you can query non physical drive types, although you may need to add that to the code.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, September 5, 2017 5:03 PM
  • @ Paul P Clement IV,

    I think using WMI is a good idea.
    I've tried "Computer_Details.exe" which is in the place you suggested, and found X on Permission.
        
    Could you kindly suggest how to get permission of remote computers by WMI. 

    Best regards,

    Ashidacchi


    • Edited by Ashidacchi Friday, September 8, 2017 1:00 AM
    Friday, September 8, 2017 12:57 AM
  • I think using WMI is a good idea.
    I've tried "Computer_Details.exe" which is in the place you suggested, and found X on Permission. 
    Could you kindly suggest how to get permission of remote computers by WMI. 


    You'll need to read this stuff - Setting up a Remote WMI Connection
    Friday, September 8, 2017 1:01 AM
  • @ RLWA32,

    Thank you for your quick response.
    I will read the article you suggested. Thank you again.

    Best regards,

    Ashidacchi

    Friday, September 8, 2017 1:07 AM