View Single Post
Old 06-14-2009   #6 (permalink)
Cary Shultz


 
 

Re: recursive directory search

Jeremy,

Sorta off topic......but you did mention this ('dead computers').....

Joe Richards has a set of tools at http://www.joeware.net that are simply
out of this world. oldcmp is the one that you want to use to clean up your
computer account objects in AD. It is an awesome tool. He has others as
well (adfind and admod are two.....).

I just finished running - over a couple of weeks - oldcmp and in some 45
environments removed some 550 dead computer account objects. This does not
include the two clients where there are more than 80 dead accounts each.

Stongly suggest that you take a look......you will be very pleased with his
tools.

And, Al is correct....there is no way that you will *always* get *every*
computer....But I know that you know this already.

To get back on topic.......I like ping....consider something like this:

Set objShell = CreateObject("WScript.Shell")
strCommand = "%comspec% /c ping.exe -n 3 -w 1000 " & strComputer & ""
Set objExecObject = objShell.Exec(strCommand)

HTH,

Cary

"Jeremy" <Jeremy@xxxxxx> wrote in message
news:3D3742E7-BDA2-4C63-8518-FD4ED51F1402@xxxxxx
Quote:

>I modified the following script from one I found on the web. It searches
> through an array of computers and lists all of the user folders found
> within
> the documents and settings folders on my student computers. Would it be
> easy
> to replace the array with something like 047ds* to just search all student
> computers in my building?
> Thanks, Jeremy
>
> CODE
> ----------------
> '=========
> arrServers = Array(_
> "047ds-c303-21.student.cssd.ab.ca",_
> "047ds-c312-20.student.cssd.ab.ca",_
> "047ds-cts-05"
> )
>
> strOutputFile = "StudentComputerProfiles.txt"
> strStartFolder = "C:\Documents and Settings"
>
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
>
> strResults = "Existing Profiles on student computers"
> For Each strServer In arrServers
> strFolder = "\\" & strServer & "\" & Replace(strStartFolder, ":",
> "$")
> For Each objSubFolder In objFSO.GetFolder(strFolder).SubFolders
> strResults = strResults & VbCrLf & strServer & " - " &
> objSubFolder.Name
> Next
> Next
>
> Set objOutputFile = objFSO.CreateTextFile(strOutputFile, True)
> objOutputFile.Write strResults
> objOutputFile.Close
> Set objOutputFile = Nothing
> Set objFSO = Nothing
>
> MsgBox "Finished. Please see " & strOutputFile
> '=========
My System SpecsSystem Spec