5 July 2016

Windows XP -> Windows 7 refresh script (part 1 - software report)

   For refresh-replace computer from Windows XP to Windows 7 (8...10) we can use small bat script. In generally this is only first part migration package.
   Script checked installed software from several hives, made report on txt file in format software_list_%COMPUTERNAME%.txt and did %COMPUTERNAME% folder on ohter directory for other backup actions (screenshoots of installed programms and screenshoot XP-msinfo32 for paperwork, migration file etc.)

cls
set drive=%~d0
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
find "DisplayName" temp1.txt | find /v "ParentDisplayName"> temp2.txt
for /f "tokens=2,3 delims==" %%a in (temp2.txt) do (echo %%a>>Backup_list\software_list_%COMPUTERNAME%.txt)
mkdir %drive%\Backup\%COMPUTERNAME%
::move software_list_%COMPUTERNAME%.txt
del temp1.txt temp2.txt

   Second part of package take host name and MAC adressand assign replacement name for report. Script checked powershell folder on computer and created report file in format sn_new_%your_name%.txt or old if data from Windows XP.

@echo off
set drive=%~d0
set /p station=Enter the NUMBER of station:%=%
::set /p status=Enter the STATUS of station:%=%
IF EXIST C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (
set status=new
) ELSE (
set status=old
)
@echo NUMBER of station %station%
echo %COMPUTERNAME%>>%drive%\Backup\DC30\sn_%status%_%STATION%.txt
getmac >>%drive%\Backup\DC30\sn_%status%_%STATION%.txt


No comments:

Post a Comment