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

Hiểu nôm na là giai đoạn tạo thời điểm để reset Windows 7 về trạng thái nguyên bản

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.xmlWindows 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="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5 <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
6 </component>
7 <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">
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="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
13 <BlockPopups>no</BlockPopups>
14 <CompanyName>Your Company</CompanyName>
15 <CompatibilityViewDomains>Your Domain</CompatibilityViewDomains>
16 <DisableDataExecutionPrevention>true</DisableDataExecutionPrevention>
17 <DisableAccelerators>true</DisableAccelerators>
18 <DisableDevTools>false</DisableDevTools>
19 <DisableFirstRunWizard>true</DisableFirstRunWizard>
20 <DisableOOBAccelerators>false</DisableOOBAccelerators>
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</ShowInformationBar>
30 <ShowMenuBar>true</ShowMenuBar>
31 <SuggestedSitesEnabled>false</SuggestedSitesEnabled>
32 <ShowLeftAddressToolbar>false</ShowLeftAddressToolbar>
33 <TabProcessGrowth>Medium</TabProcessGrowth>
34 </component>
35 <component name="Microsoft-Windows-powercpl" 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">
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="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
39 <SkipAutoActivation>false</SkipAutoActivation>
40 </component>
41 <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">
42 <Display>
43 <ColorDepth>32</ColorDepth>
44 <DPI>96</DPI>
45 <HorizontalResolution>1366</HorizontalResolution>
46 <RefreshRate>60</RefreshRate>
47 <VerticalResolution>768</VerticalResolution>
48 </Display>
49 <BluetoothTaskbarIconEnabled>false</BluetoothTaskbarIconEnabled>
50 <CopyProfile>true</CopyProfile>
51 <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
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="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
60 <DisableSR>1</DisableSR>
61 </component>
62 <component name="Microsoft-Windows-UnattendedJoin" 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">
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=Com</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="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-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="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
82 <OOBE>
83 <HideEULAPage>true</HideEULAPage>
84 <NetworkLocation>Other</NetworkLocation>
85 <ProtectYourPC>3</ProtectYourPC>
86 <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
87 </OOBE>
88 <ShowWindowsLive>false</ShowWindowsLive>
89 <TimeZone>Eastern Standard Time</TimeZone>
90 <DoNotCleanTaskBar>false</DoNotCleanTaskBar>
91 <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
92 <BluetoothTaskbarIconEnabled>false</BluetoothTaskbarIconEnabled>
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#Windows 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.xmlsysprep. 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.


Bên cạnh đó, chúng ta còn có thể sử dụng 1 cách thức khác để thực hiện quá trình này, tuy không được trình bày cụ thể nhưng đem lại hiệu quả khá cao. Cụ thể, trên máy tính chúng ta thực hiện quá trình tạo file image, các bạn hãy mở thư mục C:\Windows\Steup, tạo mới 1 thư mục khác đặt tên là Scripts tại đây. Bên trong đó, chúng ta tạo tiếp 1 file SetupComplete.cmd – có chức năng tự khởi động trước lúc màn hình đăng nhập của Windows bắt đầu. Và đây cũng chính là bước tài khoản TempUser bị xóa.

Để xóa tài khoản TempUser này, các bạn hãy thêm lệnh sau vào SetupComplete.cmd:

net user TempUser /delete

Và kích hoạt tài khoản Administrator bằng lệnh:

net user Administrator /active:yes

Mặc dù có thể bạn đã kích hoạt tài khoản Administrator trên máy tính được dùng để tạo image trước khi sử dụng sysprep, thì tài khoản đó vẫn bị tắt. Để xóa file unattend.xml file, các bạn thêm dòng mã sau vào file SetupComplete.cmd:

del C:\Windows\System32\Sysprep\unattend.xml

Mặt khác, mật khẩu của người sử dụng sau khi khai báo trong file xml đã được mã hóa, nhưng về bản chất thì file đó không tồn tại trong quá trình này. Mặt khác, người sử dụng có thể điều chỉnh file answer dựa theo nhu cầu. Sau khi hoàn tất file unattend.xml, hãy copy tới thư mục C:\Windows\System32\Sysprep, và chúng ta đã sẵn sàng để chạy sysprep trên máy tính. Bên trong phần profile vừa được khởi tạo, các bạn hãy sử dụng Command Prompt, trỏ tới thư mục C:\Windows\System32\Sysprep và gõ lệnh dưới đây:

mysysprep.exe \generalize \oobe \shutdown \unattend:unattend.xml

Máy tính sẽ tự tắt sau khi sysprep hoàn tất. Và đây cũng là thời điểm tạo image của ổ cứng, mỗi người đều có cách riêng để hoàn thiện việc này. Tại bài thử nghiệm này, chúng tôi dùng tiện ích Norton Ghost, và kết quả là có 2 phân vùng, C của hệ điều hành và D là phần chứa dữ liệu của người dùng. Quá trình tiếp theo, áp dụng file image ngược trở lại vào máy tính, chúng ta sẽ được thông báo khởi tạo tên máy tính và domain. Phần Domain Name sẽ tự động hiển thị sau khi hoàn tất:

<JoinDomain>%Please select a domain to join{your.domain.com}%</JoinDomain>

Còn trong trường hợp hệ thống có nhiều domain, thì chúng ta sẽ sử dụng cấu trúc menu dropdown tại bước này:

<JoinDomain>%Please select a domain to join{domain1;domain2;domain3}%</JoinDomain>

Máy tính sẽ hoàn tất quá trình cài đặt và có thể tiếp tục với màn hình boot Welcome quen thuộc. Khi tất cả các bước thành công, chúng ta có thể đăng nhập bằng tài khoản domain.

Một số vấn đề thường gặp và cách giải quyết:

Sau khi hoàn tất bước xóa file unattend.xml, chúng ta cần đảm bảo rằng toàn bộ phần cứng của hệ thống vẫn hoạt động ổn định khi sử dụng sysprep:

<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>

Khi chúng ta thiết lập giá trị True tại bước này, các thiết bị Plug and Play sẽ được cài đặt đầy đủ driver trên máy tính áp dụng file image. Và các thiết bị phần cứng này không cần thiết phải cài đặt lại trong quá trình tự tạo và cấu hình, những thông tin này sẽ được lưu trữ vào phần: x86_Microsoft-Windows-PnpSysprep.

Tự tạo thông số sử dụng mức năng lượng trong file image và khởi tạo phần thông số này trong file unattend.xml, cụ thể trong phần Control Panel > Power Options. Khi muốn thực hiện quá trình này, chúng ta sẽ cần đến thông số GUID, và để tìm được phần thông số này thì phải dùng lệnh sau trong Command Prompt:

PowerCfg -List

và tìm trong đó phần plan vừa tạo. Việc cuối cùng là gán tham số GUID này vào file unattend.xml để trở thành mức sử dụng và tiêu thụ năng lượng mặc định trong hệ thống, các thông tin này sẽ được lưu trữ trong phần x86_Microsoft-Windows-powercpl__neutral.

Phân chia ổ đĩa thành DriverStore trong file image, chúng ta có thể sử dụng tiện ích pnputil.exe. Cụ thể, trong trường hợp hệ thống đã có sẵn driver của 1 thiết bị ngoại vi nào đó như máy in hoặc scan, chúng ta không muốn các tài khoản người dùng khác nhận thông báo mỗi khi cài đặt driver, chúng ta sẽ gán các thông số này vào DriverStore trong file image của Windows. Ví dụ: pnputil.exe -a HP0001.inf. Để tìm hiểu rõ hơn về cú pháp này, các bạn hãy tham khảo bài hướng dẫn trực tiếp từ Microsoft tại đây.

Để tắt bỏ chức năng thông báo của Action Center: Set backup, chúng ta sẽ tạo mới 1 file DisableBackupMonitoring.reg bằng Notepad và sử dụng đoạn mã bên dưới đây:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsBackup]
"DisableMonitoring"=dword:00000001

Dưới đây là 1 đoạn mã được dùng để xóa bỏ các shortcut mặc định trên thanh taskbar khi người dùng đăng nhập vào hệ thống lần đầu tiên. Các bạn có thể tham khảo thêm về đoạn mã này tại đây, về mặt kỹ thuật thì file script này sẽ được copy tới thư mục C:\Windows\System32\Sysprep\Custom qua 1 file batch được thay thế trong phần startup của profile người sử dụng. Sau đó, file batch sẽ tự động xóa bỏ và quá trình trên chỉ xảy ra trong lần đăng nhập đầu tiên của người dùng:

1 Option Explicit
2
3 Const CSIDL_STARTMENU = &HB
4 Const CSIDL_COMMON_PROGRAMS = &H17
5
6 Dim objShell, objFSO
7 Dim objCurrentUserStartFolder
8 Dim strCurrentUserStartFolderPath
9 Dim objAllUsersProgramsFolder
10 Dim strAllUsersProgramsPath
11 Dim objFolder
12 Dim objFolderItem
13 Dim colVerbs
14 Dim objVerb
15
16 Set objShell = CreateObject("Shell.Application")
17 Set objFSO = CreateObject("Scripting.FileSystemObject")
18
19 Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
20 strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
21
22 Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
23 strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
24
25 '''''''''''''''''''''''''''''''''''''''Unpin Shortcuts'''''''''''''''''''''''''''''''''''''''
26
27 '*** All Users Shortcuts ****
28
29 'Internet Explorer
30 If objFSO.FileExists(strAllUsersProgramsPath & "\Network & Internet\Microsoft\Internet Explorer.lnk") Then
31 Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Network & Internet\Microsoft")
32 Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
33 Set colVerbs = objFolderItem.Verbs
34 For Each objVerb In colVerbs
35 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
36 Next
37 End If
38
39 'Mozilla Firefox
40 If objFSO.FileExists(strAllUsersProgramsPath & "\Network & Internet\Mozilla Firefox\Mozilla Firefox.lnk") Then
41 Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Network & Internet\Mozilla Firefox")
42 Set objFolderItem = objFolder.ParseName("Mozilla Firefox.lnk")
43 Set colVerbs = objFolderItem.Verbs
44 For Each objVerb In colVerbs
45 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
46 Next
47 End If
48
49 'Windows Explorer
50 If objFSO.FileExists(strAllUsersProgramsPath & "\Accessories\Windows Explorer.lnk") Then
51 Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
52 Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
53 Set colVerbs = objFolderItem.Verbs
54 For Each objVerb In colVerbs
55 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
56 Next
57 End If
58
59 'Windows Media Player
60 If objFSO.FileExists(strAllUsersProgramsPath & "\Network & Internet\Microsoft\Windows Media Player.lnk") Then
61 Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Network & Internet\Microsoft")
62 Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
63 Set colVerbs = objFolderItem.Verbs
64 For Each objVerb In colVerbs
65 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
66 Next
67 End If
68
69 '*** Current Users Shortcuts ****
70
71 'Internet Explorer
72 If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
73 Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
74 Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
75 Set colVerbs = objFolderItem.Verbs
76 For Each objVerb In colVerbs
77 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
78 Next
79 End If
80
81 'Mozilla Firefox
82 If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Mozilla Firefox\Mozilla Firefox.lnk") Then
83 Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Mozilla Firefox")
84 Set objFolderItem = objFolder.ParseName("Mozilla Firefox.lnk")
85 Set colVerbs = objFolderItem.Verbs
86 For Each objVerb In colVerbs
87 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
88 Next
89 End If
90
91 'Windows Explorer
92 If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
93 Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
94 Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
95 Set colVerbs = objFolderItem.Verbs
96 For Each objVerb In colVerbs
97 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
98 Next
99 End If
100
101 'Windows Media Player
102 If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Windows Media Player.lnk") Then
103 Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
104 Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
105 Set colVerbs = objFolderItem.Verbs
106 For Each objVerb In colVerbs
107 If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
108 Next
109 End If
110
111 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
112
113 ''''''''''''''''''''''''''''''''''''''''Pin Shortcuts''''''''''''''''''''''''''''''''''''''''
114
115 'Internet Explorer - All Users
116 If objFSO.FileExists(strAllUsersProgramsPath & "\Network & Internet\Microsoft\Internet Explorer.lnk") Then
117 Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Network & Internet\Microsoft")
118 Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
119 Set colVerbs = objFolderItem.Verbs
120 For Each objVerb In colVerbs
121 If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
122 Next
123 End If
124
125 'Mozilla Firefox - All Users
126 If objFSO.FileExists(strAllUsersProgramsPath & "\Network & Internet\Mozilla Firefox\Mozilla Firefox.lnk") Then
127 Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Network & Internet\Mozilla Firefox")
128 Set objFolderItem = objFolder.ParseName("Mozilla Firefox.lnk")
129 Set colVerbs = objFolderItem.Verbs
130 For Each objVerb In colVerbs
131 If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
132 Next
133 End If
134
135 'Windows Explorer - Current User
136 If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
137 Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
138 Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
139 Set colVerbs = objFolderItem.Verbs
140 For Each objVerb In colVerbs
141 If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
142 Next
143 End If
144
145 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sau khi thiết lập phần Network Location trong file unattend.xml, nhưng người dùng vẫn nhận được thông tin cảnh báo trong lần đăng nhập đầu tiên, hãy cài đặt bản hotfix sau trên máy tính sử dụng để làm image: http://support.microsoft.com/kb/2028749

Địa chỉ homepage của IE bị reset sau khi sử dụng sysprep: khắc phục bằng cách gán thiết lập riêng của IE vào file unattend.xml trong phần x86_Microsoft-Windows-IE-InternetExplorer__neutral_31bf3856ad364e35_nonSxS.

Người sử dụng bị mất phần theme Aero sau khi dùng sysprep: sử dụng lệnh sau trong phần Command Prompt:

WinSAT prepop

Quá trình trên sẽ tạo file WinSAT prepop .xml và lưu trữ trong thu mục %WINDIR%\performance\winsat\datastore, đồng thời cho phép người sử dụng giữ nguyên các thiết lập về theme sau khi dùng sysprep.

Chúc các bạn thành công!

Thứ Ba, 19/01/2016 10:12
31 👨 15.367
0 Bình luận
Sắp xếp theo
    ❖ Windows 7