Jump to content

Php Show Computer Info?


Recommended Posts


It is possible to show your own CPU info, RAM used/free/total using a program called Coolmon. However, all of the info gets put into an XML file which has to be parsed using PHP anyway. You might want to ask sven how to do this since I've seen him do it.

Not sure if this is what you want, though.

Link to comment
Share on other sites

There is a way to find out certain things by connecting to the WMI of the local machine, but you do need the admin access to the computer that you are using. I hope this atricle helps. I was looking for something of the same fashion and was able to query the local registry for the bios version. Here is some code to get a few things. But the following code does not connect to WMI, just registry reading.

<html>

<title>PHP Registry test...</title>

<body>

<?php

$shell = new COM("WScript.Shell") or die("Requires Windows Scripting Host");

$pack="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\CSDVersion";

$key="HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\SystemBiosDate";

$address="192.168.1.100";

$lash="\\";

$t = $shell->RegRead($key);

print "BIOS date:$t<br/>\n";

$r = $shell->RegRead($pack);

print "Service Pack:$r<br/>\n";

echo $lash.$lash.$address.$lash.$pack;

?>

</body>

</html>

Link to comment
Share on other sites

i have been able to do it with php 4 or something. i cant anymore.... its written on the coolmon website, but the script they give you doesn't work, its been outdated. and the one another person gave will only say teh first 3 lines (well, thats with my data). you will have to learn how to parse xml in php, im still looking for a guide.

Link to comment
Share on other sites

This may seem a little extreme, but I just grabbed all the basics, and put it into a simple vbs script for you. it is attached below. It is not the most elegent, but it will show you how to do all this. Then if you want to have it available from the web, just write a simple cgi script that call this, graps the output and drops it in a html file.

remember not to just run this from prompt you want to run it as

cscript first.vbs

otherwise you will get 100+ popup windows.

I made this becuase I grab all this info, run it througha special algorythim and then that it how i generate install keys for one of my products. Guarantees that the key is unique.

for some reason I cant add an attahment so here is the complete code. It will allow you to get just about anything that you want.

strComputer = "."
Wscript.Echo "***************************************************************"
Wscript.Echo "* List Computer Baseboard Properties                          *"
Wscript.Echo "***************************************************************"
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard")

For Each objItem in colItems
   For Each strOption in objItem.ConfigOptions
       Wscript.Echo "Configuration Option: " & strOption
   Next
   Wscript.Echo "Depth: " & objItem.Depth
   Wscript.Echo "Description: " & objItem.Description
   Wscript.Echo "Height: " & objItem.Height
   Wscript.Echo "Hosting Board: " & objItem.HostingBoard
   Wscript.Echo "Hot Swappable: " & objItem.HotSwappable
   Wscript.Echo "Manufacturer: " & objItem.Manufacturer
   Wscript.Echo "Model: " & objItem.Model
   Wscript.Echo "Name: " & objItem.Name
   Wscript.Echo "Other Identifying Information: " & _
       objItem.OtherIdentifyingInfo
   Wscript.Echo "Part Number: " & objItem.PartNumber
   Wscript.Echo "Powered-On: " & objItem.PoweredOn
   Wscript.Echo "Product: " & objItem.Product
   Wscript.Echo "Removable: " & objItem.Removable
   Wscript.Echo "Replaceable: " & objItem.Replaceable
   Wscript.Echo "Requirements Description: " & objItem.RequirementsDescription
   Wscript.Echo "Requires Daughterboard: " & objItem.RequiresDaughterBoard
   Wscript.Echo "Serial Number: " & objItem.SerialNumber
   Wscript.Echo "SKU: " & objItem.SKU
   Wscript.Echo "Slot Layout: " & objItem.SlotLayout
   Wscript.Echo "Special Requirements: " & objItem.SpecialRequirements
   Wscript.Echo "Tag: " & objItem.Tag
   Wscript.Echo "Version: " & objItem.Version
   Wscript.Echo "Weight: " & objItem.Weight
   Wscript.Echo "Width: " & objItem.Width
Next


Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* Enumerating Processor Information                           *"
Wscript.Echo "***************************************************************"
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")

For Each objItem in colItems
   Wscript.Echo "Address Width: " & objItem.AddressWidth
   Wscript.Echo "Architecture: " & objItem.Architecture
   Wscript.Echo "Availability: " & objItem.Availability
   Wscript.Echo "CPU Status: " & objItem.CpuStatus
   Wscript.Echo "Current Clock Speed: " & objItem.CurrentClockSpeed
   Wscript.Echo "Data Width: " & objItem.DataWidth
   Wscript.Echo "Description: " & objItem.Description
   Wscript.Echo "Device ID: " & objItem.DeviceID
   Wscript.Echo "External Clock: " & objItem.ExtClock
   Wscript.Echo "Family: " & objItem.Family
   Wscript.Echo "L2 Cache Size: " & objItem.L2CacheSize
   Wscript.Echo "L2 Cache Speed: " & objItem.L2CacheSpeed
   Wscript.Echo "Level: " & objItem.Level
   Wscript.Echo "Load Percentage: " & objItem.LoadPercentage
   Wscript.Echo "Manufacturer: " & objItem.Manufacturer
   Wscript.Echo "Maximum Clock Speed: " & objItem.MaxClockSpeed
   Wscript.Echo "Name: " & objItem.Name
   Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
   Wscript.Echo "Processor ID: " & objItem.ProcessorId
   Wscript.Echo "Processor Type: " & objItem.ProcessorType
   Wscript.Echo "Revision: " & objItem.Revision
   Wscript.Echo "Role: " & objItem.Role
   Wscript.Echo "Socket Designation: " & objItem.SocketDesignation
   Wscript.Echo "Status Information: " & objItem.StatusInfo
   Wscript.Echo "Stepping: " & objItem.Stepping
   Wscript.Echo "Unique Id: " & objItem.UniqueId
   Wscript.Echo "Upgrade Method: " & objItem.UpgradeMethod
   Wscript.Echo "Version: " & objItem.Version
   Wscript.Echo "Voltage Caps: " & objItem.VoltageCaps
Next


Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* List Motherboard Device Information                         *"
Wscript.Echo "***************************************************************"
Set colItems = objWMIService.ExecQuery("Select * from Win32_MotherboardDevice")

For Each objItem in colItems
   Wscript.Echo "Device ID: " & objItem.DeviceID
   Wscript.Echo "Primary Bus Type: " & objItem.PrimaryBusType
   Wscript.Echo "Secondary Bus Type: " & objItem.SecondaryBusType
   Wscript.Echo
Next


Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* Retrieving BIOS Information                                 *"
Wscript.Echo "***************************************************************"
Set colBIOS = objWMIService.ExecQuery _
   ("Select * from Win32_BIOS")

For each objBIOS in colBIOS
   Wscript.Echo "Build Number: " & objBIOS.BuildNumber
   Wscript.Echo "Current Language: " & objBIOS.CurrentLanguage
   Wscript.Echo "Installable Languages: " & objBIOS.InstallableLanguages
   Wscript.Echo "Manufacturer: " & objBIOS.Manufacturer
   Wscript.Echo "Name: " & objBIOS.Name
   Wscript.Echo "Primary BIOS: " & objBIOS.PrimaryBIOS
   Wscript.Echo "Release Date: " & objBIOS.ReleaseDate
   Wscript.Echo "Serial Number: " & objBIOS.SerialNumber
   Wscript.Echo "SMBIOS Version: " & objBIOS.SMBIOSBIOSVersion
   Wscript.Echo "SMBIOS Major Version: " & objBIOS.SMBIOSMajorVersion
   Wscript.Echo "SMBIOS Minor Version: " & objBIOS.SMBIOSMinorVersion
   Wscript.Echo "SMBIOS Present: " & objBIOS.SMBIOSPresent
   Wscript.Echo "Status: " & objBIOS.Status
   Wscript.Echo "Version: " & objBIOS.Version
   For i = 0 to Ubound(objBIOS.BiosCharacteristics)
       Wscript.Echo "BIOS Characteristics: " & _
           objBIOS.BiosCharacteristics(i)
   Next
Next


Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* List SMBIOS Information                                     *"
Wscript.Echo "***************************************************************"
Set colSMBIOS = objWMIService.ExecQuery _
   ("Select * from Win32_SystemEnclosure")

For Each objSMBIOS in colSMBIOS
   Wscript.Echo "Part Number: " & objSMBIOS.PartNumber
   Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
   Wscript.Echo "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
Next

Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* List Video Adapter Information                              *"
Wscript.Echo "***************************************************************"
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
   ("Select * from Win32_DisplayControllerConfiguration")

For Each objItem in colItems
   Wscript.Echo "Bits Per Pixel: " & objItem.BitsPerPixel
   Wscript.Echo "Color Planes: " & objItem.ColorPlanes
   Wscript.Echo "Device Entries in a Color Table: " & _
       objItem.DeviceEntriesInAColorTable
   Wscript.Echo "Device Specific Pens: " & objItem.DeviceSpecificPens
   Wscript.Echo "Horizontal Resolution: " & objItem.HorizontalResolution
   Wscript.Echo "Name: " & objItem.Name
   Wscript.Echo "Refresh Rate: " & objItem.RefreshRate
   Wscript.Echo "Setting ID: " & objItem.SettingID
   Wscript.Echo "Vertical Resolution: " & objItem.VerticalResolution
   Wscript.Echo "Video Mode: " & objItem.VideoMode
   Wscript.Echo
Next

Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* List Keyboard Properties                                    *"
Wscript.Echo "***************************************************************"
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Keyboard")
For Each objItem in colItems
   Wscript.Echo "Caption: " & objItem.Caption
   Wscript.Echo "Description: " & objItem.Description
   Wscript.Echo "Device ID: " & objItem.DeviceID
   Wscript.Echo "Is Locked: " & objItem.IsLocked
   Wscript.Echo "Layout: " & objItem.Layout
   Wscript.Echo "Name: " & objItem.Name
   Wscript.Echo "Number of Function Keys: " & objItem.NumberOfFunctionKeys
   Wscript.Echo "Password: " & objItem.Password
   Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
Next

Wscript.Echo
Wscript.Echo "***************************************************************"
Wscript.Echo "* List Physical Disk Properties                               *"
Wscript.Echo "***************************************************************"
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDiskDrives = objWMIService.ExecQuery _    
   ("Select * from Win32_DiskDrive")

For each objDiskDrive in colDiskDrives
   Wscript.Echo "Bytes Per Sector: " & vbTab &  _
       objDiskDrive.BytesPerSector        
   For i = Lbound(objDiskDrive.Capabilities) to _
       Ubound(objDiskDrive.Capabilities)
       Wscript.Echo "Capabilities: " & vbTab &  _
           objDiskDrive.Capabilities(i)
   Next    
   Wscript.Echo "Caption: " & vbTab &  objDiskDrive.Caption
   Wscript.Echo "Description: " & vbTab & objDiskDrive.Description
   Wscript.Echo "Device ID: " & vbTab &  objDiskDrive.DeviceID
   Wscript.Echo "Index: " & vbTab &  objDiskDrive.Index
   Wscript.Echo "Interface Type: " & vbTab & objDiskDrive.InterfaceType
   Wscript.Echo "Manufacturer: " & vbTab & objDiskDrive.Manufacturer
   Wscript.Echo "Media Loaded: " & vbTab  & objDiskDrive.MediaLoaded
   Wscript.Echo "Media Type: " & vbTab &  objDiskDrive.MediaType
   Wscript.Echo "Model: " & vbTab &  objDiskDrive.Model
   Wscript.Echo "Name: " & vbTab &  objDiskDrive.Name
       Set colPhysicalMedia = objWMIService.ExecQuery _
           ("Select * from Win32_PhysicalMedia")
       For each objPhysicalMedia in colPhysicalMedia
           If objDiskDrive.Name = objPhysicalMedia.Tag Then
               Wscript.Echo "SerialNumber: " & vbTab & objPhysicalMedia.SerialNumber
           End if
       Next  
   Wscript.Echo "Partitions: " & vbTab & objDiskDrive.Partitions
   Wscript.Echo "PNP DeviceID: " & vbTab &  objDiskDrive.PNPDeviceID
   Wscript.Echo "SCSI Bus: " & vbTab &  objDiskDrive.SCSIBus
   Wscript.Echo "SCSI Logical Unit: " & vbTab &  _
       objDiskDrive.SCSILogicalUnit
   Wscript.Echo "SCSI Port: " & vbTab &  objDiskDrive.SCSIPort
   Wscript.Echo "SCSI TargetId: " & vbTab &  objDiskDrive.SCSITargetId    
   Wscript.Echo "Sectors Per Track: " & vbTab &  _
       objDiskDrive.SectorsPerTrack        
   Wscript.Echo "Signature: " & vbTab &  objDiskDrive.Signature          
   Wscript.Echo "Size: " & vbTab &  objDiskDrive.Size    
   Wscript.Echo "Status: " & vbTab &  objDiskDrive.Status        
   Wscript.Echo "Total Cylinders: " & vbTab &  _
       objDiskDrive.TotalCylinders        
   Wscript.Echo "Total Heads: " & vbTab &  objDiskDrive.TotalHeads    
   Wscript.Echo "Total Sectors: " & vbTab &  objDiskDrive.TotalSectors
   Wscript.Echo "Total Tracks: " & vbTab &  objDiskDrive.TotalTracks
   Wscript.Echo "Tracks Per Cylinder: " & vbTab &  _
       objDiskDrive.TracksPerCylinder  
Next

Sorry it is so big, just wanted you to have everything.

Link to comment
Share on other sites

you dont have to, just have php capture the output from running that command.

you can use http://us2.php.net/shell_exec to capture the output from that command. Then just drop it in a <pre> and your are set. BUT remember this is not server side. this has to be run from the CLIENT. Pointer1 showed about all you can get from the server. the rest has to be run from the client. If you want, you could always write an applet, or activex control, that could query the registry, that way you could get all the information that you wanted.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...