User Home folders
I've recently had a clean up of our active directory and found nearly 900 user accounts that haven't logged in, in the past 6 months.
What i'm wanting to do is to remove (move them to an external NAS unit!) all the home folders that are associated with these users, but i don't fancy shifting through 900 folders manually
anyone got any recommendations
Without sitting down and actually writing the script, I would recommend that you disable all the unused accounts and then have a script that reads the relevant homedrive variable from AD for all the disabled accounts. If a drive exists, it should move it.
I was looking for this a couple of weeks ago..
This is hidden on here somewhere... Orphaned Files Finder
i should of mentioned in my first post we don't use the 'Home Folder' Local Path under the Profile Tab on AD to map our drives we have a logon.vbs script that runs and in the script there is a few lines that say
If Not MapDrive("H:", "\\fileserverone\h-" & strUser) Then
MsgBox "Unable to Map H: to userarea"
From memory when i was on my MCSA course there was a warning that the time since login isnt accurate unless you have a certain feature activated in the group policy.
Originally Posted by DanW
Id have a look and see before doing it if its true or not.
I love it when people go out of their way to make life difficult :-)
Originally Posted by DanW
Have you got a list of the users that you're working on? If so, a quick fix is to load that into Excel - you'll get a list in Column A (eg)
In column B you put something like:
and in column C put:
="robocopy \\fileserver1\h-" & A1 & " \\nasbox\backup\" & A1 & " /move /s /r:1 /w:1 /b"
Fill down columns B and C and you'll get 2 long sets of commands. copy and paste each column into notepad and save as a batch file.
="net share h-" &A1 & " /d"
run the 2 batch files (probably quickest to do the first on the server; the second must be run on the server) and they will move all the files and then delete the shares.
You also need to delete the empty folders - assuming the shared folders are all on the same drive that's easy (another Excel column). If they're not then it's a bit more work!
If you were using a script to find the accounts to expire then you could just add something to that to do the move - if you've got a line which gets the username then something like this:
sCmd="robocopy \\fileserver1\h-" & sUser & " \\nasbox\backup\" & sUser & " /move /s /r:1 /w:1 /b"
You have to check time since last login across all DC's
@DanW: You could always do it the 'normal' way. I assume strUser is the user's username so you just need to bulk select the users and add \\fileserver1\h-%username% into the field.
In fact... ignoring that, if all the users' folders are in the same place then you don't need to interrogate the AD properties - it would just be <path to home folders>\h-<username>
If it's a Windows 2003 network then this is no longer necessary; lastlogontimestamp is replicated across all DCs
Originally Posted by plexer
thanks for all the answers guys i'll have a play in the morning :)