Search domain workstations for file existence

Started by jpaton, August 27, 2013, 07:09:43 AM

Previous topic - Next topic

jpaton

Does anyone know of a way to search all active workstations in a windows domain for a file existence?

Deana

No single function to handle this. I suspect you would need to get a list of all the computers in the domain then search tem individually. What kind of access do you have to all the computers in the domain? Via Windows Share or FTP?
Deana F.
Technical Support
Wilson WindowWare Inc.

jpaton

I have full access to all the computers using the windows share (c$).

Deana

To get started you will need to get a list of Servers. This can be accomplished using the Win32 Network Extender function wntResources2 or the using ADSI extender:

Code (winbatch) Select

;List all servers in the current Domain
;Load Appropriate Extender
AddExtender("WWADS44I.DLL",0,"WWADS64I.DLL")

; Construct the full domain ADSI path.
ServerDn = dsGetProperty("LDAP://rootDSE", "serverName")
ServerName = ItemExtract(1, ServerDn, ",")
ServerName = ItemExtract(2, ServerName, "=")
ServerDn = dsGetProperty("LDAP://rootDSE", "defaultNamingContext")
ServerPath = "LDAP://%ServerName%/%ServerDN%"
sFilter = `(objectCategory=computer)`

MyOuPaths = dsFindPath(ServerPath, sFilter)
oucount = ItemCount(myoupaths,@TAB)
serverlist = ''
For x = 1 To oucount
   ou = ItemExtract(x,myoupaths,@TAB)
   objServer = ObjectGet(ou)
   cn = objServer.CN
   if serverlist == '' then  serverlist = '\\': cn :'\C$'
else serverlist = serverlist : @TAB : '\\': cn :'\C$'
   objServer = 0
Next
AskItemlist( 'Server list', StrTrim( serverlist ), @TAB, @UNSORTED, @SINGLE )
Exit


Now that you have a list of servers you can search each on for a file using the File Search Extender.
Deana F.
Technical Support
Wilson WindowWare Inc.

td

If you are just checking file existence and not also checking file contents, it would be best to use the File and Folder Finder extender instead of the Search extender.  The FAF extender can handle long paths+filenames, were as the Search extender is limited to MAXPATH.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade