iceberg Posted November 6, 2006 Posted November 6, 2006 Hi, Can someone please help me out here? The codes works fine except that it is unable to find a few specs of a remote PC. What the exact problem is that it is able to capture Monitor Brand and Monitor Serial Number. But when it comes to a remote CPU serial, brand and manufacturer, it still captures the local PC's details. I believe there is something wrong in lines 12 - 22. Would appreciate if someone could assist me. Thanks. expandcollapse popup#include <GuiConstants.au3> $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 Local $objItem, $colSystem, $colProduct, $bitOr = BitOR(0x10, 0x20) $strComputer = @ComputerName $SN = "" $objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\cimv2") $colSystem = $objWMIService.ExecQuery ("Select Name, Manufacturer, Model from Win32_ComputerSystem WHERE Name='" & $strComputer & "'", "WQL", $bitOr) $colProduct = $objWMIService.ExecQuery ("Select Caption, Name, IdentifyingNumber from Win32_ComputerSystemProduct WHERE Name='" & $strComputer & "'", "WQL", $bitOr) For $objItem in $colSystem $Man = $objItem.Manufacturer $Mod = $objItem.Model Next For $objItem in $colProduct $SN = $objItem.IdentifyingNumber Next _StrComputer() If Ping($strComputer, 200) = 0 Then MsgBox(0, "Error", $strComputer & " could not be reached, please enter another.") _StrComputer() EndIf _ObjWMI() Func _ObjWMI() Global $objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\CIMV2") _ObjWMICheck() EndFunc ;==>_ObjWMI Func _ObjWMICheck() If $objWMIService = "" Then MsgBox(0, "WMI Error", "WMI not running on " & $strComputer & ", please enter another computer name.") _StrComputer() _ObjWMI() EndIf EndFunc ;==>_ObjWMICheck $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_DesktopMonitor", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $j = 0 $msg = "" If IsObj ($colItems) Then For $objItem In $colItems $PNPDeviceID = $objItem.PNPDeviceID $screenwidth = $objItem.ScreenWidth If $screenwidth = 0 Then ExitLoop $monedid = RegRead("\\" & $strComputer & "\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum\" & $PNPDeviceID & "\Device Parameters", "EDID") Dim $edidarray[StringLen($monedid) ] $edidarray[0]= (StringLen($monedid) / 2) + 1 For $i = 1 To StringLen($monedid) Step 2 $j = $j + 1 $edidarray[$j] = Dec(StringMid($monedid, $i, 2)) Next Next $ser = _FindMonitorSerial() $name = _FindMonitorName() ;MsgBox(0, "Monitor Information", "Monitor Name: " & $name & @CRLF & "Serial Number: " & $ser & @CRLF & "Manufacturer: " & $Man & @CRLF & "Model: " & $Mod & @CRLF & "CPU Serial No:" & $SN) $GUI_Handle = GUICreate("OUTPUT", 425, 300, (@DesktopWidth - 400) / 2, (@DesktopHeight - 266) / 2) $Heading = GUICtrlCreateLabel("Computer Details as Requested", 30, 20, 250, 20) $OK = GUICtrlCreateButton("OK", 150, 260, 110, 30) $MName = GUICtrlCreateLabel("Monitor Brand", 30, 60, 80, 20) $MName1 = GUICtrlCreateEdit($name, 150, 60, 260, 21, $ES_READONLY) $MSerial = GUICtrlCreateLabel("Monitor Serial", 30, 100, 80, 20) $MSerial1 = GUICtrlCreateEdit($ser, 150, 100, 260, 21, $ES_READONLY) $Manufacturer = GUICtrlCreateLabel("CPU Manufacturer", 30, 140, 100, 20) $Manu1 = GUICtrlCreateEdit($Man, 150, 140, 260, 21, $ES_READONLY) $Model = GUICtrlCreateLabel("CPU Model", 30, 180, 80, 20) $Model1 = GUICtrlCreateEdit($Mod, 150, 180, 260, 21, $ES_READONLY) $CPU = GUICtrlCreateLabel("CPU Serial", 30, 220, 80, 20) $CPU1 = GUICtrlCreateEdit($SN, 150, 220, 260, 21, $ES_READONLY) GUICtrlSetState($OK, $GUI_FOCUS) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $OK ExitLoop EndSelect WEnd Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_DesktopMonitor") EndIf Func _FindMonitorSerial() $sernumstr = "" $sernum = 0 For $i = 1 To (UBound($edidarray) / 2) - 4 If $edidarray[$i] = "0" And $edidarray[$i + 1] = "0" And $edidarray[$i + 2] = "0" And $edidarray[$i + 3] = "255" And $edidarray[$i + 4] = "0" Then $sernum = $i + 4 EndIf Next If $sernum <> 0 Then $endstr = 0 $sernumstr = "" For $i = 1 To 13 If $edidarray[$sernum + $i] = "10" Then $endstr = 1 Else If $endstr = 0 Then $sernumstr = $sernumstr & Chr($edidarray[$sernum + $i]) EndIf EndIf Next Else $sernumstr = "" EndIf Return $sernumstr EndFunc ;==>_FindMonitorSerial Func _FindMonitorName() $name = 0 For $i = 1 To (UBound($edidarray) / 2) - 4 If $edidarray[$i] = "0" And $edidarray[$i + 1] = "0" And $edidarray[$i + 2] = "252" And $edidarray[$i + 3] = "0" Then $name = $i + 3 EndIf Next If $name <> 0 Then $endstr = 0 $namestr = "" For $i = 1 To 13 If $edidarray[$name + $i] = "10" Then $endstr = 1 Else If $endstr = 0 Then $namestr = $namestr & Chr($edidarray[$name + $i]) EndIf EndIf Next Else $namestr = "" EndIf Return $namestr EndFunc ;==>_FindMonitorName Func _StrComputer() Global $strComputer = InputBox("Computer Name", "Enter Computer Name:", StringUpper(@ComputerName), "", 100, 120) If @error = 1 Then Exit EndFunc ;==>_StrComputer mouse not found....scroll any mouse to continue.
GaryFrost Posted November 6, 2006 Posted November 6, 2006 $strComputer = @ComputerName SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
iceberg Posted November 6, 2006 Author Posted November 6, 2006 thanks for looking at it gafrost. but the code is already included in line 8. unless i hv to add it elsewhere....??? mouse not found....scroll any mouse to continue.
GaryFrost Posted November 6, 2006 Posted November 6, 2006 thanks for looking at it gafrost. but the code is already included in line 8. unless i hv to add it elsewhere....???line 8 is the problem, if your running the script on your computer and you want info from a remote computer you need to change that. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
iceberg Posted November 7, 2006 Author Posted November 7, 2006 alright...but the last part of the scripts has a Global $strComputer declared whereby an input box is prompted. isn't tat supposed to handle this: $strComputer = InputBox (overwriting @ComputerName) mouse not found....scroll any mouse to continue.
GaryFrost Posted November 7, 2006 Posted November 7, 2006 alright...but the last part of the scripts has a Global $strComputer declared whereby an input box is prompted. isn't tat supposed to handle this:$strComputer = InputBox (overwriting @ComputerName)your correct, but your not calling it till farther down, try moving the call above the 1st query SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
iceberg Posted November 7, 2006 Author Posted November 7, 2006 haha...silly me. got it. thanks alot gafrost! mouse not found....scroll any mouse to continue.
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