I am trying to build a PC inventory program in php. To keep better track of my computers. but I don't know how to call to the information using php for example-- hard drive, memory, cdroms, video cards, network card, etc. If any one could get me started in the right direction I would greatly appricate it

Thanks,

jjwalker

    MySQL databases are one of the most usefull things (in my opinion) available in PHP. They allow you to store and retrieve all kinds data. Read this tutorial and you should be able to get started.

      I would like my script to get the data automaticly and then push it to the mysql database. I know how to push the data to the mysql database but I don't know how to get the data. I want to know if there any functions, classes, or code that can do that.

      Thanks,

      jjwalker 🙂

        Originally posted by jjwalker
        I would like my script to get the data automaticly and then push it to the mysql database. I know how to push the data to the mysql database but I don't know how to get the data. I want to know if there any functions, classes, or code that can do that.

        It's very possible, however, not with PHP. You can use WMI/WSH/VBScript in ASP on an IIS server to query Windows based machines and pull hardware/software information. I don't believe those types of scripts will run on anything other than IIS.

          I'm pretty sure that php can't do that. Could you imagine surfing to a web site and them being able to get all that information about your computer automatically?

            Originally posted by drawmack
            I'm pretty sure that php can't do that. Could you imagine surfing to a web site and them being able to get all that information about your computer automatically?

            I actually developed a site that does exactly that -- using NTLM authentication. We enter in the hostname of the PC and it pulls up asset and hardware information, current user and their processes, installed hotfixes, and installed software.

            It run on IIS on a Win2K3 server -- very nifty.

              That is what I am looking to do can you point me in the right direction? like what I have to do to get started and where I can find documentation.

              Thanks,

              jjwalker 😃

                If you're not familliar with it, pick up an ASP book, and a book on WMI Scripting. Microsoft's Scriptomatic is also a handy tool. 🙂

                Here's an example of my script that pulls information such as serial number, memory, disk size, make and model of the PC:

                <table class="ContentTable" cellspacing="3" cellpadding="3">
                <tr><th colspan="2">Asset Information</th></tr>
                <%
                Set colItems = objWMI.ExecQuery("Select Caption, BuildNumber, ServicePackMajorVersion, ServicePackMinorVersion from Win32_OperatingSystem",,48)
                For Each objItem in colItems
                Response.Write "<tr class=ContentResult1>"
                Response.Write "<td>OS</td><td>" & objItem.Caption & " (Build " & objItem.BuildNumber & ") (Service Pack " & objItem.ServicePackMajorVersion & "." & objItem.ServicePackMinorVersion & ")</td>"
                Response.Write "</tr>"
                Next

                Set colItems = objWMI.ExecQuery("Select Vendor, Name, IdentifyingNumber from Win32_ComputerSystemProduct",,48)
                For Each objItem in colItems
                Response.Write "<tr class=ContentResult2>"
                Response.Write "<td>Vendor</td><td>" & objItem.Vendor & "</td>"
                Response.Write "</tr><tr class=ContentResult1>"
                Response.Write "<td>Name</td><td>" & objItem.Name & "</td>"
                Response.Write "</tr><tr class=ContentResult2>"
                Response.Write "<td>Serial</td><td>" & objItem.IdentifyingNumber & "</td>"
                Response.Write "</tr>"
                Next

                Set colItems = objWMI.ExecQuery("Select Name from Win32_Processor",,48)
                For Each objItem in colItems
                Response.Write "<tr class=ContentResult1>"
                Response.Write "<td>CPU</td><td>" & Trim(objItem.Name) & "</td>"
                Response.Write "</tr>"
                Next

                Set colItems = objWMI.ExecQuery("Select Size from Win32_DiskDrive",,48)
                For Each objItem in colItems
                objItem.Size = objItem.Size / 1048576
                objItem.Size = Int(objItem.Size)
                Response.Write "<tr class=ContentResult2>"
                Response.Write "<td>HD Size</td><td>" & objItem.Size & " (Megabytes)</td>"
                Response.Write "</tr>"
                Next

                Set colItems = objWMI.ExecQuery("Select TotalPhysicalMemory from Win32_LogicalMemoryConfiguration",,48)
                For Each objItem in colItems
                objItem.TotalPhysicalMemory = objItem.TotalPhysicalMemory / 1024
                objItem.TotalPhysicalMemory = Int(objItem.TotalPhysicalMemory)
                Response.Write "<tr class=ContentResult1>"
                Response.Write "<td>RAM</td><td>" & objItem.TotalPhysicalMemory & " (Megabytes)</td>"
                Response.Write "</tr>"
                Next

                Set colItems = objWMI.ExecQuery("Select Name from Win32_NetworkAdapter",,48)
                For Each objItem in colItems
                If(InStr(objItem.Name, "WAN") = 0 And InStr(objItem.Name, "RAS") = 0 And InStr(objItem.Name, "Parallel") = 0) Then
                Response.Write "<tr class=ContentResult2>"
                Response.Write "<td>NIC</td><td>" & objItem.Name & "</td>"
                Response.Write "<tr>"
                End If
                Next

                Set colItems = objWMI.ExecQuery("Select * from Win32_Printer",,48)
                For Each objItem in colItems
                Response.Write "<tr class=ContentResult1>"
                Response.Write "<td>Printer</td><td>" & objItem.Name & " (" & objItem.DeviceID & ")</td>"
                Response.Write "</tr>"
                Next

                Set colItems = Nothing
                Set objItem = Nothing
                %>
                </table>

                  Write a Reply...