Chủ Nhật, 6 tháng 11, 2016

Hướng dẫn build nhanh bộ cài Windows 7 tự nhận driver, cài đặt phần mềm và kích hoạt

Filled under:

Xin chào các bạn! Nếu các bạn có đọc bài viết hướng dẫn xây dựng lại bộ cài đặt Windows 7 hoàn chỉnh từ bộ cài đặt gốc của tôi ắt hản bạn sẽ thấy để build lại thành bộ cài hoàn chỉnh thì rất nhiều thời gian. Cho nên hôm này tôi sẽ hướng dẫn các bạn build nhanh bộ cài Windows 7 tự nhận driver, cài đặt phần mềm và kích hoạt mà không cần phải cài trên máy ảo. Ưu điểm của phương pháp này là nhanh tróng kiểu như dạng mì ăn liền, dễ thực hiện tuy nhiên nó cũng có nhược điểm là lúc cài đặt windows sẽ lâu hơn vì còn phải cài đặt phần mềm trước khi boot vào desktop.


Bạn có thể build bộ cài trên máy tính cài đặt Windows 7/8/8.1 và 10 đều được, yêu cầu bạn phải cài đặt phần mềm UltraISO

Trước tiên bạn tạo một thư mục mới tên là sources chẳng hạn tiếp theo tìm đến bộ cài iso windows 7 chuột phải nó chọn UltraISO=>Mount to driver.. sau đó truy cập ổ ảo vào thư mục sources tìm đến file install.wim copy nó vào thư mục sources mà bạn vừa tạo mới


Trước tiên bạn cần phải biết thông tin của tập tin install.wim này gồm những phiên bản cài đặt nào bằng cách mở cmd lên không cần chạy bằng admin copy lệnh sau vào cmd

dism /get-wiminfo /wimfile:D:\sources\install.wim


Như vậy tập tin install.wim này bao gồm 5 phiên bản windows 7 tương ứng với giá trị index của nó

Tiếp theo bạn tạo mới thêm một thư mục tên mount chẳng hạn mục đích chúng ta sẽ mount tập tin install.wim này vào thư mục mount, sử dụng lệnh sau

dism /mount-wim /wimfile:D:\sources\install.wim /index:5 /mountdir:D:\mount

với index:5 tương ứng với phiên bản Ultimate nếu bạn muốn làm phiên bản khác thay thế giá trị tương ứng với phiên bản.



Sau khi mount xong bạn truy cập thư mục mount tạo mới một thư mục tên Installer lưu ý tên của thư mục không được có khoảng cách nếu có khoảng cách phải ngăn chúng bằng các dấu _ hoặc - hoặc . ví dụ windows_setup




Khi tạo mới xong thư mục Installer bước tiếp theo bạn copy các phần mềm cần cài đặt vào thư mục này


Với drivers bạn có thể sử dụng phần mềm WanDriver 5 hoặc 6 cũng được lưu ý phiên bản x86 và x64. Kích hoạt windows thì bạn cứ sử dụng phần mềm windows loader cũng được.

Khi copy xong những phần mềm cần cài tiếp theo bạn sẽ viết các lệnh script để chạy những phần mềm tương ứng này. chúng ta sẽ viết vào trong notepad sau đó lưu lại thành tập tin setupcomplete.cmd hoặc setupcomplete.bat

Cấu trúc của nó như sau

@echo off
Nội dung
exit

Cấu trúc của dòng lệnh chạy phần mềm

start /wait %systemdrive%\<Đường dẫn>\Tên tập tin.exe /norestart

Ví dụ để cài đặt phần mềm CCleaner đang lưu trong thư mục Installer sử dụng lệnh sau

start /wait %systemdrive%\Installer\ccsetup523.exe /norestart

Tham số  /wait để chỉ việc đợi cài đặt xong phần mềm này rồi mới đến phần mềm khác, tham số /norestart để ngăn không cho phần mềm tự khởi động máy lại.

Nếu bạn muốn chạy cài đặt phần mềm dạng silent bạn phải tìm tham số silent của nó, sử dụng phần mềm universal silent switch fider tìm 


Ví dụ phần mềm CCleaner này có tham số là /S vậy bạn viết đoạn mã hoàn chỉnh là 

start /wait %systemdrive%\Installer\ccsetup523.exe /S /norestart

Cứ như vậy thêm các đoạn mã chạy các phần mềm khác. ví dụ như của tôi là
@echo off
start /wait %systemdrive%\Installer\ccsetup523.exe /S /norestart
start /wait %systemdrive%\Installer\idman626build8.exe /norestart
start /wait %systemdrive%\Installer\K-Lite_Codec_Pack_1244_Full.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /norestart
start /wait %systemdrive%\Installer\Microsoft_Visual_C_Pack_v1.1_Silent.exe /norestart
start /wait %systemdrive%\Installer\NDP462-KB3151800-x86-x64-AllOS-ENU.exe /norestart
start /wait %systemdrive%\Installer\TeamViewer_Setup_vi-iod.exe /norestart
start /wait %systemdrive%\Installer\uiso9_pe.exe /S /norestart
start /wait %systemdrive%\Installer\UniKey-4.0RC2-1101-Setup.exe /VERYSILENT /SUPPRESSMSGBO /norestart
start /wait %systemdrive%\Installer\wrar540vn.exe /norestart
start /wait %systemdrive%\Installer\Drivers\[Win7.x86]WanDrv6.exe /norestart
start /wait %systemdrive%\Installer\WindowsLoader\WindowsLoader.exe /norestart
start /wait %systemdrive%\Installer\RegFiles\Add-copy-as-path-context-menu.reg
start /wait %systemdrive%\Installer\RegFiles\disable_automatic_maintenance.reg
start /wait %systemdrive%\Installer\RegFiles\InstallTakeOwnership.reg
start /wait %systemdrive%\Installer\RegFiles\Make-windows-faster.reg
start /wait %systemdrive%\Installer\RegFiles\OEMInformation.reg
rd /s /q "C:\Installer"
rd /s /q "C:\Drivers"
del %0
exit
Trong đó:
rd /s /q "C:\Installer": Xóa thư mục Installer sau khi đã cài đặt xong
rd /s /q "C:\Drivers": Xóa thư mục Drivers tự sinh ra khi cài đặt WanDriver
del %0: xóa chính tập tin setupcomplete.cmd

Khi có được tập tin setupcomplete.cmd bạn truy cập đường dẫn mount\Windows\Setup tạo mới 1 thư mục tên là scripts và copy tập tin setupcomlete.cmd vào đấy như ví dụ hình bên dưới

gắn kết các thư mục tập tin trong thư mục mount về lại tập tin install.wim sử dụng lệnh

dism /unmount-wim /mountdir:D:\mount /commit


Tạo tập tin trả lời cài đặt windows tự động



Mở Notepad ra copy tất cả các đoạn code bên dưới vào sau đó lưu lại thành autounattend.xml định dạng All files và Encoding là UTF-8

<?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SetupUILanguage>
                    <UILanguage>en-US</UILanguage>
                </SetupUILanguage>
                <InputLocale>1033:00000409</InputLocale>
                <SystemLocale>en-US</SystemLocale>
                <UILanguage>en-US</UILanguage>
                <UserLocale>en-US</UserLocale>
            </component>
            <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SetupUILanguage>
                    <UILanguage>en-US</UILanguage>
                </SetupUILanguage>
                <InputLocale>1033:00000409</InputLocale>
                <SystemLocale>en-US</SystemLocale>
                <UILanguage>en-US</UILanguage>
                <UserLocale>en-US</UserLocale>
            </component>
            <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <Diagnostics>
                    <OptIn>false</OptIn>
                </Diagnostics>
                <UserData>
                    <AcceptEula>true</AcceptEula>
                    <FullName>Administrator</FullName>
                    <Organization>Blog Windows 10</Organization>
                </UserData>
                <EnableFirewall>true</EnableFirewall>
            </component>
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <Diagnostics>
                    <OptIn>false</OptIn>
                </Diagnostics>
                <UserData>
                    <AcceptEula>true</AcceptEula>
                    <FullName>Administrator</FullName>
                    <Organization>Blog Windows 10</Organization>
                </UserData>
                <EnableFirewall>true</EnableFirewall>
            </component>
        </settings>
        <settings pass="generalize">
            <component name="Microsoft-Windows-Security-SPP" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SkipRearm>1</SkipRearm>
            </component>
        </settings>
        <settings pass="generalize">
            <component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SkipRearm>1</SkipRearm>
            </component>
        </settings>
        <settings pass="specialize">
            <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SkipAutoActivation>true</SkipAutoActivation>
            </component>
            <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SkipAutoActivation>true</SkipAutoActivation>
            </component>
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <ComputerName>PC</ComputerName>
                <ProductKey>RHTBY-VWY6D-QJRJ9-JGQ3X-Q2289</ProductKey>
                <TimeZone>SE Asia Standard Time</TimeZone>
            </component>
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <ComputerName>PC</ComputerName>
                <ProductKey>RHTBY-VWY6D-QJRJ9-JGQ3X-Q2289</ProductKey>
        <TimeZone>SE Asia Standard Time</TimeZone>
            </component>
        </settings>
        <settings pass="oobeSystem">
            <component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <InputLocale>1033:00000409</InputLocale>
                <UILanguage>en-US</UILanguage>
                <UserLocale>en-US</UserLocale>
            </component>
            <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <InputLocale>1033:00000409</InputLocale>
                <UILanguage>en-US</UILanguage>
                <UserLocale>en-US</UserLocale>
            </component>
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <RegisteredOwner>Administrator</RegisteredOwner>
                <OOBE>
                    <HideEULAPage>true</HideEULAPage>
                    <NetworkLocation>Work</NetworkLocation>
                    <ProtectYourPC>1</ProtectYourPC>
                    <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                    <SkipMachineOOBE>true</SkipMachineOOBE>
                    <SkipUserOOBE>true</SkipUserOOBE>
                </OOBE>
                <DisableAutoDaylightTimeSet>true</DisableAutoDaylightTimeSet>
                <FirstLogonCommands>
                    <SynchronousCommand wcm:action="add">
                        <RequiresUserInput>false</RequiresUserInput>
                        <Description>Disable Auto Updates</Description>
                        <CommandLine>reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 1 /f</CommandLine>
                    </SynchronousCommand>
                </FirstLogonCommands>
                <AutoLogon>
                    <Password>
                        <Value></Value>
                        <PlainText>true</PlainText>
                    </Password>
                    <Enabled>true</Enabled>
                    <Username>Administrator</Username>
                </AutoLogon>
                <UserAccounts>
                    <LocalAccounts>
                        <LocalAccount wcm:action="add">
                            <Password>
                                <Value></Value>
                                <PlainText>true</PlainText>
                            </Password>
                            <DisplayName>Administrator</DisplayName>
                            <Group>Administrators</Group>
                            <Name>Administrator</Name>
                        </LocalAccount>
                    </LocalAccounts>
                </UserAccounts>
            </component>
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <RegisteredOwner>Administrator</RegisteredOwner>
                <OOBE>
                    <HideEULAPage>true</HideEULAPage>
                    <NetworkLocation>Work</NetworkLocation>
                    <ProtectYourPC>1</ProtectYourPC>
                    <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                    <SkipMachineOOBE>true</SkipMachineOOBE>
                    <SkipUserOOBE>true</SkipUserOOBE>
                </OOBE>
                <DisableAutoDaylightTimeSet>true</DisableAutoDaylightTimeSet>
                <FirstLogonCommands>
                    <SynchronousCommand wcm:action="add">
                        <RequiresUserInput>false</RequiresUserInput>
                        <Description>Disable Auto Updates</Description>
                        <CommandLine>reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 1 /f</CommandLine>
                    </SynchronousCommand>
                </FirstLogonCommands>
                <AutoLogon>
                    <Password>
                        <Value></Value>
                        <PlainText>true</PlainText>
                    </Password>
                    <Enabled>true</Enabled>
                    <Username>Administrator</Username>
                </AutoLogon>
                <UserAccounts>
                    <LocalAccounts>
                        <LocalAccount wcm:action="add">
                            <Password>
                                <Value></Value>
                                <PlainText>true</PlainText>
                            </Password>
                            <DisplayName>Administrator</DisplayName>
                            <Group>Administrators</Group>
                            <Name>Administrator</Name>
                        </LocalAccount>
                    </LocalAccounts>
                </UserAccounts>
            </component>
        </settings>
        <settings pass="offlineServicing">
            <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <EnableLUA>false</EnableLUA>
            </component>
        </settings>
        <settings pass="offlineServicing">
            <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <EnableLUA>false</EnableLUA>
            </component>
        </settings>
    </unattend>
Tập tin autounattend.xml này áp dụng cho cả 2 nền tảng 32 bit và 64 bit. Lưu ý bạn thay key màu đỏ tương ứng với phiên bản của nó.

Cuối cùng bạn chỉ cần mở bộ cài windows 7 gốc bằng phần mềm UltraISO vào thư mục sources của bộ cài xóa tập tin install.wim gốc đi sau đó kéo thả tập tin install.wim mới vào thay thế còn tập tin  autounattend.xml thì kéo vào nằm bên ngoài cùng với thư mục sources

Save as thành file ISO mới lưu xong thì đặt cho nó một cái tên

1 nhận xét: