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

Round Robin is killing performance on our network

WMI Repository 4GB limit - Win 2003 Ent Question

Change home folder default permission?