Hi everyone
Hope you can help me
I work for large firm and need to delete left users' home folders from all of the file servers and need to help to get it working
this is what I have and I believe I still need to improve it make correction. AD accounts are deleted manually by helpdesk guys and only thing left is their home folders, these users EMEA users and I need to point script to their relevant file servers to find users home drivers or I can manually run on the server itself may be? It is all depends on script. I prefer something very simple. With this one I having permission issues even though my account has access to delete home folders manually but not via this script, ( I run the powershell as my admin account)
Can you please suggest something? I really appreciate your time and help.
Import-Module ActiveDirectory
$users = Get-Content -path c:\testadusers.txt
$filePath = "\\XX\user$"
foreach ($user in $users) {
Remove-Item $aduser.HomeDirectory
}
$users = Get-Content -path c:\testadusers.txt
$filePath = "\\XX\user$"
foreach ($user in $users) {
Remove-Item $aduser.HomeDirectory
}