📜 ⬆️ ⬇️

Fighting sysprep, or how to make your life easier with Windows Vista

I reached this mechanism for two months - with shouts, obscenities, grumbles about Microsoft software developers. Some nuances are still a mystery to me. But the main part is solved.

Among the tasks set before me were the following:

- Install Windows Vista Home Basic
- make some specific software work on it
- install on the second FreeDOS partition and embed it in the Vista loader
- learn how to pack
')
Part one. Many Faces Sysprep

When you hear any phrase related to the name of the operating system from Microsoft, in which there is the word Home, an unreasonably stripped-down version for housewives comes to mind - the inability to edit local policies and user groups, cut down to RDP remote assistant, the absence of some important administration utilities ... But all this has to be fought, for the task is and it must be solved in the absence of an alternative.


What's new in Vista sysprep

1. Sysprep is now built into the system. It lies in the folder C: \ Windows \ system32 \ sysprep
2. The names of the keys and the way they were set have changed. That is, if in XP you could restrict yourself to simple sysprep –reseal, then in Vista it will not work. Keys are set rigidly and in a certain combination:
/ oobe or / audit - two modes in which sysprep can run. To choose or / or, but running sysprep without any of them will fail.
/ generalize - optionally, the analogue of reseal, but without / oobe or / audit will not start
/ reboot or / shutdown - respectively, a shutdown or reboot at the end of sysprep, depending on the task
/ unattend: path - the path to the answer file
3. The system preparation mechanism itself has been changed, relating, in particular, to user accounts. If in XP the current user profile settings were saved even after sysprep, then in Vista in / oobe mode, by default, a new user profile is always created, regardless of whether there are any other users on the system. Thus, if during installation a new profile is created by default, then after sysprep you will also receive a second one.

How to deal with it

The algorithm for creating the desired image in itself is not difficult. But for this, you will have to at least download the WAIK (Windows Automatic Installation Kit), which is used to create an answer file with the necessary parameters. As practice has shown, this is the only reasonable way to achieve the desired result, although he does not claim exclusivity.
In order to exclude the creation of unnecessary profiles in the system, immediately after installing the system, run the sysprep / audit / generalize / reboot mode. After the reboot, the hidden super-administrator account (whose authority is an order of magnitude higher than that of regular users with administrative rights) is activated, from which you can safely delete the account created during the installation of the system. All settings made under the super-administrator account are configured in the Default User profile. After all the necessary preparations have been made, you can start creating the answer file.

Creating an Answer File

WAIK turned out to be quite a flexible and convenient tool for solving my goal. Its capabilities are used for both automatic installation of Windows and automatic sysprep. In my case, the second component was important.
The mechanism of the sysprep utility consists of several so-called “passes” - specialize, generalize and oobeSystem, for each of which there is an opportunity to configure the necessary parameters. In particular, the CopyProfile parameter, which exists only for the specialize pass, is responsible for copying the default profile to all newly created accounts (which we just need). We set it to true. Optionally, you can also customize the oobeSystem settings, which include, for example, auto-selection of the language locale, setting the time zone, etc. This will minimize the number of actions that the end user will need to perform when he receives a ready-made image. In the version of my answer file, the user eventually entered only the computer name, the system did the rest for it itself.
The resulting unattend.xml file (other variations of the name of the Vista file refuses to accept) is copied into two places:
C: \ Windows \ system32 \ sysprep \ sysprep \ Panther \
C: \ Windows \ Panther \
After that you can run a long and intricate command.
C: \ Windows \ system32 \ sysprep \ sysprep / oobe / generalize / reboot (or / shutdown) / unattend: C: \ Windows \ system32 \ sysprep \ sysprep \ Panther \ unattend.xml

Creating an image can be considered complete.

Additional features

Sometimes there is a need to run some cmd-file with your commands before the first login to the system before login. This can be done by creating the setupcomplete.cmd file and placing it in the C: \ Windows \ Setup \ Scripts \ directory (the Scripts folder in Home Basic is missing - we create it ourselves).

To be continued…

Source: https://habr.com/ru/post/38368/


All Articles