Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. # this should chanage a AD users Home folder and Fix the Wallpaper
  2. # this assumes that the Account has already been changed in AD
  3.  
  4. #domain
  5.  
  6. #File Server / Home folder
  7. $FS = "\\FS01\Home\$env:UserName\"
  8. #ask for old user account name
  9. $FSO = Read-Host -Prompt "Please enter old account name"
  10. # copy Home folder from old to new
  11. Copy-Item "\\FS01\Home\$FSO\*" "$FS"
  12.  
  13. #Open folders to verfy
  14. Write-Host "Please verify copy" -ForegroundColor Yellow
  15. explorer.exe "\\FS01\Home\$FSO\"
  16. explorer.exe $FS
  17. Pause
  18. Write-Host "This will delete $FSO's folder..." -ForegroundColor Red
  19. Pause
  20. #If verfied Delete old folder
  21. Remove-Item -Recurse -Force "\\FS01\Home\$FSO\"
  22. Write-Host " $FSO's folder has been Deleted" -ForegroundColor Red
  23. Pause
  24. #Fix wallpaper
  25. $RegKey ="HKCU:\Control Panel\Desktop\"
  26. Set-ItemProperty -Path $RegKey -Name Wallpaper -Value C:\Users\$env:UserName\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg
  27. Get-ItemProperty -Path $RegKey -Name Wallpaper
  28.  
  29. # Reload Windows enviroment.
  30. RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
  31.  
  32. Write-Host "Completed Successfuly, This will log you off" -ForegroundColor Green
  33. Shutdown.exe /l /t 10
  34. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement