Moving Home Folders of Disabled accounts


there disabled accounts ad.  ( windows 2003)

i got list of disabled accounts, of them have home folder  , profile don’t have ll have.

1: want 1<sup>st</sup> search disabled users have home folder or profile.

2: move home folder , profiles are scattered on multiple file servers, file server backup , deletion. please note there 100s of disabled accounts , home folder on different servers. please helpme  with script job by. way i’m novice ps.

powershell v3

$destpath = "destination path"  search-adaccount -accountdisabled -usersonly | foreach {  if ($_.homedirectory) {  	robocopy /s /move $_.homedirectory.tostring() "$($destpath)\home\$($_.samaccountname)" } if ($_.profilepath) {  	robocopy /s /move $_.profilepath.tostring() "$($destpath)\profile\$($_.samaccountname)" }  }


Сазонов Илья http://isazonov.wordpress.com/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file