Dampe Posted May 12, 2009 Share Posted May 12, 2009 Anyone written a function that lists all computers on a domain / network? similar to how net view works? P.s, I'm looking for a function that uses queries to find the results, not a function that reads / dumps a cmd screen. Link to comment Share on other sites More sharing options...
Zedna Posted May 12, 2009 Share Posted May 12, 2009 Look at my Net Send GUI wrapperhttp://www.autoitscript.com/forum/index.ph...st&p=343332 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
rajeshontheweb Posted May 12, 2009 Share Posted May 12, 2009 (edited) expandcollapse popupGlobal Const $CSIDL_COMPUTERSNEARME = 0x003D Global $oShell = ObjCreate("Shell.Application") ;#CS #include <Array.au3> $Arr = _FileFindSpecialFolderEx($CSIDL_COMPUTERSNEARME ,1) If IsArray($Arr) Then _ArrayDisplay($Arr) Else ConsoleWrite($Arr) EndIf ;#CE ; ============================================================================================= ; ; Function Name: _FileFindSpecialFolderEx($Folder,[ $ListToArray = 0[, $Filter = 0]]) ; Description: ; Parameter(s): $Folder - The Special folder constant (i.e. $MY_COMPUTER) ; You could also use an existing path (i.e. "C:\Program Files") ; Or a ClassID (i.e. ::{20D04FE0-3AEA-1069-A2D8-08002B30309D} ) ; $ListToArray - (optional) Change the return value: ; 0 = Return the ClassID or Path to the special folder ; 1 = Return an array containing the files within the folder ; $Filter - (optional) Filter out the array by: ; 1 = Files ; 2 = Folders ; 3 = Links ; 4 = ClassId's ; 0 = No Filter (default) ; Requirement(s): None. ; Return Value(s): Returns either: ; 1) A string containing the CLASSID or Path corresponding to the Special folder ; 2) An Array containing the list of files/folder/links within the special folder with the type ; $OutputArray[$i][0] will contain the list of files/folder/links ; $OutputArray[$i][1] will contain the type used by $Filter Parameter ; Returns -1 if there are no results ; Author(s): Rajesh V R for _FileFindSpecialFolderEx _Kurt for _FileFindSpecialFolder ; Modified: 05 May 2009 ; Version: 1.1 includes minor line savings... ; Note(s): See http://www.microsoft.com for more info ; ;================================================================================================= Func _FileFindSpecialFolderEx($Folder, $ListToArray = 0, $Filter = 0) $nPath = $oShell.NameSpace($Folder).Self.Path If StringLeft($nPath, 1) = ":" Or StringLeft($nPath, 1) = ";" Then SetError(2) Else SetError(1) EndIf If $nPath = "" Then $nPath = -1 If $ListToArray = 0 Then Return $nPath $nNum = $oShell.NameSpace($Folder).Items.Count Local $List[$nNum][2], $a = 0, $Itemtype For $i = 0 To $nNum - 1 $CurrentItem = $oShell.NameSpace($Folder).Items.Item($i) If $CurrentItem.IsFileSystem = True Then If $CurrentItem.IsFolder <> True Then $Itemtype = 1 EndIf If $CurrentItem.IsFolder = True Then $Itemtype = 2 If $CurrentItem.IsLink = True Then $Itemtype = 3 If StringLeft($CurrentItem.Path, 1) = ":" Or StringLeft($CurrentItem.Path, 1) = ";" Then $Itemtype = 4 Select Case $Filter = 0 $List[$a][0] = $CurrentItem.Path $List[$a][1] = $Itemtype $a += 1 Case $Filter = $Itemtype $List[$a][0] = $CurrentItem.Path $List[$a][1] = $Itemtype $a += 1 EndSelect Next If $a = 0 Then $List = -1 Else ReDim $List[$a][2] EndIf Return $List EndFunc ;==>_FileFindSpecialFolderEx This will work as long as you are in a network and you have computers to visible in Microsoft Windows Network -> [Your Domain] -> [Neighbour Clients] the above is also achieved using winapi call but not suitable for larger networks. Edited May 12, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet 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