First, we will learn about the two statements below:
% Please input một tên người dùng (0.15)%
% Please select a domain to Join {your.domain.com}%
There is another specific component when using mysysprep2, which is that the system will display different messages in the SIM section but will completely ignore this information, the part (0,15) in will automatically delete extra characters if the computer name is longer than 15 characters. Besides, we also see:
true
The above command will ask sysprep to copy the entire profile information that the user created earlier to the default profile. In addition, the user must specify the OU to assign the computer, otherwise the component will not be assigned to the system's domain:
OU = Test, DC = Your, DC = Domain, DC = Here
Another point to note with the unattend.xml file is that we have to create a local user account during sysprep processing. Specifically, when a user installs Windows 7 using a disk, it is necessary to create a local user to log in, and this process continues when using the attend.xml and sysprep files. In this test, we created a local user account named TempUser - which will be deleted when we first log in to Windows. The purpose of this account is to create just the process of creating local users when sysprep works.
In addition, we can also use another way to implement this process, although not specifically presented but quite effective. Specifically, on the computer we perform the image file creation process, open the folder C: WindowsSteup , create a new folder named Scripts here. Inside that, we create a SetupComplete.cmd file - which starts automatically before the Windows login screen starts. And this is also the step that TempUser account is deleted.
To delete this TempUser account, please add the following command to SetupComplete.cmd:
net user TempUser / delete
And activate the Administrator account with the command:
net Administrator / active user: yes
Although you may have enabled the Administrator account on the computer used to create the image before using sysprep, the account is still disabled. To delete the unattend.xml file, add the following line of code to the SetupComplete.cmd file:
del C: WindowsSystem32Sysprepunattend.xml
On the other hand, the user's password after being declared in the xml file is encrypted, but in essence, the file does not exist in this process. On the other hand, users can adjust their answer file according to their needs. After completing the unattend.xml file, copy to the C: WindowsSystem32Sysprep folder , and we are ready to run sysprep on the computer. Inside the newly created profile section, use the Command Prompt, point to the C: WindowsSystem32Sysprep folder and type the command below:
mysysprep.exe generalize oobe shutdown unattend: unattend.xml
The computer will turn itself off after sysprep is complete. And this is also the time to create the image of the hard drive, each has its own way to complete this. At this test, we used the Norton Ghost utility, and as a result, there were 2 partitions, C of the operating system, and D, which contained the user's data. In the next process, applying the image file back to the computer, we will be prompted to initialize the computer and domain name. The Domain Name section will automatically display after completing:
% Please select a domain to Join {your.domain.com}%
In case the system has multiple domains, we will use the dropdown menu structure at this step:
% Please select một miền để Join {domain1; domain2; domain3}%
The computer will complete the installation process and can continue with the familiar boot Welcome screen. When all steps are successful, we can log in with the domain account.
After completing the step of deleting the unattend.xml file, we need to ensure that the entire hardware of the system remains stable when using sysprep:
true
When we set the True value at this step, Plug and Play devices will be fully installed with drivers on the computer that applies the image file. And these hardware devices do not need to be reinstalled during the creation and configuration process, these information will be stored in: x86_Microsoft-Windows-PnpSysprep.
Create parameters using the energy level in the image file and initialize this parameter in the unattend.xml file, specifically in the Control Panel> Power Options section . When we want to perform this process, we will need the GUID parameter, and in order to find this parameter we must use the following command in Command Prompt:
PowerCfg -List
and find where the newly created plan is located. The last thing is to assign this GUID parameter to the unattend.xml file to become the default power usage and consumption level in the system, which will be stored in the x86_Microsoft-Windows-powercpl__neutral section.
Split the drive into DriverStore in the image file, we can use the pnputil.exe utility. Specifically, in case the system already has a driver of a certain peripheral device such as a printer or scan, we don't want other user accounts to receive notifications every time we install the driver, we will assign the This parameter enters DriverStore in the Windows image file. For example: pnputil.exe -a HP0001.inf . To find out more about this syntax, please refer to the tutorial directly from Microsoft here.
To turn off the notification of Action Center: Set backup , we will create a new file DisableBackupMonitoring.reg with Notepad and use the code below:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionWindowsBackup]
"DisableMonitoring" = dword: 00000001
Below is a code used to remove the default shortcuts on the taskbar when the user logs in to the system for the first time. You can refer to this code here, technically this script file will be copied to the C: WindowsSystem32SysprepCustom folder via a batch file that is replaced in the startup section of the user profile. After that, the batch file will be automatically deleted and the process will only happen on the first login of the user:
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 & InternetMicrosoftInternet Explorer.lnk") Then
31 Set objFolder = objShell.Namespace (strAllUsersProgramsPath & "Network & InternetMicrosoft")
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 & InternetMozilla FirefoxMozilla Firefox.lnk") Then
41 Set objFolder = objShell.Namespace (strAllUsersProgramsPath & "Network & InternetMozilla Firefox")
42 Set objFolderItem = objFolder.ParseName ("Mozilla Firefox.lnk")
43 Set colVerbs = objFolderItem.Verbs
44 For Each objVerb In colVerbs
45 Replace If (objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
46 Next
47 End If
48
49 'Windows Explorer
50 If objFSO.FileExists (strAllUsersProgramsPath & "AccessoriesWindows 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 & InternetMicrosoftWindows Media Player.lnk") Then
61 Set objFolder = objShell.Namespace (strAllUsersProgramsPath & "Network & InternetMicrosoft")
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 & "ProgramsInternet 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 & "ProgramsMozilla FirefoxMozilla Firefox.lnk") Then
83 Set objFolder = objShell.Namespace (strCurrentUserStartFolderPath & "ProgramsMozilla 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 & "ProgramsAccessoriesWindows Explorer.lnk") Then
93 Set objFolder = objShell.Namespace (strCurrentUserStartFolderPath & "ProgramsAccessories")
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 & "ProgramsWindows 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 Replace If (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 & InternetMicrosoftInternet Explorer.lnk") Then
117 Set objFolder = objShell.Namespace (strAllUsersProgramsPath & "Network & InternetMicrosoft")
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 & InternetMozilla FirefoxMozilla Firefox.lnk") Then
127 Set objFolder = objShell.Namespace (strAllUsersProgramsPath & "Network & InternetMozilla Firefox")
128 Set objFolderItem = objFolder.ParseName ("Mozilla Firefox.lnk")
129 Set colVerbs = objFolderItem.Verbs
130 For Each objVerb In colVerbs
131 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 & "ProgramsAccessoriesWindows Explorer.lnk") Then
137 Set objFolder = objShell.Namespace (strCurrentUserStartFolderPath & "ProgramsAccessories")
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 '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '
After setting up the Network Location section in the unattend.xml file, but the user still receives the warning information on the first login, install the following hotfix on the computer used to make the image: http:/// support .microsoft.com/kb/2028749
IE's homepage address is reset after using sysprep: fix by assigning IE's own settings to the unattend.xml file in x86_Microsoft-Windows-IE-InternetExplorer__neutral_31bf3856ad364e35_nonSxS.
The user loses the Aero theme after using sysprep: use the following command in the Command Prompt:
WinSAT prepop
The above process will create the WinSAT prepop .xml file and store it in the % WINDIR% performancewinsatdatastore directory and allow the user to keep the theme settings after using sysprep.
Good luck!