VMware Horizon View – Setup Template, Generalize Windows

Welcome to my VMware Horizon View series, how I setup “View” in my LAB. In this sub-session I will describe how I generalized my Windows 10 Build 1809.

After I finished customizing and updating Windows 10 in my previous session, I’m now ready to Sysprep and create a mandatory profile. Before I sysprep my image I will remove all unneccessary Windows App Packages. I have attached a txt-file at the bottom with the commands used in this session.

First I’ll start a Powershell session as administrator

GeneralizeWindows01

 

I disable app-suggestions for new users by adding this reg-key:

GeneralizeWindows02

 

Next, I run “Get-AppxPackage -AllUsers | Remove-AppxPackage” to list and remove all app packages from all users. This will produce a lot of errors, not to worry. I now run “Get-AppxProvisionedPackage -online | Remove-AppxProvisionedPackage –online” to make sure new users don’t get app packages installed in future.

GeneralizeWindows03

 

Now it’s time to sysprep the image. First I will create an answer-file for sysprep, unattend.xlm. I have modified mine as follows. A sample file is attached at the end of this page.

GeneralizeWindows04

 

I copy unattend.xml to C:\Windows\System32\Sysprep

GeneralizeWindows05

 

From an administrative cmd-prompt, I start sysprepping by running this cmd: “c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /mode:vm /unattend:c:\windows\system32\sysprep\unattend.xml /reboot”

GeneralizeWindows06

 

Once my VM is restarted, I will create a mandatory profile. In Windows Explorer, Right-click “This PC” and click Properties.

GeneralizeWindows07

 

Next I select Advanced System Settings

GeneralizeWindows08

 

I Click “Settings” under User Profiles

GeneralizeWindows09

 

Select Default Profile, Copy To…

GeneralizeWindows10

 

Copy profile to “C:\Users\Mandatory.v6” and click “Change” to set permissions

GeneralizeWindows11

 

Select the user group: Authenticated Users

GeneralizeWindows12

 

Do NOT check the Mandatory profile option

GeneralizeWindows13

 

Back in the User Profile dialogue box, delete the defaultuser0-profile

GeneralizeWindows14

GeneralizeWindows15

 

Click OK to exit User Profiles windows

GeneralizeWindows16

 

Back in Windows Explorer, I browse to C:\Users\Mandatory.v6 folder, choose view “Hidden Items”

GeneralizeWindows17

 

I rename the file ntuser.dat to ntuser.man

GeneralizeWindows18

 

Next I choose to view protected operating system files from View Options

GeneralizeWindows19

 

I delete all ntuser*.* files except ntuser.ini and ntuser.man

GeneralizeWindows20

 

Lastly, I revert changes in the View Options I made above.

Commands used in this session: generalize_cmd

Unattend sample file: Unattend_xml

PS: Beware of formatting when doing copy/paste!

 

That concludes my session about how I generalized and prepared Windows in my template. My next logical step will be applications and agents, covered here: VMware Horizon View Setup Template – Install Agents and applications

 

Recommended reading:

VMware Tech Zone: Creating an Optimized Windows Image for a VMware Horizon Virtual Desktop

 

VMware Horizon View Setup Template

VMware Horizon View planning, deployment etc.

Disclaimer: Every tips/tricks/posting I have published here, is tried and tested in different it-solutions. It is not guaranteed to work everywhere, but is meant as a tip for other users out there. Remember, Google is your friend and don’t be afraid to steal with pride! Feel free to comment below as needed.