Finding Orphaned Home Folders

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

I'm looking for a way to use "native" (2000/2003 or
Resource Kit) tools to locate orphaned folders.

Orphaned meaning that the user no longer exists in AD, but
their home folder or any shared folder owned by the user
account still exists.

In this instance it is important to avoid the use of 3rd
party utilities due to a cilent vendor relationship.

Thanks for any pointers.

Nathan
 
I guess a script is what you want...

You could compare folders in your home folder store against existing
usernames - and delete the ones that don't match.


--

Paul Williams
_________________________________________
http://www.msresource.net


Join us in our new forums!
http://forums.msresource.net
_________________________________________


I'm looking for a way to use "native" (2000/2003 or
Resource Kit) tools to locate orphaned folders.

Orphaned meaning that the user no longer exists in AD, but
their home folder or any shared folder owned by the user
account still exists.

In this instance it is important to avoid the use of 3rd
party utilities due to a cilent vendor relationship.

Thanks for any pointers.

Nathan
 
Yep, but how at the command prompt would I check the owner
of a folder and compare it against AD? I guess it's a
syntax thing I need in a way. :)

It's not as easy as just looking at it with the eyes,
there are simply too many user accounts to look at. We've
got more Administrators than some AD's have Users. ;)
 
Well, I' not a scripter (yet), but I guess you would iterate through the
directory that houses the profiles saying does this folder name match a
user? Yes - leave alone; no - move it to a folder called delete pending.

Or something like that.

Obviously, this assumes your home folders have the same name as the users
logon name.


--

Paul Williams
_________________________________________
http://www.msresource.net


Join us in our new forums!
http://forums.msresource.net
_________________________________________


Yep, but how at the command prompt would I check the owner
of a folder and compare it against AD? I guess it's a
syntax thing I need in a way. :)

It's not as easy as just looking at it with the eyes,
there are simply too many user accounts to look at. We've
got more Administrators than some AD's have Users. ;)
 
dump the lanmanserver share keys; dump the users and associcated home dirs.
Use aany number of utilities and uind unique entries in the lanmanserver
entries... in other words there is a share but not a user that match's up..

this all assumes homedirs were the same name as the SamAccountName
 
This also assumes that you have shared each home folder, not the parent
folder, i.e. \\server\home\user or \\server\userName as opposed to
\\server\home


--

Paul Williams
_________________________________________
http://www.msresource.net


Join us in our new forums!
http://forums.msresource.net
_________________________________________


dump the lanmanserver share keys; dump the users and associcated home dirs.
Use aany number of utilities and uind unique entries in the lanmanserver
entries... in other words there is a share but not a user that match's up..

this all assumes homedirs were the same name as the SamAccountName
 
Yeah, I could just do a XLS inport from multiple sources,
but I need to check "owner" on the user shares. We have a
lot of users who were migrated from NDS (Novell 4.11). In
many cases the name of the users home folder is not the
same as their logon ID.

We are also talking about a large number of shares and a
larger number of users on a large number of servers. :)
Add to that we want to check user created folders
in "group shares" for orphaned by owner and the problem
gets larger. I need a utility where I can input the path
and it checks each folder's owner to see if the AD user
exists.

I've been doing some digging and found some WSH resources
that have me headed in the right direction. I found a C
source file that does exactly what I need, but once
compiled the customer (I work for the vendor) would call
it a "3rd party utility" and require testing/approval
before use.

I know the programming logic behind it, so now it's just
about learning WSH enough to make something that works by
weeks end. Too bad once it's done I won't be allowed to
post it here without getting a lot of signatures. ;)
 
It is \\server\home that is shared, we have too many users
to give each user their own share name. It's not hard to
get the data he suggested though, just a "dir" output from
\\share\home would give me what's needed in that case.
See my other post though about why this simple solution
won't meet the client's needs. :)
 
I've been working on my solution for my original post. I
have been unable to find how to get a string with the
Owner of a given folder or file.

Here's a small snippet and if nobody has input by tomorrow
morning I'll just post this question in some VBscript or
WSH section of the usenet.

-- BEGIN SCRIPT --

ShowFolders "c:\nathan\testarea"

Function ShowFolders(folderspec)
Dim flist, folder, folders, out, fobject
Set fobject = CreateObject("Scripting.FileSystemObject")
Set flist = fobject.GetFolder(folderspec)
Set folders = flist.SubFolders
For Each folder in folders
WScript.Echo folder & " " &
folder.DateLastAccessed & " " & folder.Size
out = out & folder.name
out = out & " "
Next
FolderList = out
End Function

-- END SCRIPT --

As you can see folder.DateLastAccessed gives me the "Last
Accessed" details, but I can't find the equivelant
property for "Owner".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top