Windows 10 Sysprep best practices e issues

Per preparare immagini per computer con Windows 10 tramite sysprep occorre tenere presente di alcune accortezze per non avere problemi durante il restore dell’immagine.

Il comando per creare l’immagine di un computer è il seguente 8per informazioni sulle opzioni a riga di comando siveda Sysprep Command-Line Options):

%WINDIR%\system32\sysprep\sysprep.exe /oobe /generalize /shutdown

In questi giorni ho avuto modo di preparare alcune immagini per computer con Windows 10 e di seguito l’elenco dei passaggi da seguire per non avere problemi durante il restore dell’immagine.

Passo 1: Installare il sistema operativo senza connettere a Internet il computer per evitare aggiornamenti delle app

Passo 2: Quando richiesto impostare una password di amministratore con l’adeguata complessità, ad esempio almeno 8 caratteri con lettere minuscole e maiuscole, numeri e caratteri non alfabetici (a riguardo si vedano Passwords must meet complexity requirements e Password Policy) come indicato in Sysprep (System Preparation) Overview:

If you do not assign a strong password to a user account before you run Sysprep or OOBE, you may not be able to log on to the PC. We recommend that you always use strong passwords for your user accounts.”

Passo 3: Mantenere il computer disconnesso dalla rete durante tutta la preparazione del sistema per evitare aggiornamenti delle app.

A riguardo si veda il post Windows 10 Sysprep fails after removing or updating Windows built-in Windows Store apps dove si consiglia di non avere accesso ad internet durante la preparazione del computer, se questo non è possibile a livello infrastrutturale in quanto il sistema deve essere connesso alla rete per la preparazione e questo comporta anche l’accesso ad Internet viene suggerito di implementare un blocco a livello di Windows Firewall tramite il comando:

cmd.exe /c netsh advfirewall firewall add rule name=”Block Internet” proto=TCP dir=out localport=any action=block en=yes profile=any remoteport=80,443

Come riportato in Windows 10 Sysprep fails after removing or updating Windows built-in Windows Store apps la problematica era già presente anche in Windows 8 come indicato nella KB 2769827 Sysprep fails after you remove or update Windows Store apps that include built-in Windows images:

“The issue at hand is actually an issue from Windows 8 https://support.microsoft.com/en-us/kb/2769827 where if you remove the built-in apps during a build and capture sysprep will fail. I had imagined this was resolved by now but the fix is still in the works.  The workaround is pretty simple we just need to kill access to the internet while we are building our image.  There are many ways to achieve this depending on what you have at your disposal but below is a quick and easy netsh command to block internet access which will resolve our problems and allow sysprep to complete successfully.  In the meantime ensure to keep your reference image patched with the latest CU’s for Windows 10 and this issue will hopefully be resolved and we can safely remove this step in the future.”

Nel caso si intenda creare immagini per la versione Enterprise di Windows 10 e non si sia interessati alle app è possibile utilizzare la versione LTSB a riguardo si veda il mio precedente post Windows 10 Enterprise LTSB.

Passo 4: Se possibile evitare di eseguire il join a dominio del sistema (in ogni caso Sysprep rimuoverebbe il computer dal dominio come indicato in What is Sysprep?:

“The Sysprep tool runs only if the PC is a member of a workgroup, not a domain. If the PC is joined to a domain, Sysprep removes the PC from the domain.”

E in Sysprep (System Preparation) Overview:

“If a PC is joined to a domain, and the Group Policy of that domain assigns a strong account password policy to the PC, all user accounts will require strong passwords. Running Sysprep or OOBE does not remove the strong password policy.”

Nel caso sia stato necessario eseguire il join a dominio per preparare il sistema prima di eseguire il sysprep eseguire le seguenti operazioni:

  1. Rimovere il computer dal dominio
  2. Rimovere l’applicazione dei criteri di gruppo di dominio tramite il comando:
    gpupdate /force /boot
  3. Riavviare il sistema
  4. Eseguire il sysprep

Conclusioni

Sysprep è sicuramente uno strumento utile per automatizzare il deploy, ma occorre gestirlo correttamnete analizzando gli scenari supportati, a riguardo si veda anche la sezione Limitations e Unsupported Scenarios in Sysprep (System Preparation) Overview e in particolare si tenga presente delle seguenti:

– In some cases, customized applications that you install before you recapture the Windows image may require a consistent drive letter. Some applications store paths that include the system’s drive letter. Uninstallation, servicing, and repair scenarios may not function correctly if the system’s drive letter does not match the drive letter that the application specifies.

– The Plug and Play devices on the reference and destination PCs do not have to be from the same manufacturer. These devices include modems, sound cards, network adapters, and video cards. However, the installation must include the drivers for these devices.

– Moving or copying a Windows image to a different PC without generalizing the PC is not supported.

– Using the Sysprep tool on upgrade installation types, or to reconfigure an existing installation of Windows that has already been deployed is not supported. Sysprep must be used only to configure new installations of Windows. You can run Sysprep an unlimited number of times to build and configure your installation of Windows.

Per ulteriori informazioni si veda anche la KB828287 Unsupported Sysprep scenarios.

Per una guida step by step per creazione di un’immagine di Windows 10 tramite Sysprep e Deployment Toolkit (MDT) 2013 Update 1 si veda Create a Windows 10 reference image.