zag Posted October 17, 2013 Posted October 17, 2013 Thanks to FN-GM for the initial VBS script from this thread This PHP web frontend just shows a list of all the computers on your network with icons and stuff. Features - Shows Computer Name - Shows Computer Manufacturer Brand Logo - Shows RAM/HDD/CPU - Shows red warning when hard disk under 10gb - Shows CPU icon - Shows SSD or HDD icon Instructions If you have a CSV already created from the above vbs script, just copy it to the /CSV folder to see it working. Otherwise read the instructions in the readme file. Source GitHub Screenshots 2
sted Posted October 17, 2013 Posted October 17, 2013 oooh ive been meaning to look into that for my own similar script would it be possible to alter it myself or would you be willing to have a look (again mine pulls to csv but i suspect in different orders and quite possibly different info (it also writes to the description field in ad))
zag Posted October 17, 2013 Author Posted October 17, 2013 Yeh its all configurable, there is a settings.php file you can choose a few basic options. Otherwise just change the $data variable to the field you want to see. I'll make an extra page for networking data such as MAC + IP soon. Then maybe an asset page which will show the Serial number and model. 1
sted Posted October 17, 2013 Posted October 17, 2013 if it helps my scripy collects if it saves you from altering yours WIN81-01 Hewlett-Packard - Compaq 610 Intel® Core2 Duo CPU T5870 @ 2.00GHz 3072 MB 297 GB 281 GB serial no Microsoft Windows 8.1 Enterprise sp 0 00:00:00:00:00:00 Overall -0 - CPU - 0 - Memory - 0 - Graphics - 0 - Gaming graphics - 0 - hdd - 0 user 100 Mbps-54 Mbps- 16/10/2013
edutech4schools Posted October 17, 2013 Posted October 17, 2013 @sted - let me know if you add this to your script, as that is the one I have used.
sted Posted October 17, 2013 Posted October 17, 2013 im going to have a go when i get time i suspect next week depends if i want to work outside work
SovietRussia Posted October 17, 2013 Posted October 17, 2013 I built a whole suite of PC and Network Management tools, the Devices tab runs through AD and grabs the devices, then uses WMI to update them, also pings them to check servers are online etc.
zag Posted October 17, 2013 Author Posted October 17, 2013 That looks cool @SovietRussia but I prefer web stuff myself. I've just commited some changes to add an Assets page and a Network page. No more searching for MAC addresses yey!
sted Posted October 23, 2013 Posted October 23, 2013 right been having a play using my script as input. Initial tests say it works fine (by initial ive copy and pasted my data into the example sheet) so in theory all i need to do is alter the $name=$data[3] to match my output but the provided script was writen to ignore column 1 (and everything else seems to be ofset by 1 (so to read collumn 3 you tell it to read collumn 4) it is probably just a case of altering the output of my scriptto more closely match (or if im being really lazy insert blank colums so it exactly matches which actually may be a better idea incase zag updates it it should then just work still) My main issue is atm my script generates 1 file per pc rather than one file total so i would need to alter that (but im of a mind to leave my 1 file for pc as well just have it make 2 files) also minor issue i tried to add a toshiba icon to serttings but it just keeps telling me the file is open even with iis stopped any way round this? (sorry i dont use iis much and it probably dosent help im running it on a win7 box for testing)
sted Posted October 23, 2013 Posted October 23, 2013 right rigged my script to deliver its output in the same format as the included one. What i cant work out atm is 1. how to get it to write one file for lots of pcs without ending up with the same machine on multiple lines everytime the script runs 2. how to get vbs to make a 2nd file (my script has info i want the enclosed one dosent detect and vice versa)
sted Posted October 24, 2013 Posted October 24, 2013 @edutech4schools i now have a version of my script thats compatible. As my script and zags collect different info and deal with it differently ive made it so that it creates the same (roughly as i keep making minor tweeks to the output as needed most recently for mdt i slightly altered the "make model" to "make-model") ive made it so that it creates a single file for each pc the (same as always), adds selected info to the ad description field (same as always) but now creates a combined file in the same format as zags (granted thats by adding lots of blank fields but it works as some of the info zags script collects just dosent interest me and some it dosent does) this is saved as one contiguous file so every time pc01 say runs it deletes its entry from the csv then readds itself at the bottom. As always with any scripts it seems to work for me and hasnt caused me any issues but if it breaks something i take no responsibility (and i only finished it 30 mins or so ago) Option Explicit 'On Error Resume Next dim outputstring, computermodel, pcmake, pcmodel, cpu, ram, hddcapacity, hddfree, serialno, macaddress, operatingsystem, csvoutput, csvoutput2 dim stcomputer, colitems, objItem, colcpu, colPhysicalMemory, objPhysicalMemory, intMemory, colDisks, objhdd dim colComputerSystem, colOperatingSystems, objOperatingSystem, colBIOS, objBIOS, colnicconfig, objnicconfig dim objwmiservice, hddtemp, weidata, colWSA, operatingsystemno, Lastuser, oreg, spath, svalue, strvalue, svaluename dim adoutputstring, adoRecordset, adoConnection, objRootDSE, objNetwork, objComputer, existing, basedata dim pcname, wshShell, strDirectory, strFile, objFSO, objFolder, objFile, objTextFile, myDateString dim colnet,objnet, linkspeed, objWMIService2, strline, strNewContents, strDirectory2, strFile2, objfolder2, objfile2 stcomputer = "." myDateString = Date() Set objRootDSE = GetObject("LDAP://RootDSE") Set objNetwork = WScript.CreateObject("WScript.Network") Set objWMIService = GetObject("winmgmts:\\" & stcomputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colcpu = objWMIService.ExecQuery("Select * from Win32_Processor") Set colPhysicalMemory = objWMIService.ExecQuery("Select * From Win32_PhysicalMemory") set coldisks = objWMIService.ExecQuery("Select * From Win32_LogicalDisk") Set colComputerSystem = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") Set colBIOS = objWMIService.ExecQuery("Select * From Win32_BIOS") Set colnicconfig = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") Set colWSA = objWMIservice.ExecQuery("Select * From Win32_WinSAT") Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Open "Active Directory Provider" Set adoRecordset = adoConnection.Execute(";(&(objectCategory=Computer)(name=" & objNetwork.Computername & "));adspath;subtree") Set wshShell = WScript.CreateObject( "WScript.Shell" ) Set objWMIService2 = GetObject("winmgmts:\\" & stComputer & "\root\WMI") Set colnet = objWMIService2.ExecQuery("SELECT * FROM MSNdis_LinkSpeed",,48) basedata= "MAC Address,Network Adapter,IP Address,Computer Name,GUID/UUID,GUID/UUID Mac Address Conversion,Total RAM Memory,Sid,RAM Memory Bank Label,RAM Memory Capacity,RAM Memory Device Locator,RAM Memory Manufacturer,Computer Manufacturer,Computer Model,Computer Serial,Motherboard Manufacturer,Motherboard Model,Motherboard Product,Motherboard Serial Number,Motherboard Version,Hard Disk Drive Letter,Hard Disk Size,Hard Disk Free Space,Hard Disk Volume Serial Number,Hard Disk Manufacturer,Hard Disk Model,Hard Disk Device ID,Hard Disk Interface Type,Hard Disk Partitions,Hard Disk Total Cylinders,Hard Disk Total Heads,Hard Disk Total Sectors,Hard Disk Total Tracks,Hard Disk Tracks Per Cylinder,Processor Name,Processor Type,Processor Family,Sound Card Manufacturer,Sound Card Product Name,Sound Card Description,Sound Card Name,Video Card Name,Video Card Setting ID,Floppy Manufacturer,Floppy Name,Floppy Device ID,CDROMCaptionSet,CDROMDescriptionSet,CDROMDeviceIDSet,CDROMDriveSet,CDROMManufacturerSet,CDROMNameSet,BIOS Version,Dell Service Tag,Date of Log,Time of Log" 'write file 1 location pcname = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) strDirectory = "\\server\logs$\pc2\" strFile = pcname & ".csv" 'write file 2 location strDirectory2 = "\\server\inventory$\" strFile2 = "inventorylog.csv" 'make-model For Each objItem In colItems computermodel= objItem.Manufacturer & " " & objItem.Model pcmake=objItem.Manufacturer pcmodel=objItem.Model 'wscript.echo computermodel Next ' Create the File System Object Set objFSO = CreateObject("Scripting.FileSystemObject") 'cpu info For Each objItem in colcpu cpu = objItem.Name 'wscript.echo cpu Next 'ram If Not colPhysicalMemory Is Nothing Then intMemory = 0 For Each objPhysicalMemory In colPhysicalMemory intMemory = intMemory + Int(objPhysicalMemory.Capacity) Next ram = (intMemory / 1024 / 1024 ) & " MB" 'wscript.echo ram End If 'hdd capacity for each objhdd in coldisks If objhdd.DeviceID = "C:" Then hddcapacity = int(objhdd.Size/1073741824) & " GB" hddfree = int(objhdd.freespace/1073741824) & " GB" 'wscript.echo hddfree end if next 'windows version For Each objOperatingSystem in colOperatingSystems operatingsystem = objOperatingSystem.Caption & " sp " & objOperatingSystem.ServicePackMajorVersion operatingsystemno = objOperatingSystem.Version 'wscript.echo operatingsystem Next 'serial no If Not colBIOS Is Nothing Then For Each objBIOS in colBIOS serialno = objBIOS.SerialNumber 'wscript.echo serialno Next End If 'mac address(s) If Not colnicconfig Is Nothing Then For Each objnicconfig in colnicconfig If macaddress <> "" Then macaddress = macaddress & " - " End If macaddress = macaddress & objnicconfig.MACAddress 'wscript.echo macaddress Next End If 'windows experience operatingsystemno = Left( operatingsystemno, 3 ) if operatingsystemno >5.5 then 'vista+ For Each objItem in colWSA 'weidata = "Overall -" & "na" & " - CPU - " & "na" & " - Memory - " & "na" & " - Graphics - " & "na" & " - Gaming graphics - " & "na" & " - hdd - " & "na" weidata = "Overall -" & objItem.WinSPRLevel & " - CPU - " & objItem.CPUScore & " - Memory - " & objItem.MemoryScore & " - Graphics - " & objItem.GraphicsScore & " - Gaming graphics - " & objItem.D3DScore & " - hdd - " & objItem.DiskScore next else 'xp- weidata = "Overall -" & "na" & " - CPU - " & "na" & " - Memory - " & "na" & " - Graphics - " & "na" & " - Gaming graphics - " & "na" & " - hdd - " & "na" end if 'last user if operatingsystemno >5.5 then 'vista+ Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & stcomputer & "/root/default:StdRegProv") If Err.Number <> 0 Then On Error Goto 0 Else On Error Goto 0 sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" sValueName = "LastLoggedonUser" If oReg.GetStringValue(HKLM, sPath, sValueName, sValue) = 0 Then lastuser = sValue Else lastuser = "unknown" & stcomputer End If End If else 'xp- Const HKEY_LOCAL_MACHINE = &H80000002 Set oreg=GetObject("winmgmts:\\" & stComputer & "\root\default:StdRegProv") spath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" svalue = "DefaultUserName" oreg.GetStringValue HKEY_LOCAL_MACHINE, spath, svalue, strValue lastuser=strvalue svalue = "DefaultDomainName" oreg.GetStringValue HKEY_LOCAL_MACHINE, spath, svalue, strValue lastuser = strvalue & "\" & lastuser end if 'Scans data for Net Speed For Each objnet in colnet 'Removes "slow/unused links" if objnet.NdisLinkSpeed/10 > 1000 then linkspeed= objnet.NdisLinkSpeed/10000 & " Mbps" & "-" & linkspeed '& "-" & objnet.NdisLinkSpeed/10000 & " Mbps" end if next 'concatanate data for output outputstring = computermodel & "," & cpu &"," & ram &"," & hddcapacity& "," & serialno & "," & macaddress & "," csvoutput = pcname & "," & computermodel & "," & cpu &"," & ram &"," & hddcapacity& "," & hddfree & "," & serialno & "," & operatingsystem & "," & macaddress & "," & weidata & "," & Lastuser & "," & linkspeed &"," & myDateString &"," csvoutput2 = macaddress & ", "&" ,"& "," & pcname & "," & "," & "," & ram &"," &"," &"," &"," &"," &"," & pcmake & "," & pcmodel & "," & serialno & "," & "," & "," & "," & "," & "," & "," & hddcapacity & "," & hddfree & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & cpu & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "," & "dell," & myDateString & "," ' wscript.echo outputstring ' Check that the strDirectory folder exists If objFSO.FolderExists(strDirectory) Then Set objFolder = objFSO.GetFolder(strDirectory) Else Set objFolder = objFSO.CreateFolder(strDirectory) 'WScript.Echo "Just created " & strDirectory End If If objFSO.FileExists(strDirectory & strFile) Then Set objFolder = objFSO.GetFolder(strDirectory) Else Set objFile = objFSO.CreateTextFile(strDirectory & strFile) 'Wscript.Echo "Just created " & strDirectory & strFile End If set objFile = nothing set objFolder = nothing ' OpenTextFile Method needs a Const value ' ForAppending = 8 ForReading = 1, ForWriting = 2 Const ForAppending = 2 Set objTextFile = objFSO.OpenTextFile _ (strDirectory & strFile, ForAppending, True) ' Writes result every time you run this VBScript objTextFile.WriteLine(csvoutput) objTextFile.Close If Err.Number <> 0 Then MsgBox "Query Error: " & Err.Description WScript.Quit End If '******************************************** '2nd file '******************************************** ' Check that the strDirectory folder exists If objFSO.FolderExists(strDirectory2) Then Set objFolder2 = objFSO.GetFolder(strDirectory2) Else Set objFolder2 = objFSO.CreateFolder(strDirectory2) 'WScript.Echo "Just created " & strDirectory2 & strfile2 & "bit1" End If If objFSO.FileExists(strDirectory2 & strFile2) Then Set objFolder2 = objFSO.GetFolder(strDirectory2) Else Set objFile2 = objFSO.CreateTextFile(strDirectory2 & strFile2) 'Wscript.Echo "Just created " & strDirectory2 & strFile2 &"bit2" objfile2.close Set objFile2 = objFSO.OpenTextFile((strDirectory2 & strFile2), ForWriting) objFile2.WriteLine(basedata) objfile2.close End If Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile2 = objFSO.OpenTextFile((strDirectory2 & strFile2), ForReading) Do Until objFile2.AtEndOfStream strLine = objFile2.ReadLine If InStr(left(strLine,17), macaddress) = 0 Then strNewContents = strNewContents & strLine & vbCrLf End If Loop objFile2.Close Set objFile2 = objFSO.OpenTextFile((strDirectory2 & strFile2), ForWriting) objFile2.Write strNewContents objFile2.WriteLine(csvoutput2) objFile2.Close If Not adoRecordset.EOF Then Set objComputer = GetObject(adoRecordset.Fields(0).Value) existing = objcomputer.Description if left (existing,1) = "#" and not right (existing,1) = "#" then outputstring = existing & " : " & outputstring & "#" if left (existing,1) = "#" and right (existing,1) = "#" then 'msgbox "data" wscript.quit end if if not objComputer.Description = outputstring then 'msgbox "diff" objComputer.Put "description", outputstring objComputer.SetInfo else 'msgbox "matches" end if End If If Err.Number <> 0 Then MsgBox "Write Error: " & Err.Description WScript.Quit End If 1
sted Posted November 6, 2013 Posted November 6, 2013 (edited) back again lol being having a play with this again now (currently on v5 of my script and v2 of the index.php lol) So far ive succesfully added serial no and windows version (as text) to the web page. Now as my php is minimal is it possible to edit it in someway to display a logo for windows version rather than an image like it does for manufacturer so i can have say a big 7e pic for windows 7 enterprise and so on as the text is quite long and an icon would be quicker to process. I suspect looking at the images folder it was doing this (or was thought about) at some stage also the hdd free always seems to show red even when its 200gb free any ideas? i suspect its probably the way i gather it as 14 GB Edited November 6, 2013 by sted
zag Posted November 6, 2013 Author Posted November 6, 2013 The original VBS script didnt check Operating System unfortunately so I never included it. It should be easy to copy and paste the code to add it though. We're Windows 7 all round here so not really much point for me to add this.
sted Posted November 6, 2013 Posted November 6, 2013 The original VBS script didnt check Operating System unfortunately so I never included it. It should be easy to copy and paste the code to add it though. We're Windows 7 all round here so not really much point for me to add this. fair enough ive got a mix from xp to 8.1 lol
sted Posted November 7, 2013 Posted November 7, 2013 (edited) nope not getting anywhere with the php i can get a straight text of windows7 ent. . . but just cant seem to get an icon working code below have defined winosconfig in settings as // List of os icon filenames (case sensitive) $winosconfig['Microsoft Windows 7 Enterprise sp 1']=win7.png; // Display the windows version // echo "".$winver.""; // Loop through the os list and display an icon foreach($winosconfig as $osname=>$ospic) { if (strpos($winver,$osname) !== false) { echo "images/os/$ospic"; $checkos = 1; } } if ($checkos != 1) {echo "damn";} well now ive got it to display damn for no data and its displaying a blank for ones with data Edited November 7, 2013 by sted muppet
zag Posted November 7, 2013 Author Posted November 7, 2013 Try to debug it by echo'ing the variable $ospic If the string is empty then there is a problem with that. Remember its also case sensitive.
georkame Posted April 30, 2015 Posted April 30, 2015 Hi ZAG, I'm using your Files and they work fine, I'm not of a coder, can you show me how to ad a column for user name? Sted.. Is there a way for you to share the modifications you made ? Thx to both of you.
sted Posted May 1, 2015 Posted May 1, 2015 erm probably what modification is it as ive lost track lol
georkame Posted May 1, 2015 Posted May 1, 2015 Thank you for your reply Sted, since I just started, what ever latest version you have would be fine.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now