Tải bản đầy đủ (.pdf) (8 trang)

Một số điều cần biết về quá trình Sysprep trên Windows 7 – P.1 doc

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (157.05 KB, 8 trang )


Một số điều cần biết về quá trình Sysprep
trên Windows 7 – P.1
Trong bài viết dưới đây, chúng tôi sẽ giới thiệu những thao tác cơ bản về quá trình tạo
Sysprep trong Windows 7. Trên thực tế đã có rất nhiều bài hướng dẫn về cách thức này
trên hệ điều hành Microsoft Windows XP, nhưng để áp dụng được với Windows 7 thì
không phải là điều đơn giản.
Những công cụ cần thiết trong bài thử nghiệm này:
- WAIK (Windows Automated Installation Kit) được cài trên máy tính không dùng để tạo file
image. Nếu muốn tạo file unattend.xml trong toàn bộ quá trình sysprep này, chúng ta sẽ phải
cần tới file image.wim trên đĩa cài đặt của Windows 7.
- Công cụ Mysysprep2
Về cơ bản, quá trình thực hiện của chúng ta sẽ dựa theo trình tự sau: sau khi cài đặt Windows 7
trên máy tính, đăng nhập vào bằng account domain đã được gán quyền Administrator (và đã
được gán vào nhóm Administrators). Tài khoản này không được phép sử dụng bất kỳ script hoặc
policy nào, trong bài thử nghiệm này, chúng tôi sử dụng account domain (với tên là imageprep),
và các phần mềm cần cài đặt sẽ được lưu trữ trên thư mục DFS chia sẻ. Khi thực hiện hệ thống
theo cách này thì tất cả các ứng dụng khi muốn repair sẽ dễ dàng tìm được file cài đặt gốc. Sau
đó, chúng ta sẽ cài tất cả các chương trình cần thiết, cập nhật Windows, tạo các tài khoản local,
thiết lập chế độ profile theo ý muốn. Toàn bộ profile này sẽ trở thành profile mặc định của máy
tính sau này trong file image.
Khi mọi thứ đã được chuẩn bị kỹ càng, chúng ta sẽ phải tạo file answer unattend.xml bằng công
cụ Windows System Image Manager (Windows SIM) trên 1 máy tính khác có cài đặt WAIK.
Sau khi cài thành công, các bạn hãy chạy Windows SIM từ Start Menu và thực hiện tiếp các
bước sau:
- Cho đĩa cài đặt Windows 7 vào ổ DVD
- Khởi động Windows SIM, từ menu các bạn chọn Tools > Create Catalog, hệ thống sẽ yêu cầu
file install.wim trên đĩa cài gốc, chúng ta chỉ việc trỏ tới thư mục sources. Khi quá trình tạo
catalog này hoàn tất, hệ thống sẽ sẵn sàng với việc thiết lập và cấu hình file answer.
1 trong những yêu cầu của chúng ta là sysprep sẽ yêu cầu người dùng khởi tạo tên máy tính trước
khi gán vào domain chung trong hệ thống. Tuy nhiên, quá trình này lại nảy sinh thêm 1 vấn đề


khác, đó là khi sử dụng file answer unattend.xml và Windows sysprep, nếu người sử dụng
không khai báo cụ thể tên máy tính trong file, thì hệ thống sẽ tự động gán máy tính đó vào
domain bằng 1 chuỗi tên ngẫu nhiên – random. Cụ thể, nếu bạn xóa bỏ phần
<ComputerName></ComputerName> từ file answer, thì người dùng sẽ được hệ thống yêu cầu
nhập đúng tham số này khi file answer được duyệt trong quá trình sysprep, nhưng nếu như vậy
thì lại quá muộn, vì tại thời điểm đó, máy tính đã được gán vào domain bằng tên random, và do
vậy sẽ có thể gây ra nhiều vấn đề sau này. Nhưng với Mysysprep2, người dùng có thể đặt tên
cho máy tính và gán vào domain sau quá trình xử lý file unattend.xml hoàn tất. Bên cạnh đó,
Mysysprep nên được đặt trong thư mục C:\Windows\System32\Sysprep, bên cạnh sysprep.exe
(không được xóa hoặc đổi tên sysprep.exe).
Dưới đây là file unattend.xml được sử dụng trong bài thử nghiệm này:
1 <?xml version="1.0" encoding="utf-8"?>
2 <unattend xmlns="urn:schemas-microsoft-
com:unattend">
3 <settings pass="generalize">
4 <component name="Microsoft-Windows-
PnpSysprep" processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
5
<PersistAllDeviceInstalls>true</PersistAllD
eviceInstalls>
6 </component>
7 <component name="Microsoft-Windows-
Security-SPP" processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"

xmlns:xsi=" />-instance">
8 <SkipRearm>0</SkipRearm>
9 </component>
10 </settings>
11 <settings pass="specialize">
12 <component name="Microsoft-Windows-IE-
InternetExplorer"
processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
13 <BlockPopups>no</BlockPopups>
14 <CompanyName>Your Company</CompanyName>
15 <CompatibilityViewDomains>Your
Domain</CompatibilityViewDomains>
16
<DisableDataExecutionPrevention>true</Disab
leDataExecutionPrevention>
17
<DisableAccelerators>true</DisableAccelerat
ors>
18 <DisableDevTools>false</DisableDevTools>
19
<DisableFirstRunWizard>true</DisableFirstRu
nWizard>
20
<DisableOOBAccelerators>false</DisableOOBAc
celerators>
21 <EnableLinksBar>true</EnableLinksBar>

22 <FavoritesDelete>false</FavoritesDelete>
23 <FilterLevel>Low</FilterLevel>
24 <GroupTabs>false</GroupTabs>
25 <Home_Page>about:blank</Home_Page>
26 <LockToolbars>true</LockToolbars>
27 <PlaySound>true</PlaySound>
28
<PrivacyAdvisorMode>0</PrivacyAdvisorMode>
29
<ShowInformationBar>true</ShowInformationBa
r>
30 <ShowMenuBar>true</ShowMenuBar>
31
<SuggestedSitesEnabled>false</SuggestedSite
sEnabled>
32
<ShowLeftAddressToolbar>false</ShowLeftAddr
essToolbar>
33
<TabProcessGrowth>Medium</TabProcessGrowth>
34 </component>
35 <component name="Microsoft-Windows-
powercpl" processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
36 <PreferredPlan>0d81a790-d84a-407f-a5e0-
92464dcf560c</PreferredPlan>
37 </component>

38 <component name="Microsoft-Windows-
Security-SPP-UX"
processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
39
<SkipAutoActivation>false</SkipAutoActivati
on>
40 </component>
41 <component name="Microsoft-Windows-
Shell-Setup" processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
42 <Display>
43 <ColorDepth>32</ColorDepth>
44 <DPI>96</DPI>
45
<HorizontalResolution>1366</HorizontalResol
ution>
46 <RefreshRate>60</RefreshRate>
47
<VerticalResolution>768</VerticalResolution
>
48 </Display>
49
<BluetoothTaskbarIconEnabled>false</Bluetoo

thTaskbarIconEnabled>
50 <CopyProfile>true</CopyProfile>
51
<DisableAutoDaylightTimeSet>false</DisableA
utoDaylightTimeSet>
52
<DoNotCleanTaskBar>false</DoNotCleanTaskBar
>
53 <RegisteredOrganization>Organization
Name</RegisteredOrganization>
54 <RegisteredOwner>Registered
Owner</RegisteredOwner>
55 <ShowWindowsLive>false</ShowWindowsLive>
56 <TimeZone>Eastern Standard
Time</TimeZone>
57 <ComputerName>%Please input a computer
name(0,15)%</ComputerName>
58 </component>
59 <component name="Microsoft-Windows-
SystemRestore-Main"
processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
60 <DisableSR>1</DisableSR>
61 </component>
62 <component name="Microsoft-Windows-
UnattendedJoin" processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"

language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
63 <Identification>
64 <Credentials>
65 <Domain>Your Domain</Domain>
66 <Password>Some Password</Password>
67 <Username>Some User</Username>
68 </Credentials>
69 <MachineObjectOU>OU=Re-
Imaged,OU=YourComputers,DC=YourCompany,DC=C
om</MachineObjectOU>
70 <JoinDomain>%Please select a domain to
join{Your Domain}%</JoinDomain>
71 </Identification>
72 </component>
73 </settings>
74 <settings pass="oobeSystem">
75 <component name="Microsoft-Windows-
International-Core"
processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
76 <InputLocale>EN-US</InputLocale>
77 <SystemLocale>EN-US</SystemLocale>
78 <UILanguage>EN-US</UILanguage>
79 <UserLocale>EN-US</UserLocale>
80 </component>

81 <component name="Microsoft-Windows-
Shell-Setup" processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=" />Config/2002/State"
xmlns:xsi=" />-instance">
82 <OOBE>
83 <HideEULAPage>true</HideEULAPage>
84 <NetworkLocation>Other</NetworkLocation>
85 <ProtectYourPC>3</ProtectYourPC>
86
<HideWirelessSetupInOOBE>true</HideWireless
SetupInOOBE>
87 </OOBE>
88 <ShowWindowsLive>false</ShowWindowsLive>
89 <TimeZone>Eastern Standard
Time</TimeZone>
90
<DoNotCleanTaskBar>false</DoNotCleanTaskBar
>
91
<DisableAutoDaylightTimeSet>false</DisableA
utoDaylightTimeSet>
92
<BluetoothTaskbarIconEnabled>false</Bluetoo
thTaskbarIconEnabled>
93 <UserAccounts>
94 <AdministratorPassword>
95 <Value>The Password</Value>
96 <PlainText>false</PlainText>

97 </AdministratorPassword>
98 <LocalAccounts>
99 <LocalAccount wcm:action="add">
100 <Password>
101 <Value>The Password</Value>
102 <PlainText>false</PlainText>
103 </Password>
104 <Description>Temp Local
Account</Description>
105 <DisplayName>TempUser</DisplayName>
106 <Group>Users</Group>
107 <Name>TempUser</Name>
108 </LocalAccount>
109 </LocalAccounts>
110 </UserAccounts>
111 <VisualEffects>
112
<FontSmoothing>ClearType</FontSmoothing>
113 </VisualEffects>
114 </component>
115 </settings>
116 <cpi:offlineImage
cpi:source="wim:c:/zsimx32/install.wim#Wind
ows 7 ENTERPRISE" xmlns:cpi="urn:schemas-
microsoft-com:cpi" />
117 </unattend>
Trước tiên, chúng ta sẽ tìm hiểu về 2 câu lệnh bên dưới:
<ComputerName>%Please input a computer
name(0,15)%</ComputerName>
<JoinDomain>%Please select a domain to

join{your.domain.com}%</JoinDomain>
Có 1 thành phần cụ thể khác khi dùng mysysprep2, đó là hệ thống sẽ hiển thị những thông báo
khác nhau dưới dạng lỗi trong phần SIM nhưng sẽ bỏ qua hoàn toàn các thông tin này, phần
(0,15) trong <ComputerName> sẽ tự động xóa bỏ những ký tự thừa nếu tên máy tính dài quá 15
ký tự. Bên cạnh đó, chúng ta còn thấy:
<CopyProfile>true</CopyProfile>
Câu lệnh trên sẽ yêu cầu sysprep copy toàn bộ thông tin profile mà người sử dụng đã tạo trước
đó thành profile mặc định. Bên cạnh đó, người dùng còn phải chỉ định rõ phần OU để gán máy
tính, nếu không thì thành phần đó sẽ không được gán vào domain của hệ thống:
<MachineObjectOU>OU=Test,DC=Your,DC=Domain,
DC=Here</MachineObjectOU>
1 điểm nữa cần lưu ý với file unattend.xml là chúng ta phải tạo thêm tài khoản local user trong
quá trình xử lý sysprep. Cụ thể, khi người dùng cài đặt Windows 7 bằng đĩa thì chắc chắn phải
tạo local user thì mới đăng nhập được, và quá trình này vẫn tiếp tục xảy ra khi sử dụng file
attend.xml và sysprep. Trong bài thử nghiệm này, chúng tôi đã tạo tài khoản local user có tên là
TempUser – sẽ bị xóa khi đăng nhập lần đầu tiên vào Windows. Mục đích của tài khoản này
được tạo ra chỉ là giấu quá trình tạo local user khi sysprep hoạt động.

×