Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this should chanage a AD users Home folder and Fix the Wallpaper
- # this assumes that the Account has already been changed in AD
- #domain
- #File Server / Home folder
- $FS = "\\FS01\Home\$env:UserName\"
- #ask for old user account name
- $FSO = Read-Host -Prompt "Please enter old account name"
- # copy Home folder from old to new
- Copy-Item "\\FS01\Home\$FSO\*" "$FS"
- #Open folders to verfy
- Write-Host "Please verify copy" -ForegroundColor Yellow
- explorer.exe "\\FS01\Home\$FSO\"
- explorer.exe $FS
- Pause
- Write-Host "This will delete $FSO's folder..." -ForegroundColor Red
- Pause
- #If verfied Delete old folder
- Remove-Item -Recurse -Force "\\FS01\Home\$FSO\"
- Write-Host " $FSO's folder has been Deleted" -ForegroundColor Red
- Pause
- #Fix wallpaper
- $RegKey ="HKCU:\Control Panel\Desktop\"
- Set-ItemProperty -Path $RegKey -Name Wallpaper -Value C:\Users\$env:UserName\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg
- Get-ItemProperty -Path $RegKey -Name Wallpaper
- # Reload Windows enviroment.
- RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
- Write-Host "Completed Successfuly, This will log you off" -ForegroundColor Green
- Shutdown.exe /l /t 10
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement