Jochem Posted September 10, 2009 Share Posted September 10, 2009 I am using till now a script that I found somewhere overhere on the forum to make a networklist: Func _netwerklist($iSrvType = -1, $sDomain = '') Local $uBufPtr = DllStructCreate("ptr;int;int"), $res[1] = [0], $i Local $uRecord = DllStructCreate("dword;ptr"), $iRecLen = DllStructGetSize($uRecord) Local $uString = DllStructCreate("char[16]") Local $uDomain = DllStructCreate("byte[32]"), $pDomain = 0 If Not ($sDomain = '' Or $sDomain = '*') Then DllStructSetData($uDomain, 1, StringToBinary($sDomain, 2)) $pDomain = DllStructGetPtr($uDomain) EndIf Local $ret = DllCall("netapi32.dll", "int", "NetServerEnum", _ "ptr", 0, "int", 100, _ "ptr", DllStructGetPtr($uBufPtr, 1), "int", -1, _ "ptr", DllStructGetPtr($uBufPtr, 2), _ "ptr", DllStructGetPtr($uBufPtr, 3), _ "int", $iSrvType, "ptr", $pDomain, "int", 0) If $ret[0] Then Return SetError(1, $ret[0], '') Local $res[DllStructGetData($uBufPtr, 3) + 1] = [DllStructGetData($uBufPtr, 3)] For $i = 1 To DllStructGetData($uBufPtr, 3) Local $uRecord = DllStructCreate("dword;ptr", DllStructGetData($uBufPtr, 1) + ($i - 1) * $iRecLen) Local $sNBName = DllStructCreate("byte[32]", DllStructGetData($uRecord, 2)) DllStructSetData($uString, 1, BinaryToString(DllStructGetData($sNBName, 1), 2)) $res[$i] = DllStructGetData($uString, 1) Next $ret = DllCall("netapi32.dll", "int", "NetApiBufferFree", "ptr", DllStructGetData($uBufPtr, 1)) Return $res EndFunc ;==>_netwerklist but this is not working over subnets. My knowledge is to little to find-out how I can addapt this script to make it work. Is It possible to make a networklist over subnets? Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 10, 2009 Share Posted September 10, 2009 I am using till now a script that I found somewhere overhere on the forum to make a networklist: Func _netwerklist($iSrvType = -1, $sDomain = '') Local $uBufPtr = DllStructCreate("ptr;int;int"), $res[1] = [0], $i Local $uRecord = DllStructCreate("dword;ptr"), $iRecLen = DllStructGetSize($uRecord) Local $uString = DllStructCreate("char[16]") Local $uDomain = DllStructCreate("byte[32]"), $pDomain = 0 If Not ($sDomain = '' Or $sDomain = '*') Then DllStructSetData($uDomain, 1, StringToBinary($sDomain, 2)) $pDomain = DllStructGetPtr($uDomain) EndIf Local $ret = DllCall("netapi32.dll", "int", "NetServerEnum", _ "ptr", 0, "int", 100, _ "ptr", DllStructGetPtr($uBufPtr, 1), "int", -1, _ "ptr", DllStructGetPtr($uBufPtr, 2), _ "ptr", DllStructGetPtr($uBufPtr, 3), _ "int", $iSrvType, "ptr", $pDomain, "int", 0) If $ret[0] Then Return SetError(1, $ret[0], '') Local $res[DllStructGetData($uBufPtr, 3) + 1] = [DllStructGetData($uBufPtr, 3)] For $i = 1 To DllStructGetData($uBufPtr, 3) Local $uRecord = DllStructCreate("dword;ptr", DllStructGetData($uBufPtr, 1) + ($i - 1) * $iRecLen) Local $sNBName = DllStructCreate("byte[32]", DllStructGetData($uRecord, 2)) DllStructSetData($uString, 1, BinaryToString(DllStructGetData($sNBName, 1), 2)) $res[$i] = DllStructGetData($uString, 1) Next $ret = DllCall("netapi32.dll", "int", "NetApiBufferFree", "ptr", DllStructGetData($uBufPtr, 1)) Return $res EndFunc ;==>_netwerklist but this is not working over subnets. My knowledge is to little to find-out how I can addapt this script to make it work. Is It possible to make a networklist over subnets? I think that is a NetBIOS browser service based query that doesn't mean anything across routed interfaces (outside your VLAN or subnet). You might query your Domain Master Browser (PDC in NT, or PDC Emulator in AD) and get some results from other subnets that are part of the same domain, or maybe you have a WINS server, but don't expect complete results from such a buggy whip method. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
99ojo Posted September 11, 2009 Share Posted September 11, 2009 I think that is a NetBIOS browser service based query that doesn't mean anything across routed interfaces (outside your VLAN or subnet). You might query your Domain Master Browser (PDC in NT, or PDC Emulator in AD) and get some results from other subnets that are part of the same domain, or maybe you have a WINS server, but don't expect complete results from such a buggy whip method. Hi,maybe a simple net view does what you want.;-))Stefan Link to comment Share on other sites More sharing options...
Jochem Posted September 11, 2009 Author Share Posted September 11, 2009 i did it quick and dirty (every subnet is a domain): For $comp = 1 To 100 Step 1 $hostch = "ws-c" & $comp & "." & $dom1 Ping($host) If @error = 0 Then RunWait(@ComSpec & " /c " & "tasklist /s " & $host & " /U:" & $user & " /p:" & $pw & " > " & $taskpath & $host & $taskfile, "", @SW_HIDE) EndIf Next but thanks anyway 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