"BarbS" <BarbS@xxxxxx> wrote in message
>I am trying to write a script to list folders on my local drives. The goal
> to search for word documents and spreadsheets on our users hard drives.
> following basic script is a start. I am log onto my computer as a domain
> admin. The script starts scanning but gives me access denied when it
> \document and settings\administrator folder. If I can not get this to work
> my computer, I will not be able to get it to work on remote computers.
> you for any help.
The domain admin account is obviously not a member of the local
"administrators" group. Sorry, but you will have to find a way to do this
using an account that is a local admin - or possibly a local power user.
> Set FSO = CreateObject("Scripting.FileSystemObject")
> ShowSubfolders FSO.GetFolder("C:\")
> Sub ShowSubFolders(Folder)
> For Each Subfolder in Folder.SubFolders
> Wscript.Echo Subfolder.Path
> ShowSubFolders Subfolder
> End Sub
This kind of thing can be easier to accomplish in batch than in vbscript
for /f %%C in (computerlist.txt) do (
dir /s \\%%C\c$\*.doc
dir /s \\%%C\c$\*.xls
I run scripts like that from my own workstation using a domain account that
is a local administrator on the workstations of interest.