• HEXUS
  • HEXUS.tv
  • channel
  • gaming
  • lifestyle
  • trust
  • community
  • ESReality
  • HEXUS.community discussion forumsVisit Corsair.com

    Welcome to the HEXUS.community discussion forums forums.

    You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Operating systems & applications > Software and web development

    Software and web development Databases, graphics, programming, scripting and web development.

    Reply
     
    LinkBack Thread Tools
    Old 25-02-2005, 12:24 AM   #17 (permalink)
    bored out of my tiny mind
     
    malfunction's Avatar
     
    Join Date: Jul 2003
    Location: Berkshire
    Posts: 3,029
    Thanks: 56
    Thanked 58 Times in 50 Posts
    malfunction's system
    Well there's no reason why you couldn't just use vbscript to do the whole thing anyway... Or even just a simple batch file to pipe the output of ipconfig/all to a file - e.g

    ipconfig /all >c:\ipconfig.txt

    Though if you use something like WMI you could also collect other info (OS version for example)... It would be more work but a better way might be to produce an ISP style dial up / access CD (or just a program) that you can hand out to students that basically requires them to only:

    1) Get the program on the PC (e.g. insert CD)
    2) Program autoruns if possible
    3) Program asks for validated user id / password (printed separately)
    4) These are submitted to some kind of 'public' / DMZ part of the uni's infrastructure and if they are accepted the program then uploads the MAC address, etc and configures the client PC as appropriate

    Just a thought anyway
    malfunction is offline   Reply With Quote
    Old 25-02-2005, 12:25 PM   #18 (permalink)
    Member
     
    Join Date: Oct 2003
    Posts: 93
    Thanks: 0
    Thanked 0 Times in 0 Posts
    Originally Posted by malfunction
    Well there's no reason why you couldn't just use vbscript to do the whole thing anyway... Or even just a simple batch file to pipe the output of ipconfig/all to a file - e.g

    ipconfig /all >c:\ipconfig.txt

    Though if you use something like WMI you could also collect other info (OS version for example)... It would be more work but a better way might be to produce an ISP style dial up / access CD (or just a program) that you can hand out to students that basically requires them to only:

    1) Get the program on the PC (e.g. insert CD)
    2) Program autoruns if possible
    3) Program asks for validated user id / password (printed separately)
    4) These are submitted to some kind of 'public' / DMZ part of the uni's infrastructure and if they are accepted the program then uploads the MAC address, etc and configures the client PC as appropriate

    Just a thought anyway
    Yes that's why I was looking at using WSH & WMI in the first place- to collect this information on user's machines. I don't mind using WSH to dump the output of IPconfig into a file and then using VB to go through and extract the info I want (as this seems to work with all versions of Windows). I just dont know how to actually make that happen in VB...
    clipse is offline   Reply With Quote
    Old 27-02-2005, 03:58 PM   #19 (permalink)
    Member
     
    Join Date: Oct 2003
    Posts: 93
    Thanks: 0
    Thanked 0 Times in 0 Posts
    Ok I give up trying to make this damn thing work in VB6. Could a Java applet return the local mac address, IP address etc? as I have an idea for a nice clean implementation if it does.

    Thanks
    clipse is offline   Reply With Quote
    Old 08-03-2005, 01:25 PM   #20 (permalink)
    Registered+
     
    Join Date: May 2004
    Location: Newcastle
    Posts: 42
    Thanks: 0
    Thanked 1 Time in 1 Post
    Brodieman's system
    Okay you have an issue with your code...

    You'll kick yourself tbh...

    why are you using
    Wscript.Echo "Index: " & objItem.Index?
    Wscript is an object of WSH and echo is one of it's methods....

    repleace wscript.echo with well
    msgbox or something along the lines of
    dim strNetworkInfo

    strNetworkInfo = ""
    strNetworkInfo = "Index: " & objItem.Index & vbcr + vblf
    strNetworkInfo = strNetworkInfo & "Manufacturer: " & objItem.Manufacturer

    msgbox strNetworkInfo
    etc etc etc.... let me know if this works for you.. if not i'll have a play...

    As regarding it not displaying Windows ME info.... well what do you expect...
    You are getting information from the machines WMI and the version is slightly different... you should however beable to get most of the information..

    Hope this helps...

    That is if your still working on it...

    BTW if you want a good book on this you may want to get hold of the Microsoft Press Scripting book... would give you the exact name but i lent it to a sysadmin mate about 3 months back....

    Good luck

    If it don't work.. let me know and i'll see if I can put an app toegther for you with comments etc etc so you can see what I did.

    Last edited by Brodieman; 08-03-2005 at 01:43 PM..
    Brodieman is offline   Reply With Quote
    Old 08-03-2005, 07:01 PM   #21 (permalink)
    Registered+
     
    Join Date: May 2004
    Location: Newcastle
    Posts: 42
    Thanks: 0
    Thanked 1 Time in 1 Post
    Brodieman's system
    Okay I've developed a little app....

    I got it fully work.. any issues let me know.

    Cheers

    Stu

    **************************8

    Open notepad
    Save the below text in a file called frmMain.frm

    Code:
    VERSION 5.00
    Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
    Begin VB.Form frmMain 
       Caption         =   "Nexus Demo: Network Adaptor Test"
       ClientHeight    =   3495
       ClientLeft      =   60
       ClientTop       =   450
       ClientWidth     =   5880
       LinkTopic       =   "Form1"
       ScaleHeight     =   3495
       ScaleWidth      =   5880
       StartUpPosition =   3  'Windows Default
       Begin VB.Frame fraDetails 
          Caption         =   "Results"
          Height          =   2415
          Left            =   120
          TabIndex        =   1
          Top             =   960
          Width           =   5655
          Begin MSComctlLib.ListView lstvResults 
             Height          =   2055
             Left            =   120
             TabIndex        =   5
             Top             =   240
             Width           =   5415
             _ExtentX        =   9551
             _ExtentY        =   3625
             View            =   3
             LabelWrap       =   -1  'True
             HideSelection   =   -1  'True
             AllowReorder    =   -1  'True
             FullRowSelect   =   -1  'True
             GridLines       =   -1  'True
             _Version        =   393217
             ForeColor       =   -2147483640
             BackColor       =   -2147483643
             BorderStyle     =   1
             Appearance      =   1
             NumItems        =   0
          End
       End
       Begin VB.Frame fraComputer 
          Height          =   735
          Left            =   120
          TabIndex        =   0
          Top             =   120
          Width           =   5655
          Begin VB.CommandButton cmdRun 
             Caption         =   "&Run"
             Height          =   255
             Left            =   4920
             TabIndex        =   4
             Top             =   240
             Width           =   615
          End
          Begin VB.TextBox txtComputerName 
             Height          =   285
             Left            =   1560
             TabIndex        =   3
             Text            =   "."
             Top             =   240
             Width           =   3135
          End
          Begin VB.Label lblComputerName 
             Caption         =   "Computer Name:"
             Height          =   255
             Left            =   120
             TabIndex        =   2
             Top             =   240
             Width           =   1335
          End
       End
    End
    Attribute VB_Name = "frmMain"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub cmdRun_Click()
    
    On Error GoTo Errorhandler
    
        Screen.MousePointer = vbHourglass
        
        Dim strAdaptertype As String
        
        ClearData
        
        strComputer = txtComputerName.Text      ' name of the computer we are going to query the WMI of..
                                                ' You could if you have network Admin permissions of the machine
                                                ' enter a remote computer name...
                                                ' WMI can actually be used for a lot of things
                                                
        Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                                                ' Creating the object to connect to the WMI
                                                ' repository, including where in the WMI you are connecting to
    
        Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
                                                ' Querying the WMI repository, table being the Win32_NetworkAdaptor
    
        
        For Each objitem In colItems
        
            With objitem
        
                If Not IsNull(.MACAddress) Then
    
                Select Case .AdapterTypeID
                    Case Is = 0
                        strAdaptertype = "Ethernet 802.3"
                    Case Is = 1
                        strAdaptertype = "Token Ring 802.5"
                    Case Is = 2
                        strAdaptertype = "Fiber Distributed Data Interface (FDDI)"
                    Case Is = 3
                        strAdaptertype = "Wide Area Network (WAN)"
                    Case Is = 4
                        strAdaptertype = "LocalTalk"
                    Case Is = 5
                        strAdaptertype = "Ethernet using DIX header format"
                    Case Is = 6
                        strAdaptertype = "ARCNET"
                    Case Is = 7
                        strAdaptertype = "ARCNET (878.2)"
                    Case Is = 8
                        strAdaptertype = "ATM"
                    Case Is = 9
                        strAdaptertype = "Wireless"
                    Case Is = 10
                        strAdaptertype = "Infrared Wireless"
                    Case Is = 11
                        strAdaptertype = "Bpc"
                    Case Is = 12
                        strAdaptertype = "CoWan"
                    Case Is = 13
                        strAdaptertype = "1394"
                    Case Else
                        strAdaptertype = "Unknown"
                End Select
     
                Set itmX = frmMain.lstvResults.ListItems.Add(, , strAdaptertype) ' Add the Adapter Type a first element
                itmX.SubItems(1) = .AdapterTypeID       ' Add the Adapter Type ID as the second element
                itmX.SubItems(2) = .AutoSense           ' Add more details... list goes on
                itmX.SubItems(3) = .Description         ' Not all of the information
                itmX.SubItems(4) = .DeviceID            ' will be added as it's not
                itmX.SubItems(5) = .Index               ' neccessarily been implemented
                itmX.SubItems(6) = .MACAddress          ' by microsoft or manufacturers yet....
                itmX.SubItems(7) = .Manufacturer        ' but over time it probably will be
                itmX.SubItems(8) = .MaxNumberControlled ' Information relating to this query can be found at
                itmX.SubItems(9) = .MaxSpeed            ' http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_networkadapter.asp
                itmX.SubItems(10) = .Name               ' Regardless of what overs thing MSDN is your friend
                itmX.SubItems(11) = .NetConnectionID    ' As is google
                itmX.SubItems(12) = .NetConnectionStatus
                itmX.SubItems(13) = .NetworkAddresses
                itmX.SubItems(14) = .PermanentAddress
                itmX.SubItems(15) = .PNPDeviceID
                itmX.SubItems(16) = .ProductName
                itmX.SubItems(17) = .ServiceName
                itmX.SubItems(18) = .Speed
                    
                End If
                
            End With
        Next
     
     
        With lstvResults
            .SortKey = 0                                ' Just sorting the data in the list view, by the Adapter Type
            .Sorted = True                              ' This should put just the 803.2 devices at the top of the list.
            .SortOrder = lvwAscending
       End With
    
        Screen.MousePointer = 0
    Exit Sub
    
    Errorhandler:
    
        If Err.Number = 0 Then
            'no error..
            Exit Sub
        
        ElseIf Err.Number = 13 Then
            Resume Next
        
        ElseIf Err.Number = 92 Then
            Resume Next
        
        Else
            ' unknown error or error that's not handled atm
            MsgBox "An unknown error or an unhandled error has been detected! " & vbCr + vbLf & _
            "Contact your Systems Administrator" & vbCr + vbLf & _
             vbCr + vbLf & _
            "Error Number: " & Err.Number & vbCr + vbLf & _
            "Error Source: " & Err.Source & vbCr + vbLf & _
            "Error Description " & Err.Description _
            , vbExclamation + vbOKOnly, "Error"
            Screen.MousePointer = 0
            Exit Sub
        
        End If
    End Sub
    Private Sub LoadListView()
            
        ' Adding colums to the listview
        With lstvResults
            ClearData
            .ColumnHeaders.Clear
            
            .ColumnHeaders.Add , , "Adapter Type"
            .ColumnHeaders.Add , , "Adapter Type ID"
            .ColumnHeaders.Add , , "Auto Sense"
            .ColumnHeaders.Add , , "Description"
            .ColumnHeaders.Add , , "Device ID"
            .ColumnHeaders.Add , , "Index"
            .ColumnHeaders.Add , , "MAC Address"
            .ColumnHeaders.Add , , "Manufacturer"
            .ColumnHeaders.Add , , "Max Number Controlled"
            .ColumnHeaders.Add , , "Max Speed"
            .ColumnHeaders.Add , , "Name"
            .ColumnHeaders.Add , , "Net Connection ID"
            .ColumnHeaders.Add , , "Net Connection Status"
            .ColumnHeaders.Add , , "Network Addresses"
            .ColumnHeaders.Add , , "Permanent Address"
            .ColumnHeaders.Add , , "PNP Device ID"
            .ColumnHeaders.Add , , "Product Name"
            .ColumnHeaders.Add , , "Service Name"
            .ColumnHeaders.Add , , "Speed"
            .View = lvwReport
            .Sorted = False
            
        End With
    End Sub
    
    Private Sub ClearData()
    
        lstvResults.ListItems.Clear
    End Sub
    
    Private Sub Form_Load()
    
        LoadListView
        
    End Sub
    
    Private Sub lstvResults_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
    
        With lstvResults
            .SortKey = ColumnHeader.Index - 1
            .Sorted = True
            If .SortOrder = lvwAscending Then
                .SortOrder = lvwDescending
            Else
                .SortOrder = lvwAscending
            End If
        End With
        
    
    End Sub
    
    Make sure you have the "Microsoft Windows Common Control 6.0 SP4" or above added for the list view to work properly
    Brodieman is offline   Reply With Quote
    Reply

    Breadcrumb
    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Operating systems & applications > Software and web development


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Trackbacks are On
    Pingbacks are On
    Refbacks are On


    Similar Threads
    Thread Thread Starter Forum Replies Last Post
    hijackthis help carrcn Help - technical & advisory 15 30-08-2004 05:52 PM



    All times are GMT. The time now is 04:43 PM.

    Any representations/statements made on the HEXUS.community discussion forums are the representations/statements of the author i.e. the person/organisation making them. If any such representations/statements are disputed they are a matter between the parties concerned.
    HEXUS Limited accepts no responsibility for any misrepresentations, inaccurate or false statements made by any person/organisation other than HEXUS Limited employees.
    For more information please read HEXUS Limited's terms, conditions and privacy policy.

    Hosted Exchange

    Powered by vBulletin® Version 3.8.4
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Content Relevant URLs by vBSEO 3.3.2
    © Copyright 2009 HEXUS® Limited. All rights reserved. Unauthorised reproduction strictly prohibited.