批处理文件从mutiple pc复制到一个位置。

时间:2022-11-15 19:52:56

Once a month I re-image 30 machines. The new hires move to other machines and I have to move their data to a server and then pull it back down once I setup new machines. I can do this for one machine with a Menu I created

一个月一次,我重新拍摄30台机器。新员工转到其他机器上,我必须把他们的数据转移到服务器上,然后在我安装新机器后再把它拉下来。我可以用我创建的菜单为一台机器做这个。

I want to copy this data to and fro

我想把这个数据复制过来。

Desktop My Docs Favorites and some other files (I can do this with a batch now but for one machine)

我的文档收藏夹和其他一些文件(我现在可以用一个批处理,但是对于一台机器)

Would this be possible to do with a list of computers and users .txt files so there is 0 interaction?

这是否可能与一个计算机和用户的列表有关。txt文件所以有0个相互作用?

Windows Environment and here is the code

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 个解决方案

#1


0  

You can use psexec to run commands on different computers within your network. See this post: https://serverfault.com/a/330049/101509. Good luck! :)

您可以使用psexec在您的网络中的不同计算机上运行命令。看到这篇文章:https://serverfault.com/a/330049/101509。好运!:)

#1


0  

You can use psexec to run commands on different computers within your network. See this post: https://serverfault.com/a/330049/101509. Good luck! :)

您可以使用psexec在您的网络中的不同计算机上运行命令。看到这篇文章:https://serverfault.com/a/330049/101509。好运!:)