Jump to content

Recommended Posts

Posted

Hello,

 

We have inherited a network. I think there are home folders for accounts that no longer exist. Does anyone have a quick method to identify these please?

 

Thanks

Posted
Add the Owner column to explorer. If the account has been deleted, it'll just show the SID of the account instead of the username. If they're not ownership linked to usernames, you can bulk link them with chown (that's how I do it anyway) which is useful for quotas/FSRM etc.
Posted

G'Day

 

Ive used the below to check the homedrive folders against AD which then outputs to a txt file. I did then have another powershell script that reads the text file and deletes the folders, i cant find this at the moment as i am away. i'll have a look next week when im back. Hope this helps for now

 

---------------------------------------------

$student = Get-ChildItem **folder to check goes here**

foreach ($stu in $student)

{

#Write-Host $stu

try

{

get-aduser "$stu" -Properties * |select enabled,name,samaccountname

 

}

Catch

{write-Host User $stu was not found in Active Directory ... -ForegroundColor red

$stu>>c:\NotInAD.txt

 

}

 

 

}

 

-----------------------------------

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