archrival Posted December 20, 2004 Share Posted December 20, 2004 (edited) I finished the first draft of my Domain PC Info program. Unfortunately it uses way too much vbscript. But at the moment, AutoIt doesn't do what I need. I'm not doubting it will in the future though! Ok. Here's what this is. It will display all the machine names in your domain in a listbox, you can click on the machine name and it will tell you the OS, Service Pack, IP address, installation date and the currently logged on user. That's mostly retrieved via VB Script. After displaying that information, it presents you with a list of all of the services on that remote machine. From there you can get the current status of the service, start and stop them. I have plans for more in the future, but this is what I've done in my free time over the last week here at work. I'm also embarassed by my code, but it works and that was my goal for now. It performs very few checks and I'm sure it doesn't work too well on a 95/98/Me machine or on a machine not on a domain, it will eventually.Edit: Here's an extracted version from the compiled version I had lying around, it contains all of the includes, but at least it's a start. My current version is all mangled up right now, I'm rewriting all of the vb script, removing temp file output, improving existing functions. Don't have much time to work on it though. I've now posted enough that you should be able to get this working.domainview1.au3subnet.au3services_net.au3AU3XtraTest.dll Edited October 17, 2005 by archrival Link to comment Share on other sites More sharing options...
archrival Posted December 21, 2004 Author Share Posted December 21, 2004 Updated Services Interface, looks a little prettier. Is there any interest in something like this? I have plans to add retrieval of much more windows and hardware information and the ability to disable a service, search for what machines a user is logged on to, remove hardware from Device Manager, etc. I know there are other tools out there that do this, but I didn't write them and I'm doing this for me at first and if anyone else is interested or has feature requests I will add them. I haven't implemented any sanity checks yet, I've had reports of it going full screen without the possibility of being resized and the progress bar doesn't always fill 100%, I added it for the odd case that you have 4000 machines in your domain and the list takes a little while to finish, you'll at least have some sort of a clue as to how much longer you have to wait for the list to finish. Link to comment Share on other sites More sharing options...
Tom Posted December 22, 2004 Share Posted December 22, 2004 (edited) Very well done. Seems to work nice & fast. The only nit I have seen so far is the progress bar not completing. Thanks for sharing your code. Edited December 22, 2004 by Tom Link to comment Share on other sites More sharing options...
BasicOs Posted December 23, 2004 Share Posted December 23, 2004 Very well done. Seems to work nice & fast. The only nit I have seen so far is the progress bar not completing. Thanks for sharing your code.<{POST_SNAPBACK}>the progress bar is not a problem, more, it could be nice to order by active and inactive services, and have or hidden microsoft or not microsoft services in the list.Thanks Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
afsar Posted August 26, 2005 Share Posted August 26, 2005 I finished the first draft of my Domain PC Info program. Unfortunately it uses way too much vbscript. But at the moment, AutoIt doesn't do what I need. I'm not doubting it will in the future though! Ok. Here's what this is. It will display all the machine names in your domain in a listbox, you can click on the machine name and it will tell you the OS, Service Pack, IP address, installation date and the currently logged on user. That's mostly retrieved via VB Script. After displaying that information, it presents you with a list of all of the services on that remote machine. From there you can get the current status of the service, start and stop them. I have plans for more in the future, but this is what I've done in my free time over the last week here at work. I'm also embarassed by my code, but it works and that was my goal for now. It performs very few checks and I'm sure it doesn't work too well on a 95/98/Me machine or on a machine not on a domain, it will eventually.Here's a sample of the new output, it's a little more refined:Edit:Changed to links to AutoIt SourceCompiled exe:http://www.autoitscript.com/fileman/users/public/archrival/domainview.exeAutoIt Sourcehttp://www.autoitscript.com/fileman/users/public/archrival/domainview.au3Remote Services UDF by pacmanhttp://www.autoitscript.com/fileman/users/public/archrival/services-net.au3My sloppily thrown together but functional vb scripts.http://www.autoitscript.com/fileman/users/public/archrival/vbscript.au3hi,can u post again the domainview.au3 file again..when i try to view it is not opening..thanxbyeAfsar Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted August 26, 2005 Share Posted August 26, 2005 Yea, I'm getting 404 errors on the au3 scripts Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
w0uter Posted August 26, 2005 Share Posted August 26, 2005 the old fileman got relocated during the last "attacks" these links where made on Dec 23 2004. (i dont know if they are still on the old file-man though) My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Wooltown Posted October 5, 2005 Share Posted October 5, 2005 Archrival ! Can you submit your scripts again, it looks like the script i am looking for. Regards Sven Link to comment Share on other sites More sharing options...
archrival Posted October 5, 2005 Author Share Posted October 5, 2005 Archrival !Can you submit your scripts again, it looks like the script i am looking for.RegardsSvenSure, I'll remove the vbscript stuff and make sure it's up to date with the current autoit state. Give me a little time to convert it. Link to comment Share on other sites More sharing options...
archrival Posted October 12, 2005 Author Share Posted October 12, 2005 Sure, I'll remove the vbscript stuff and make sure it's up to date with the current autoit state. Give me a little time to convert it.Posted original source in first post on this topic. Link to comment Share on other sites More sharing options...
ptrex Posted October 12, 2005 Share Posted October 12, 2005 Hey Guys, this might inspire you all.This is the Free Swiss Army knfe !!!System Information for WindowsBtw nice job archrival Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
tazdev Posted October 12, 2005 Share Posted October 12, 2005 (edited) AutoIT will do a quick and dirty Software inventory to a TXT file: expandcollapse popupfunc appsinvlocal() $y = 1 $k = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $pcl = StringLeft(@Computername, 2) $d = ( @MON & "\" & @MDAY & "\" & @YEAR & " - " & @HOUR & ":" & @MIN) $li386 = ("C:\I386") $fn = (@TempDir & "\" & @ComputerName & "-programs.txt") If FileExists( $fn ) then FileDelete( $fn ) EndIf $f = FileOpen( $fn, 1) ; Check if file opened for writing OK If $f = -1 Then Exit EndIf FileWrite($f, $d & @CRLF) Do $a = RegEnumKey($k, $y);gets the key $as = Stringleft($a, 1) $sv = RegRead($k & "\" & $a, "DisplayVersion") $sn = RegRead($k & "\" & $a , "DisplayName") If $as = "{" then $y = $y + 1 $a2 = ($sn & " - " & $sv) FileWrite($f, $y & " - App: " & $a2 & @CRLF) Else If $a = "" Then FileWrite($f, @CRLF) $y = $y + 1 Else FileWrite($f, $y & " - App: " & $a & " - " & $sv & @CRLF) $y = $y + 1 EndIf EndIf Until $a = "" FileClose($f) EndFunc I use this to create a text file in the I386 folder based on the PC's name. It will list all the apps that the registry has listed in it. With some tweaking you could make this work from your PC to a remote PC if you wanted but you would need to change a couple of vars. Edited October 12, 2005 by tazdev Link to comment Share on other sites More sharing options...
Rahul Rohela Posted October 18, 2005 Share Posted October 18, 2005 Its not working showing error Line 830 (File "c:\Domain\Domainview.au3") $netview[$i] = ($aDllRet[1] & @LF) ^Error Error: Array variable has incorrect number of subscripts or subscript diamaension range exceeded.. Please post new files... Link to comment Share on other sites More sharing options...
RagnaroktA Posted November 9, 2005 Share Posted November 9, 2005 I'm showing an error while running... Line 25 (File "C:\DevLib\Tools\DomainView\Subnet.au3"): $netmaskdec = ($netmaskarray[1] * 16777216) + ($netmaskarray[2] * 65536) + ($netmaskarray[3] * 256 + $netmaskarray[4] $netmaskdec = ($netmaskarray[1] * 16777216) + (^ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. I havent modified any of the posted scripts... has anyone else had a problem with them? Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki Link to comment Share on other sites More sharing options...
feilong Posted May 5, 2006 Share Posted May 5, 2006 Thinks for sharing your code Archrival. I have search this sort of code since long time. Link to comment Share on other sites More sharing options...
Docfxit Posted June 19, 2016 Share Posted June 19, 2016 (edited) It looks like this script would be exactly what I need. I'm getting an error on this script: expandcollapse popup#include <GuiConstants.au3> #include <File.au3> #include <Date.au3> #include "services_net.au3" #include "subnet.au3" FileInstall("AU3XtraTest.dll", @TempDir & "\AU3XtraTest.dll") Global $run = 0 Global $loc Dim $ipaddressloc[14] Dim $subnetmaskloc[14] Dim $compnameloc[14] Global $pingdelay = "1000" AutoItSetOption("WinTitleMatchMode", 4) Opt("GuiOnEventMode", 1) $oslang = @OSLang If $oslang = "0406" Then $loc = 13 ElseIf $oslang = "0413" Or $oslang = "0813" Then $loc = 11 ElseIf $oslang = "0409" Or $oslang = "0809" Or $oslang = "0c09" Or $oslang = "1009" Or $oslang = "1409" Or _ $oslang = "1809" Or $oslang = "1c09" Or $oslang = "2009" Or $oslang = "2409" Or $oslang = "2809" Or _ $oslang = "2c09" Or $oslang = "3009" Or $oslang = "3409" Then $loc = 1 ElseIf $oslang = "040b" Then $loc = 7 ElseIf $oslang = "040c" Or $oslang = "080c" Or $oslang = "0c0c" Or $oslang = "100c" Or $oslang = "140c" Or _ $oslang = "180c" Then $loc = 2 ElseIf $oslang = "0407" Or $oslang = "0807" Or $oslang = "0c07" Or $oslang = "1007" Or $oslang = "1407" Then $loc = 3 ElseIf $oslang = "040e" Then $loc = 10 ElseIf $oslang = "0410" Or $oslang = "0810" Then $loc = 9 ElseIf $oslang = "0414" Or $oslang = "0814" Then $loc = 6 ElseIf $oslang = "0415" Then $loc = 12 ElseIf $oslang = "0416" Or $oslang = "0816" Then $loc = 8 ElseIf $oslang = "040a" Or $oslang = "080a" Or $oslang = "0c0a" Or $oslang = "100a" Or $oslang = "140a" Or _ $oslang = "180a" Or $oslang = "1c0a" Or $oslang = "200a" Or $oslang = "240a" Or $oslang = "280a" Or _ $oslang = "2c0a" Or $oslang = "300a" Or $oslang = "340a" Or $oslang = "380a" Or $oslang = "3c0a" Or _ $oslang = "400a" Or $oslang = "440a" Or $oslang = "480a" Or $oslang = "4c0a" Or $oslang = "500a" Then $loc = 4 ElseIf $oslang = "041d" Or $oslang = "081d" Then $loc = 5 Else MsgBox(0, "Error", "Unsupported language, defaulting to English") $loc = 1 EndIf ; Localization Variables ; 1 = English ; 2 = French ; 3 = German ; 4 = Spanish ; 5 = Swedish ; 6 = Norwegian ; 7 = Finnish ; 8 = Portugese ; 9 = Italian ; 10 = Hungarian ; 11 = Dutch ; 12 = Polish ; 13 = Danish $ipaddressloc[1] = "IP Address" $ipaddressloc[2] = "Adresse IP" $ipaddressloc[3] = "IP-Adresse" $ipaddressloc[4] = "Dirección IP" $ipaddressloc[5] = "IP-adress" $ipaddressloc[6] = "IP-adresse" $ipaddressloc[7] = "IP-osoite" $ipaddressloc[8] = "Endereço IP" $ipaddressloc[9] = "Indirizzo IP" $ipaddressloc[10] = "IP-cÃm" $ipaddressloc[11] = "IP-adres" $ipaddressloc[12] = "Adres IP" $ipaddressloc[13] = "IP-adresse" $subnetmaskloc[1] = "Subnet Mask" $subnetmaskloc[2] = "Masque de sous-réseau" $subnetmaskloc[3] = "Subnetzmaske" $subnetmaskloc[4] = "Máscara de subred" $subnetmaskloc[5] = "Nätmask" $subnetmaskloc[6] = "Nettverksmaske" $subnetmaskloc[7] = "Aliverkon peite" $subnetmaskloc[8] = "Máscara de sub-rede" $subnetmaskloc[9] = "Subnet mask" $subnetmaskloc[10] = "Alhálózati maszk" $subnetmaskloc[11] = "Subnetmasker" $subnetmaskloc[12] = "Maska podsieci" $subnetmaskloc[13] = "Undernetmaske" $compnameloc[1] = "Computer" $compnameloc[2] = "Ordinateur" $compnameloc[3] = "Computer" $compnameloc[4] = "Computadora" $compnameloc[5] = "Dator" $compnameloc[6] = "Datamaskin" $compnameloc[7] = "Tietokone" $compnameloc[8] = "Computador" $compnameloc[9] = "Calcolatore" $compnameloc[10] = "SzámÃtógép" $compnameloc[11] = "Computer" $compnameloc[12] = "Komputer" $compnameloc[13] = "Computer" If _ServiceRunning("", "lanmanworkstation") Then _Main() Else MsgBox(0, "Error", "The Workstation Service is not running, this needs to be" & @CRLF & "running to display the machines in your domain.") Exit EndIf Func _Main() _FileCleanUp() _CreatePCInfoScript() _GetIPSub() _FileCleanUp() _CreatePCInfoScript() _CreateDomainPCsGUI() _Vars() GUICtrlSetOnEvent($listpcbutton, "_ListPCs") GUICtrlSetOnEvent($subnetcheckbox, "_SubnetCheckbox") GUICtrlSetOnEvent($pcinfobutton, "_PCInfo") GUISetOnEvent($GUI_EVENT_CLOSE, "_DomainViewExit") EndFunc ;==>_Main While 1 Sleep(60000) WEnd ; Global Variable Definitions Func _Vars() Global $progress = Number($lines[0]) Global $compname[$lines[0] + 2] Global $os[$lines[0] + 2] Global $comp[$lines[0] + 2] Global $service_pack[$lines[0] + 2] Global $ip[$lines[0] + 2] Global $ipaddr[$lines[0] + 2] Global $username[$lines[0] + 2] Global $install_date[$lines[0] + 2] Global $ips[$lines[0] + 2] Global $item[$lines[0] + 2] Global $service[$lines[0] + 2] Global $mac[$lines[0] + 2] Global $pcs = 0 Global $timerstart[$lines[0] + 1] Global $pctimer[$lines[0] + 1] Global $pctime = 0 Global $cpumhz[$lines[0] + 2] Global $cpuname[$lines[0] + 2] Global $cdkey[$lines[0] + 2] Global $notesdb[$lines[0] + 2] Global $boot_date[$lines[0] + 2] Global $pcvendor[$lines[0] + 2] Global $pcmodel[$lines[0] + 2] Global $pcserial[$lines[0] + 2] Global $ram[$lines[0] + 2] Global $drvcsize[$lines[0] + 2] Global $drvcfree[$lines[0] + 2] Global $drvcused[$lines[0] + 2] Global $drvdsize[$lines[0] + 2] Global $drvdfree[$lines[0] + 2] Global $drvdused[$lines[0] + 2] Global $drvesize[$lines[0] + 2] Global $drvefree[$lines[0] + 2] Global $drveused[$lines[0] + 2] Global $drvfsize[$lines[0] + 2] Global $drvffree[$lines[0] + 2] Global $drvfused[$lines[0] + 2] EndFunc ;==>_Vars ; End Global Variable Definitions ; GUI Display Functions Func _CreateDomainPCsGUI() Global $lines = _NetView(@LogonDomain, "Workstation") Global $domaingui = GUICreate(@LogonDomain & " (" & @ComputerName & ")", 250, 320, (@DesktopWidth - 250) / 2, (@DesktopHeight - 320) / 2, $WS_OVERLAPPED + $WS_SYSMENU + $WS_CAPTION + $WS_MINIMIZEBOX + $WS_VISIBLE) GUICtrlSetLimit(-1, 20000) Global $listview = GUICtrlCreateListView($compnameloc[$loc] & " | " & $ipaddressloc[$loc], 10, 10, 230, 230, $LVS_NOSORTHEADER + $LVS_SINGLESEL) Global $progressbar = GUICtrlCreateProgress(10, 297, 231, 15) Global $subnetcheckbox = GUICtrlCreateCheckbox("Only Show /" & $subnetinfo[6], 10, 250) Global $ipcheckbox = GUICtrlCreateCheckbox("Show IP Addresses", 10, 271) Global $remainlabel = GUICtrlCreateLabel("Time Remaining: ", 125, 275, 110) Global $pcinfobutton = GUICtrlCreateButton("PC Info", 114, 250, 60, 20) GUICtrlSetState($pcinfobutton, $GUI_DISABLE) Global $listpcbutton = GUICtrlCreateButton("List PCs", 180, 250, 60, 20) GUISetState() EndFunc ;==>_CreateDomainPCsGUI Func _DisplayServicesGUI() HotKeySet("{F5}", "_RefreshServices") Global $servicesgui = GUICreate($comp[$pcnumber], 300, 355, (@DesktopWidth - 300) / 2, (@DesktopHeight - 355) / 2, $WS_POPUP + $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_VISIBLE) GUICtrlCreateLabel("Tip: F5 Key Refreshes Service List", 4, 338, 200) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $startbutton = GUICtrlCreateButton("Start", 245, 192, 54, 30) Global $stopbutton = GUICtrlCreateButton("Stop", 188, 192, 54, 30) _CreateServiceScript() _CheckServices() _ServicesListView() $tab = GUICtrlCreateTab(0, 202, 300, 136, $TCS_HOTTRACK) $ostab = GUICtrlCreateTabItem("OS Info") Global $osheader = GUICtrlCreateLabel("Operating System:", 5, 230, 185) GUICtrlSetFont($osheader, 8, 800, 0, "MS Sans Serif") If $service_pack[$pcnumber] > 0 Then $oslabel = GUICtrlCreateLabel($os[$pcnumber] & " SP" & $service_pack[$pcnumber], 5, 245, 250) Else $oslabel = GUICtrlCreateLabel($os[$pcnumber], 5, 245, 185) EndIf Global $userheader = GUICtrlCreateLabel("Current User:", 5, 265, 80) GUICtrlSetFont($userheader, 8, 800, 0, "MS Sans Serif") $userlabel = GUICtrlCreateLabel($username[$pcnumber], 5, 280, 100) Global $installheader = GUICtrlCreateLabel("Install Date:", 5, 300, 80) GUICtrlSetFont($installheader, 8, 800, 0, "MS Sans Serif") $installdatelabel = GUICtrlCreateLabel($install_date[$pcnumber], 5, 315, 80) Global $bootdateheader = GUICtrlCreateLabel("Last Reboot:", 100, 300, 80) GUICtrlSetFont($bootdateheader, 8, 800, 0, "MS Sans Serif") $bootdatelabel = GUICtrlCreateLabel($boot_date[$pcnumber], 100, 315, 150) Global $cdkeyheader = GUICtrlCreateLabel("Windows Product Key:", 100, 265, 130) GUICtrlSetFont($cdkeyheader, 8, 800, 0, "MS Sans Serif") $cdkeylabel = GUICtrlCreateLabel($cdkey[$pcnumber], 100, 280, 200) $hwtab = GUICtrlCreateTabItem("Hardware") Global $ipheader = GUICtrlCreateLabel($ipaddressloc[$loc] & ":", 105, 265, 75) GUICtrlSetFont($ipheader, 8, 800, 0, "MS Sans Serif") $iplabel = GUICtrlCreateLabel($ip[$pcnumber], 105, 280, 75) Global $modelheader = GUICtrlCreateLabel($pcvendor[$pcnumber] & " Model:", 5, 230, 250) GUICtrlSetFont($modelheader, 8, 800, 0, "MS Sans Serif") $modellabel = GUICtrlCreateLabel($pcmodel[$pcnumber], 5, 245, 120) Global $serialheader = GUICtrlCreateLabel("Serial Number:", 5, 265, 120) GUICtrlSetFont($serialheader, 8, 800, 0, "MS Sans Serif") $seriallabel = GUICtrlCreateLabel($pcserial[$pcnumber], 5, 280, 80) Global $ramheader = GUICtrlCreateLabel("RAM:", 205, 230, 50) GUICtrlSetFont($ramheader, 8, 800, 0, "MS Sans Serif") $ramlabel = GUICtrlCreateLabel($ram[$pcnumber] / 1024 / 1024 & " MB", 205, 245, 80) Global $macheader = GUICtrlCreateLabel("MAC Address:", 195, 265, 80) GUICtrlSetFont($macheader, 8, 800, 0, "MS Sans Serif") $macaddress = GUICtrlCreateLabel($mac[$pcnumber], 195, 280, 100) Global $cpunameheader = GUICtrlCreateLabel("CPU Type:", 5, 300, 80) GUICtrlSetFont($cpunameheader, 8, 800, 0, "MS Sans Serif") $cpunamelabel = GUICtrlCreateLabel($cpuname[$pcnumber], 5, 315, 210) Global $cpumhzheader = GUICtrlCreateLabel("CPU Speed:", 220, 300, 80) GUICtrlSetFont($cpumhzheader, 8, 800, 0, "MS Sans Serif") $cpumhzlabel = GUICtrlCreateLabel($cpumhz[$pcnumber] & " MHz", 220, 315, 80) $hdtab = GUICtrlCreateTabItem("Drives") Global $drvcheader = GUICtrlCreateLabel("Drive C:", 5, 230, 90) GUICtrlSetFont($drvcheader, 8, 800, 0, "MS Sans Serif") $drvclabel = GUICtrlCreateLabel("Size: " & Round($drvcfree[$pcnumber] / 1024, 2) & " GB / " & Round($drvcsize[$pcnumber] / 1024, 2) & " GB", 5, 245, 150) Global $drvdheader = GUICtrlCreateLabel("Drive D:", 150, 230, 90) GUICtrlSetFont($drvdheader, 8, 800, 0, "MS Sans Serif") $drvdlabel = GUICtrlCreateLabel("Size: " & Round($drvdfree[$pcnumber] / 1024, 2) & " GB / " & Round($drvdsize[$pcnumber] / 1024, 2) & " GB", 150, 245, 150) Global $drveheader = GUICtrlCreateLabel("Drive E:", 5, 265, 90) GUICtrlSetFont($drveheader, 8, 800, 0, "MS Sans Serif") $drvelabel = GUICtrlCreateLabel("Size: " & Round($drvefree[$pcnumber] / 1024, 2) & " GB / " & Round($drvesize[$pcnumber] / 1024, 2) & " GB", 5, 280, 150) Global $drvfheader = GUICtrlCreateLabel("Drive F:", 150, 265, 90) GUICtrlSetFont($drvfheader, 8, 800, 0, "MS Sans Serif") $drvflabel = GUICtrlCreateLabel("Size: " & Round($drvffree[$pcnumber] / 1024, 2) & " GB / " & Round($drvffree[$pcnumber] / 1024, 2) & " GB", 150, 280, 150) Global $notesdbheader = GUICtrlCreateLabel("Notes DB Size:", 5, 300, 95) GUICtrlSetFont($notesdbheader, 8, 800, 0, "MS Sans Serif") $notesdblabel = GUICtrlCreateLabel($notesdb[$pcnumber], 5, 315, 80) GUISetState(@SW_DISABLE, $domaingui) GUISwitch($servicesgui) GUISetState(@SW_ENABLE, $servicesgui) GUISetState(@SW_SHOW, $servicesgui) GUISetOnEvent($GUI_EVENT_CLOSE, "_SvcExit") GUICtrlSetOnEvent($startbutton, "_StartPCService") GUICtrlSetOnEvent($stopbutton, "_StopPCService") EndFunc ;==>_DisplayServicesGUI ; End GUI Display Functions ; GUI Update Functions Func _ListPCs() Global $subcheckboxstatus = GUICtrlRead($subnetcheckbox) Global $ipcheckboxstatus = GUICtrlRead($ipcheckbox) GUICtrlSetState($listpcbutton, $GUI_DISABLE) GUICtrlSetState($subnetcheckbox, $GUI_DISABLE) GUICtrlSetState($ipcheckbox, $GUI_DISABLE) Global $listpcstart = TimerInit() For $i = 1 To $lines[0] $timerstart[$i] = TimerInit() $compname[$i] = StringStripWS($lines[$i], 7) If $ipcheckboxstatus = 1 Then RunWait(@ComSpec & " /c ping -n 1 -l 1 -w " & $pingdelay & " " & $compname[$i] & " > " & @TempDir & "\tempip.txt", "", @SW_HIDE) $parse = FileRead(@TempDir & "\tempip.txt", 5000) $ipaddr[$i] = StringTrimLeft($parse, StringInStr($parse, "[")) $ipaddr[$i] = StringLeft($ipaddr[$i], StringInStr($ipaddr[$i], "]") - 1) Else $pcs = $pcs + 1 $comp[$pcs] = $compname[$i] $item[$i] = GUICtrlCreateListViewItem($compname[$i] & "|" & "", $listview) EndIf If $subcheckboxstatus = 1 Then If $ipaddr[$i] <> "" Then $samesub = _SameSub($ipaddr[$i], $subnetinfo[1], $subnetinfo[2]) If $samesub = 1 Then $item[$i] = GUICtrlCreateListViewItem($compname[$i] & "|" & $ipaddr[$i], $listview) $pcs = $pcs + 1 $comp[$pcs] = $compname[$i] $ips[$pcs] = $ipaddr[$i] EndIf EndIf EndIf If $ipcheckboxstatus = 1 And $subcheckboxstatus = 4 Then If $ipaddr[$i] <> "" Then $item[$i] = GUICtrlCreateListViewItem($compname[$i] & "|" & $ipaddr[$i], $listview) $pcs = $pcs + 1 $comp[$pcs] = $compname[$i] $ips[$pcs] = $ipaddr[$i] EndIf EndIf FileDelete(@TempDir & "\tempip.txt") GUICtrlSetData($progressbar, ($i * (100 / $progress))) $pctimer[$i] = TimerDiff($timerstart[$i]) / 1000 $pctime = $pctime + $pctimer[$i] $pcavg = $pctime / $i $remain = Int(($pcavg * $lines[0]) - ($pcavg * $i)) GUICtrlSetData($remainlabel, "Time Remaining: " & $remain & "s") Next $totallisttime = Int(TimerDiff($listpcstart) / 1000) GUICtrlSetData($remainlabel, "Total Scan Time: " & $totallisttime & "s") GUISetState() GUICtrlSetState($pcinfobutton, $GUI_ENABLE) EndFunc ;==>_ListPCs Func _PCInfo() Global $pcnumber = GUICtrlRead($listview) - 9 If $pcnumber = -9 Then Return EndIf If _ServiceRunning($comp[$pcnumber], "RemoteRegistry") And _ServiceRunning($comp[$pcnumber], "winmgmt") And _ServiceRunning($comp[$pcnumber], "lanmanserver") Then GUICtrlSetData($pcinfobutton, "Wait") GUICtrlSetState($pcinfobutton, $GUI_DISABLE) If $ipcheckboxstatus = 4 Then TrayTip("Checking IP Address", $comp[$pcnumber], 5000) RunWait(@ComSpec & " /c ping -n 1 -l 1 -w " & $pingdelay & " " & $comp[$pcnumber] & " > " & @TempDir & "\tempip.txt", "", @SW_HIDE) $parse = FileRead(@TempDir & "\tempip.txt", 5000) $ipadd = StringTrimLeft($parse, StringInStr($parse, "[")) $ipadd = StringLeft($ipadd, StringInStr($ipadd, "]") - 1) $ip[$pcnumber] = $ipadd Else $ip[$pcnumber] = $ips[$pcnumber] EndIf TrayTip("Checking PC Info", $comp[$pcnumber], 30) RunWait(@ComSpec & " /c " & "cscript //T:10 //nologo " & @TempDir & "\pcinfo.vbs " & $comp[$pcnumber] & " > " & @TempDir & "\pcinfo.txt", "", @SW_HIDE) $os[$pcnumber] = StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 1), 4) If $os[$pcnumber] = "" Then MsgBox(0, $comp[$pcnumber], "Cannot display computer information.") TrayTip("", "", 0) GUICtrlSetData($pcinfobutton, "PC Info") GUICtrlSetState($pcinfobutton, $GUI_ENABLE) Return Else $service_pack[$pcnumber] = StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 2), 14) $tempinstalldate = StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 3), 9) $installdateyear = StringLeft($tempinstalldate, 4) $installdatemonth = _DateMonthOfYear(StringMid($tempinstalldate, 5, 2), 1) $installdateday = StringMid($tempinstalldate, 7, 2) $install_date[$pcnumber] = $installdatemonth & " " & $installdateday & ", " & $installdateyear $tempbootdate = StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 4), 11) If $tempbootdate = "" Then $boot_date[$pcnumber] = "N/A" Else $bootdateyear = StringLeft($tempbootdate, 4) $bootdatemonth = _DateMonthOfYear(StringMid($tempbootdate, 5, 2), 1) $bootdateday = StringMid($tempbootdate, 7, 2) $bootdatehour = StringMid($tempbootdate, 9, 2) If $bootdatehour > 12 Then $bootdatehour = $bootdatehour - 12 $meridian = "PM" Else $meridian = "AM" EndIf If $bootdatehour = 0 Then $bootdatehour = 12 $meridian = "AM" EndIf $bootdatemin = StringMid($tempbootdate, 11, 2) $bootdatesec = StringMid($tempbootdate, 13, 2) $boot_date[$pcnumber] = $bootdatemonth & " " & $bootdateday & ", " & $bootdateyear & " " & $bootdatehour & ":" & $bootdatemin & " " & $meridian EndIf $pcvendor[$pcnumber] = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 5), 8), 7) If $pcvendor[$pcnumber] = "" Then $pcvendor[$pcnumber] = "N/A" EndIf $pcmodel[$pcnumber] = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 6), 7), 7) If $pcmodel[$pcnumber] = "" Then $pcmodel[$pcnumber] = "N/A" EndIf $pcserial[$pcnumber] = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 7), 8), 7) If $pcserial[$pcnumber] = "" Then $pcserial[$pcnumber] = "N/A" EndIf Dim $ramtemp For $i = 14 To 30 If StringInStr(FileReadLine(@TempDir & "\pcinfo.txt", $i), "RAM:") Then $ramtemp = $ramtemp + Number(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", $i), 4)) EndIf Next $ram[$pcnumber] = $ramtemp $mac[$pcnumber] = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 9), 5), 7) If $mac[$pcnumber] = "" Then $mac[$pcnumber] = "N/A" EndIf $invusercheck = StringInStr(FileReadLine(@TempDir & "\pcinfo.txt", 13), "\", "", 2) If $invusercheck > 0 Then $username[$pcnumber] = "Error" Else $username[$pcnumber] = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 13), StringInStr(FileReadLine(@TempDir & "\pcinfo.txt", 13), "\")), 2) EndIf EndIf TrayTip("Checking CPU Type", $comp[$pcnumber], 30) $cpumhz[$pcnumber] = RegRead("\\" & $comp[$pcnumber] & "\HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz") $cpuname[$pcnumber] = StringStripWS(RegRead("\\" & $comp[$pcnumber] & "\HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString"), 7) If $cpuname[$pcnumber] = "" Then $cpuname[$pcnumber] = StringStripWS(RegRead("\\" & $comp[$pcnumber] & "\HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "Identifier"), 3) EndIf TrayTip("Checking CD Key", $comp[$pcnumber], 30) $dpid = RegRead("\\" & $comp[$pcnumber] & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductID") $cdkey[$pcnumber] = _DecodeProductKey($dpid) TrayTip("Checking Notes Size", $comp[$pcnumber], 30) $notesdb[$pcnumber] = _CheckNotes($comp[$pcnumber]) TrayTip("Checking Hard Drive Space", $comp[$pcnumber], 30) $drvcsize[$pcnumber] = DriveSpaceTotal("\\" & $comp[$pcnumber] & "\c$") $drvcfree[$pcnumber] = DriveSpaceFree("\\" & $comp[$pcnumber] & "\c$") $drvcused[$pcnumber] = $drvcsize - $drvcfree $drvdsize[$pcnumber] = DriveSpaceTotal("\\" & $comp[$pcnumber] & "\d$") $drvdfree[$pcnumber] = DriveSpaceFree("\\" & $comp[$pcnumber] & "\d$") $drvdused[$pcnumber] = $drvdsize - $drvdfree $drvesize[$pcnumber] = DriveSpaceTotal("\\" & $comp[$pcnumber] & "\e$") $drvefree[$pcnumber] = DriveSpaceFree("\\" & $comp[$pcnumber] & "\e$") $drveused[$pcnumber] = $drvesize - $drvefree TrayTip("", "", 0) _DisplayServicesGUI() GUICtrlSetData($pcinfobutton, "PC Info") GUICtrlSetState($pcinfobutton, $GUI_ENABLE) EndIf EndFunc ;==>_PCInfo Func _ServicesListView() Global $servicerealname[$slines[0]] Global $servicename[$slines[0]] Global $servicestatus[$slines[0]] Global $service1occur[$slines[0]] Global $service2occur[$slines[0]] Global $service[$slines[0]] Global $combos = GUICtrlCreateListView("Service Name | Status", 0, 0, 300, 186, $LVS_NOSORTHEADER + $LVS_SINGLESEL) For $i = 1 To ($slines[0] - 1) $service1occur[$i] = StringInStr($slines[$i], " : ", "", 1) $service2occur[$i] = StringInStr($slines[$i], " : ", "", 2) $servicerealname[$i] = StringLeft($slines[$i], ($service1occur[$i] - 1)) $servicename[$i] = StringMid($slines[$i], ($service1occur[$i] + 3), ($service2occur[$i] - $service1occur[$i] - 3)) $servicestatus[$i] = StringTrimLeft($slines[$i], $service2occur[$i] + 2) $service[$i] = GUICtrlCreateListViewItem($servicerealname[$i] & "|" & $servicestatus[$i], $combos) Next EndFunc ;==>_ServicesListView Func _RefreshServices() Global $svcupstatus[$slines[0]] If $noservices = $slines[0] Then For $i = 1 To ($slines[0] - 1) $svcup2occur = StringInStr($slines[$i], " : ", "", 2) $svcupstatus[$i] = StringStripWS(StringTrimLeft($slines[$i], $svcup2occur + 2), 2) GUICtrlSetData($service[$i], "|" & $svcupstatus[$i]) Next EndIf EndFunc ;==>_RefreshServices Func _UpdateService() RunWait(@ComSpec & " /c cscript //T:10 //nologo " & @TempDir & "\serviceupdate.vbs " & $comp[$pcnumber] & " > " & @TempDir & "\serviceupdate.txt", "", @SW_HIDE) $serviceupdate = @TempDir & "\serviceupdate.txt" $svcupdtext = FileRead($serviceupdate, FileGetSize($serviceupdate)) $svcup2occur = StringInStr($svcupdtext, " : ", "", 2) $svcupstatus = StringStripWS(StringTrimLeft($svcupdtext, $svcup2occur + 2), 2) GUICtrlSetData($service[$linenumber], "|" & $svcupstatus) EndFunc ;==>_UpdateService Func _GetIPSub() RunWait(@ComSpec & " /c " & "cscript //T:10 //nologo " & @TempDir & "\pcinfo.vbs " & @ComputerName & " > " & @TempDir & "\pcinfo.txt", "", @SW_HIDE) Global $netmask = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 11), 8), 7) Global $localip = StringStripWS(StringTrimLeft(FileReadLine(@TempDir & "\pcinfo.txt", 8), 4), 7) Global $subnetinfo = _Subnet($localip, $netmask) If $subnetinfo = 0 Then MsgBox(0, "Error", "Invalid Subnet Mask") Exit EndIf If $subnetinfo = -1 Then MsgBox(0, "Error", "Invalid IP Address") Exit EndIf EndFunc ;==>_GetIPSub Func _SubnetCheckbox() If GUICtrlRead($subnetcheckbox) = 1 Then GUICtrlSetState($ipcheckbox, $GUI_CHECKED) GUICtrlSetState($ipcheckbox, $GUI_DISABLE) Else GUICtrlSetState($ipcheckbox, $GUI_ENABLE) EndIf EndFunc ;==>_SubnetCheckbox ; End GUI Update Functions ; Service Functions Func _CheckServices() Global $slines[500] If FileExists(@TempDir & "\services.txt") Then FileDelete(@TempDir & "\services.txt") EndIf RunWait(@ComSpec & " /c cscript //T:10 //nologo " & @TempDir & "\services.vbs " & $comp[$pcnumber] & " | sort > " & @TempDir & "\services.txt", "", @SW_HIDE) $services = @TempDir & "\services.txt" $slines = StringReplace(FileRead($services, FileGetSize($services)), @LF, "|") $slines = StringReplace($slines, Chr(9), "") $slines = StringReplace($slines, @CR, "") $slines = StringSplit($slines, "|") $run = $run + 1 If $run = 1 Then Global $noservices = $slines[0] EndIf EndFunc ;==>_CheckServices Func _StartPCService() Global $linenumber = GUICtrlRead($combos) - 6 If Not _ServiceRunning($comp[$pcnumber], $servicename[$linenumber]) Then _StartService($comp[$pcnumber], $servicename[$linenumber]) _CreateUpdateServiceScript() _UpdateService() EndIf EndFunc ;==>_StartPCService Func _StopPCService() Global $linenumber = GUICtrlRead($combos) - 6 If _ServiceRunning($comp[$pcnumber], $servicename[$linenumber]) Then _StopService($comp[$pcnumber], $servicename[$linenumber]) _CreateUpdateServiceScript() _UpdateService() EndIf EndFunc ;==>_StopPCService Func _RefreshPCService() Global $linenumber = GUICtrlRead($combos) - 6 _CheckServices() _RefreshServices() EndFunc ;==>_RefreshPCService ; End Service Functions Func _SvcExit() $run = 0 HotKeySet("{F5}") GUIDelete($servicesgui) GUISetState(@SW_RESTORE, $domaingui) GUISetState(@SW_ENABLE, $domaingui) GUISwitch($domaingui) Return EndFunc ;==>_SvcExit Func _DomainViewExit() _FileCleanUp() Exit EndFunc ;==>_DomainViewExit Func _FileCleanUp() If FileExists(@TempDir & "\pcinfo.vbs") Then FileDelete(@TempDir & "\pcinfo.vbs") EndIf If FileExists(@TempDir & "\pcinfo.txt") Then FileDelete(@TempDir & "\pcinfo.txt") EndIf If FileExists(@TempDir & "\tempip.txt") Then FileDelete(@TempDir & "\tempip.txt") EndIf If FileExists(@TempDir & "\services.txt") Then FileDelete(@TempDir & "\services.txt") EndIf If FileExists(@TempDir & "\services.vbs") Then FileDelete(@TempDir & "\services.vbs") EndIf If FileExists(@TempDir & "\serviceupdate.vbs") Then FileDelete(@TempDir & "\serviceupdate.vbs") EndIf If FileExists(@TempDir & "\serviceupdate.txt") Then FileDelete(@TempDir & "\serviceupdate.txt") EndIf EndFunc ;==>_FileCleanUp ; Script Creation Func _CreatePCInfoScript() $pcinfoscript = FileOpen(@TempDir & "\pcinfo.vbs", 2) If $pcinfoscript = -1 Then Exit EndIf ; FileWriteLine($pcinfoscript, 'On Error Resume Next' & @CRLF) FileWriteLine($pcinfoscript, 'Set oShell = CreateObject("wscript.Shell")' & @CRLF) FileWriteLine($pcinfoscript, 'Set env = oShell.environment("Process")' & @CRLF) FileWriteLine($pcinfoscript, 'Set objArgs = WScript.Arguments' & @CRLF) FileWriteLine($pcinfoscript, 'For Each strArg in objArgs' & @CRLF) FileWriteLine($pcinfoscript, 'strComputer = strArg' & @CRLF) FileWriteLine($pcinfoscript, 'Next' & @CRLF) FileWriteLine($pcinfoscript, 'Const HKEY_LOCAL_MACHINE = &H80000002' & @CRLF) FileWriteLine($pcinfoscript, 'Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"' & @CRLF) FileWriteLine($pcinfoscript, 'Set oReg=GetObject("winmgm  The error is: GUICtrlSetOnEvent($listpcbutton, "_ListPCs") $listpcbutton possibly used before declaration.  Thank you, Docfxit Edited June 19, 2016 by Docfxit Link to comment Share on other sites More sharing options...
water Posted June 19, 2016 Share Posted June 19, 2016 Seems you posted the code twice. Could you please remove the part without code tags? It makes your post hard to read My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki  Link to comment Share on other sites More sharing options...
water Posted June 19, 2016 Share Posted June 19, 2016 BTW: I think the message perfectly explains what is wrong. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki  Link to comment Share on other sites More sharing options...
Docfxit Posted June 19, 2016 Share Posted June 19, 2016 Hi Water, I actually didn't post it twice. There was an error when I used the <> icon to post the code. I just tried to remove the second posting. Please let me know if it's ok now. Thanks, Docfxit Link to comment Share on other sites More sharing options...
water Posted June 19, 2016 Share Posted June 19, 2016 Perfect! I've noticed the probelm myself. You have to wait a bit until the codebox is fully opened before pasting code. Else the code will get pasted into the thread without code tags. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki  Link to comment Share on other sites More sharing options...
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