Пакетный файл для копирования из нескольких штук в одно место - PullRequest
2 голосов
/ 26 января 2012

Раз в месяц я переизображаю 30 машин. Новые сотрудники перемещаются на другие машины, и мне нужно перенести их данные на сервер, а затем перенести их обратно, когда я настраиваю новые машины. Я могу сделать это для одной машины с помощью меню, которое я создал

Я хочу скопировать эти данные туда и сюда

Desktop My Docs Favorites и некоторые другие файлы (теперь я могу сделать это с помощью пакета, но для одного компьютера)

Можно ли это сделать со списком компьютеров и пользователей .txt-файлов, чтобы было 0 взаимодействий?

Окружение Windows и вот код

@ECHO OFF
@echo off
@ECHO
color 4E
CLS
@ECHO OFF 
:MENU
@ECHO 
@ECHO ***************************************************************
@ECHO **************************January 2012*************************
@ECHO ********************* PCT T00L Windows XP *********************
@ECHO *****************DO NOT USE ON CLASS MACHINES******************
@ECHO ***************************************************************
ECHO 1   Backup Profile           20  cCleaner
ECHO 2   Import Profile           21  aTf
ECHO 3   ...                      22  Control Panel
ECHO 4   Soft Clean PC            23  Remove Flash
ECHO 5   ...                      24  Remove Lotus Notes
ECHO 6   ...                      25  ...
ECHO 7   ...                      26  ...
ECHO 8   ...                      27  ...
ECHO 9   ...                      28  ...
ECHO 10  ...                      00  ...
ECHO.
SET /P M=Choose Option or press 0 to Exit, then press ENTER:
IF %M%==00 GOTO EXIT
IF %M%==1 GOTO Backup Profile
IF %M%==2 GOTO Import Profile
IF %M%==3 GOTO Decrypt
IF %M%==4 GOTO SoftClean
IF %M%==5 GOTO Finish
IF %M%==6 GOTO DLP
IF %M%==7 GOTO 
IF %M%==8 GOTO 
IF %M%==9 GOTO 
IF %M%==10 GOTO 
IF %M%==11 GOTO 
IF %M%==12 GOTO 
IF %M%==13 GOTO
IF %M%==14 GOTO
IF %M%==15 GOTO
IF %M%==16 GOTO 
IF %M%==17 GOTO 
IF %M%==18 GOTO 
IF %M%==19 GOTO
IF %M%==20 GOTO cCleaner
IF %M%==21 GOTO aTf
IF %M%==22 GOTO Control Panel
IF %M%==23 GOTO Flash
IF %M%==24 GOTO LnotesRemove
IF %M%==25 GOTO
IF %M%==26 GOTO
IF %M%==27 GOTO
IF %M%==28 GOTO
IF %M%==29 GOTO
IF %M%==30 GOTO
:Backup Profile
REG export HKEY_CURRENT_USER\Network "C:\Documents and Settings\%username%\desktop\network.reg"
REG export HKEY_CURRENT_USER\Printers "C:\Documents and Settings\%username%\desktop\printers.reg"
ECHO Printers and Network drives have been save to the desktop....Please press enter to continue backup
pause
MD "\\nw974724\steve\%username%\Root"
MD "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data"
MD "\\nw974724\steve\%username%\Documents and Settings\%username%\Desktop"
MD "\\nw974724\steve\%username%\Documents and Settings\%username%\My Documents"
MD "\\nw974724\steve\%username%\Documents and Settings\%username%\Favorites"
MD "\\nw974724\steve\%username%\Documents and Settings\%username%\SametimeMeetings"
MD "\\nw974724\steve\%username%\Documents and Settings\%username%\SametimeTranscripts"
XCOPY c:\ \\nw974724\steve\%username%\root /e /s /y /EXCLUDE:\\nw974724\steve\folders.txt
xcopy "C:\Documents and Settings\%username%\*.*" "\\nw974724\steve\%username%\Documents and Settings\%username%\*.*"
copy "C:\Program Files\Lotus\Notes\Data\names.nsf" "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\names.nsf"
copy "C:\Program Files\Lotus\Notes\Data\headline.nsf" "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\headline.nsf"
copy "C:\Program Files\Lotus\Notes\Data\%username%.id" "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\%username%.id"
copy "C:\Program Files\Lotus\Notes\Data\user.dic" "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\user.dic"
copy "C:\Program Files\Lotus\Notes\Data\desktop6.ndk" "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\desktop6.ndk"
xcopy /s /h /x /f /r /k /i /e "C:\Program Files\PASSPORT\Sessions" "\\nw974724\steve\%username%\Program Files\PASSPORT\Sessions"
xcopy /y /s /h /x /f /r /k /i /e "C:\Documents and Settings\%username%\Desktop" "\\nw974724\steve\%username%\Documents and Settings\%username%\Desktop"
xcopy /y /s /h /x /f /r /k /i /e "C:\Documents and Settings\%username%\My Documents" "\\nw974724\steve\%username%\Documents and Settings\%username%\My Documents"
xcopy /y /s /h /x /f /r /k /i /e "C:\Documents and Settings\%username%\Favorites" "\\nw974724\steve\%username%\Documents and Settings\%username%\Favorites"
xcopy /y /s /h /x /f /r /k /i /e "C:\Documents and Settings\%username%\SametimeMeetings" "\\nw974724\steve\%username%\Documents and Settings\%username%\SametimeMeetings"
xcopy /y /s /h /x /f /r /k /i /e "C:\Documents and Settings\%username%\SametimeTranscripts" "\\nw974724\steve\%username%\Documents and Settings\%username%\SametimeTranscripts"
xcopy c:\*.* "\\nw974724\steve\%username%\root\"
GOTO MENU
:Import Profile
xcopy "\\nw974724\steve\%username%\root" c:\
copy "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\names.nsf" "c:\Program Files\Lotus\Notes\Data\names.nsf"
copy "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\headline.nsf" "c:\Program Files\Lotus\Notes\Data\headline.nsf"
copy "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\%username%.id" "c:\Program Files\Lotus\Notes\Data\%username%.id"
copy "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\user.dic" "c:\Program Files\Lotus\Notes\Data\user.dic"
copy "\\nw974724\steve\%username%\Program Files\Lotus\Notes\Data\desktop6.ndk" "c:\Program Files\Lotus\Notes\Data\desktop6.ndk"
xcopy /s /h /x /f /r /k /i /e ""\\nw974724\steve\%username%\Program Files\PASSPORT\Sessions" "c:\Program Files\PASSPORT\Sessions"
xcopy ""\\nw974724\steve\%username%\Documents and Settings\%username%\*.*" "c:\Documents and Settings\%username%\*.*"
xcopy /s /h /x /f /r /k /i /e "\\nw974724\steve\%username%\Documents and Settings\%username%\Desktop" "c:\Documents and Settings\%username%\Desktop"
xcopy /s /h /x /f /r /k /i /e "\\nw974724\steve\%username%\Documents and Settings\%username%\My Documents" "c:\Documents and Settings\%username%\My Documents"
xcopy /s /h /x /f /r /k /i /e "\\nw974724\steve\%username%\Documents and Settings\%username%\Favorites" "c:\Documents and Settings\%username%\Favorites"
xcopy /s /h /x /f /r /k /i /e "\\nw974724\steve\%username%\Documents and Settings\%username%\SametimeMeetings" "c:\Documents and Settings\%username%\SametimeMeetings"
xcopy /s /h /x /f /r /k /i /e "\\nw974724\steve\%username%\Documents and Settings\%username%\SametimeTranscripts" "c:\Documents and Settings\%username%\SametimeTranscripts"
GOTO MENU
:DLP
call taskkill  /im  edpa.exe  /im  wdp.exe  /f
call cmd.exe
cls
GOTO MENU
:Finish
cd\
cd pstools
psexec run@classroom_date.txt -c -f -u nwie\collis20 -p dec.2011 c:\
cls
:Decrypt
:SoftClean
DEL /S /Q /F "C:\Program Files\LOTUS\NOTES\Data\Cache.NDK"
DEL /S /Q /F "C:\Documents and Settings\"%username%"\Local Settings\Temp"
DEL /S /Q /F "C:\TEMP\"
DEL /S /Q /F "C:\WINXP\Temp\"
DEL /S /Q /F "C:\Documents and Settings\%username%\Application Data\Microsoft\Office\Recent\*.*"
DEL /S /Q /F "C:\Documents and Settings\%username%\Application Data\Macromedia\Flash Player\#SharedObjects\*.*"
DEL /S /Q /F "C:\Documents and Settings\%username%\Local Settings\Temporary Internet Files\*.*"
DEL /S /Q /F "C:\Documents and Settings\%username%\Recent\*.*"
DEL /S /Q /F "C:\Documents and Settings\Administrator\Recent\*.*"
DEL /S /Q /F "C:\Documents and Settings\Administrator\local settings\temp\*.*"
DEL /S /Q /F "C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\*.*"
DEL /S /Q /F "C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\*.*"
DEL /S /Q /F "C:\Documents and Settings\%USERNAME%\Application Data\Macromedia\Flash Player\macromedia.com\support\*.*"
DEL /S /Q /F "C:\Documents and Settings\%username%\Application Data\Mozilla\Firefox\Profiles\*.*"
CLS
GOTO MENU
:Control Panel
start appwiz.cpl
GOTO MENU
:cCleaner
start "\\nw974724\steve\m1n3\apps\ccleaner.exe
GOTO MENU
:aTf
start "\\nw974724\steve\m1n3\apps\ATF-Cleaner.exe
GOTO MENU
:Flash
start "\\nw974724\steve\m1n3\apps\uninstall_flash_player.exe
:LnotesRemove
ECHO Lotus Notes Data is being backed up.
xcopy "C:\Program Files\Lotus\Notes\Data\names.nsf" "c:\Documents and Settings\%username%\Desktop\Notes_Data\names.nsf"
xcopy "C:\Program Files\Lotus\Notes\Data\headline.nsf" "c:\Documents and Settings\%username%\Desktop\Notes_Data\headline.nsf"
xcopy "C:\Program Files\Lotus\Notes\Data\%username%.id" "c:\Documents and Settings\%username%\Desktop\Notes_Data\%username%.id"
xcopy "C:\Program Files\Lotus\Notes\Data\user.dic" "c:\Documents and Settings\%username%\Desktop\Notes_Data\user.dic"
xcopy "C:\Program Files\Lotus\Notes\Data\desktop6.ndk" "c:\Documents and Settings\%username%\Desktop\Notes_Data\desktop6.ndk"
ECHP Are you sure you want to remove Lotus Notes
pause
wmic
/node:%computername% product where name="Lotus Notes 8.0.2" call uninstall
/node:%computername% product where name="Lotus Connections Plug-ins" call uninstall
/node:%computername% product where name="Lotus Quickr connectors" call uninstall
exit
CLS
GOTO MENU

1 Ответ

0 голосов
/ 07 февраля 2012

Вы можете использовать psexec для запуска команд на разных компьютерах в вашей сети.Смотрите это сообщение: https://serverfault.com/a/330049/101509. Удачи!:)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...