Id like a tool that would allow me to enter a path to the location of the home directories on a Windows server (i.e. C:\Users) where all the users home directories are their domain username and get created once they log in. Over the years users have come and gone but there has been no cleanup once they leave so servers have hundreds of home directories but only half or so are still valid.
Access to each server is handled by adding users to one or both of 2 AD groups(S<hostname> and A<hostname>). However, There is a separate team that manages the AD side so I cant run anything on the the AD servers. I need something that I can run from the client servers which are all either Windows Server 2008 R2 or Server 2012 R2.
I'd like to have a tool that would scan the path of the home directories.
For each directory in that path have it check if the foldername is a active domain user.
IF NO have the directory name added to a txt file
If YES then have it check is it a member of either or both AD groups set up for that hostname(S<hostname> and A<hostname>).
If YES then leave it alone;
if NO then either create a txt file of the directory names OR have it move those directories to a different path.