Jump to content

Recommended Posts

Posted

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

 

Dan

Posted
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.
Posted

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"
End If

 

 

Dan

Posted
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

 

Dan

 

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.

 

Id have a look and see before doing it if its true or not.

Posted
i should have 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"
End If

 

I love it when people go out of their way to make life difficult :-)

 

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:

="robocopy \\fileserver1\h-" & A1 & " \\nasbox\backup\" & A1 & " /move /s /r:1 /w:1 /b"

and in column C put:

="net share h-" &A1 & " /d"

 

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.

 

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:

 

set oShell=createobject("wscript.shell")
sCmd="robocopy \\fileserver1\h-" & sUser & " \\nasbox\backup\" & sUser & " /move /s /r:1 /w:1 /b"
oShell.run sCmd,,true

Posted

@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 \h-

Posted
You have to check time since last login across all DC's

 

Ben

 

If it's a Windows 2003 network then this is no longer necessary; lastlogontimestamp is replicated across all DCs

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...