erifash Posted December 8, 2005 Posted December 8, 2005 How can you return the names of the computers on the local network using WMI? Here is the code I have so far...Func _GetPCs( $sDomain = @COMPUTERNAME ) Local $oDomain = ObjGet("WinNT://" & $sDomain), $c = 2, $pc[999][2] If @error Then SetError(1) Return "" EndIf $pc[1][0] = @COMPUTERNAME $pc[1][1] = @IPADDRESS1 $pc[0][0] = 1 For $o In $oDomain If $o.class = "Computer" Then $pc[$c][0] = $o.Name $pc[$c][1] = TCPNameToIP($pc[$c][0]) $pc[0][0] = $c $c += 1 EndIf Next ReDim $pc[$c][2] Return $pc EndFuncI am having real problems with this... My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
GaryFrost Posted December 8, 2005 Posted December 8, 2005 $pcs = _GetPCs("MyHome") For $x = 1 To $pcs[0][0] ConsoleWrite($pcs[$x][0] & ", " & $pcs[$x][1] & @LF) Next Func _GetPCs( $sDomain = @COMPUTERNAME ) TCPStartup() Local $oDomain = ObjGet("WinNT://" & $sDomain), $pc[1][2] If @error Then SetError(1) Return "" EndIf $pc[0][0] = 0 For $o In $oDomain If $o.class = "Computer" Then ReDim $pc[UBound($pc) + 1][2] $pc[UBound($pc) - 1][0] = $o.Name $pc[UBound($pc) - 1][1] = TCPNameToIP($pc[UBound($pc) - 1][0]) $pc[0][0] = UBound($pc) - 1 EndIf Next TCPShutdown() Return $pc EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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