0

I need to re-set users home folders in bulk to re-apply their folder permissions (the folders already exist). This works when I do it 1 by 1, manually but when I use the following script it only sets the h drive but no permissions so the user can't access the folder. Any ideas?

Get-ADUser -Filter * -SearchBase “ou=myOU,ou=myOU,dc=myDC,dc=myDC” | Foreach-Object{

$sam = $_.SamAccountName
Set-ADuser -Identity $_ -HomeDrive "H:" -HomeDirectory "\\myserver\home$\myfolder\$sam" }

Thanks in advance

P James
  • 3
  • 3
  • 1
    10 seconds on google led me to this: http://stackoverflow.com/questions/25779423/powershell-to-set-folder-permissions – arco444 Apr 13 '15 at 10:26
  • @arco444 thanks, this code works one user a time, I can't seem to modify it to do all of them in the folder – P James Apr 13 '15 at 11:35
  • Point is, that's the code you need to set the permissions. You need to take that and incorporate it into the loop you already have. – arco444 Apr 13 '15 at 11:39
  • @arco444 yeah I understand that, but unfortunately I've been trying for quite a while to do this with no success. I've tried multiple scripts but I can't seem to get anything to do exactly what I need it to. "NTFSFix" software by WiseSoft would do the job, but even that is spitting out errors when I try and run the job. – P James Apr 13 '15 at 12:38
  • Managed to get NTSFFix working on an XP box – P James Apr 13 '15 at 13:13

0 Answers0