windows 7 - Creating batch to remotely recreate user win 7 profile -
i'm making batch below in win 7 corporate environment recreates users profile remotely. know code more efficient, works except registry entry on users computer profile needs removed. i'm not sure how find specific entry , delete it. guys take look? also, code improvements welcomed. i'm still having issues whole "rwm" graphic @ top, that's not important right now. you'll see if open batch.
@echo off mode 75,30 ::notes ::remote workstation manager beta unreleased :: :: :start cls title remote workstation manager beta unreleased ::declarations setlocal enabledelayedexpansion set date=%date:~4,2%%date:~7,2%%date:~10,4%% color 0a echo.&echo.&echo.&echo.&echo.&echo. set /p ".= "<nul &call :color 0e " ###### # # # # " end&echo. set /p ".= "<nul &call :color 0e " # # # # # ## ## " end&echo. set /p ".= "<nul &call :color 0e " # # # # # # # # # " end&echo. set /p ".= "<nul &call :color 0e " ###### # # # # # # " end&echo. set /p ".= "<nul &call :color 0e " # # ### # # # ### # # " end&echo. set /p ".= "<nul &call :color 0e " # # ### # # # ### # # " end&echo. set /p ".= "<nul &call :color 0e " # # ### ## ## ### # # " end&echo. echo. set /p ".= "<nul &call :color 09 "=================================" end&echo. set /p ".= "<nul &call :color 09 "=" &call :color 0c " r" &call :color 0f "emote" &call :color 0c " w" &call :color 0f "orkstation" &call :color 0c " m" &call :color 0f "anager v1" &call :color 09 " =" end&echo. set /p ".= "<nul &call :color 09 "=================================" end&echo.&echo.&echo. echo 1. - recreate windows user profile ::restarts users laptop , when @ login screen echo.0. - exits set /p input=choose number , press enter: if %input%==1 goto :1 if %input%==0 goto :0 :1 cls @echo off title recreating windows profile set /p ip= enter computers ip or workstation name: echo ip %ip% set /p username= enter users euid: echo username %username% cls echo press enter restart users machine. echo. pause xcopy "\\utils\h$\utilities\restore.bat" "\\%ip%\c$\programdata\microsoft\windows\start menu\programs\startup" /i /y cls echo restarting users pc . . . @echo off shutdown -r -f -t 1 -m \\%ip% @echo off :loop timeout /t 15 ping -n 1 %ip% >null if %errorlevel% equ 0 goto :loop if %errorlevel% equ 1 goto :continue2 :continue2 cls @echo off echo waiting startup . . . :retry timeout /t 2 if not exist "\\%ip%\c$\users\%username%\" goto :retry if exist "\\%ip%\c$\users\%username%\" goto :continue3 :continue3 timeout /t 10 cls echo refreshing profile . . . rmdir "\\%ip%\c$\users\temp" /s /q rmdir "\\%ip%\c$\users\temp.cof" /s /q rename "\\%ip%\c$\users\%username%" %username%.%date% echo. echo complete. timeout /t 10 cls echo waiting user log in . . . :retry2 sleep 2 if not exist "\\%ip%\c$\users\%username%\" goto :retry2 if exist "\\%ip%\c$\users\%username%\" goto :continue4 :continue4 cls echo completed. wait new profile created , verify users data has been restored. echo. pause goto :start 0: exit
you might use tool designed task (deleting user profile cleanly, both folder view , registry view) delprof http://www.microsoft.com/en-us/download/details.aspx?id=5405&751be11f-ede8-5a0c-058c-2ee190a24fa6=true task. might have new (unofficial) tool called delprof 2 (http://www.edugeek.net/forums/windows-7/75098-delprof2-unofficial-successor-microsoft-s-delprof-user-profile-deletion-tool.html)
you might explain more mean "recreate" user profile, mean wipe user profile , let windows recreate , add batch startup folder customization ?
Comments
Post a Comment