Issue

When working with non-persistent environment you are faced with a decision as to how to set up a users initial session.

Typically you would look at (in no particular order)

  • Mandatory Profiles
    Mandatory profiles are great in environments that remain fairly static, this is because  by nature you are essentially creating a “snap-shot” of a user session at a point in time. This includes all the additional files that come in a Windows Profile, while we strip out a fair amount of unnecessary files that do not need to really be included there are still files left over.
    However in dynamic, user-centric environments does this really make sense?
  • On-logon configurations (whether using tooling like AppSense Environment Manager, RES Workspace, scripts or even adding configuration to ActiveSetup)
    These tools have their place, for configuration items that are likely to change or are fairly fluid it makes sense to have them in tooling that will vary a user configuration on logon.
    But what about things that remain fairly static? for example a corporate wallpaper.
    Is it really the best idea to slow the user logon experience because these settings are being applied as well as forcing users to wait through multiple logons because a setting could not be applied without the user logging off first?

So what is the alternative?

Solution

Entering the fray, editing the default user profile.

While this sounds quite extreme is there really a compelling reason not to in a non-persistent environment?

Since a user session is thrown away at each log off the default profile is applied every session, user customization is then layered on top of this.

In addition this approach comes with the benefits of

  • not relying on a network share (mandatory profiles)
  • only change specific settings that are required

Implementation

I like to keep things simple where possible so have used a batch script, you can however use whatever language you are comfortable with.

Please note however if you are using PowersShell remember to include it in your boot (WinPE for SCCM/MDT) image.

I have included some common changes  in the script, please note that no file copying is done in this script this should generally be achieved using your chosen deployment technology.

@echo off

REM # Script to edit a Defauly User Profile
REM # Copyright (C) 2015  Adil Dean
REM # http://www.configmonkey.co.uk
REM # Script Name: DefaultUserTweaks.bat
REM # Script Version: 2.0
REM #
REM # This program is free software: you can redistribute it and/or modify
REM # it under the terms of the GNU General Public License as published by
REM # the Free Software Foundation, either version 3 of the License, or
REM #(at your option) any later version.
REM #
REM # This program is distributed in the hope that it will be useful,
REM # but WITHOUT ANY WARRANTY; without even the implied warranty of
REM # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM # GNU General Public License for more details.
REM #
REM # You should have received a copy of the GNU General Public License
REM # along with this program.  If not, see .

REM # Batch Script ############################################################
REM #
REM # AUTHOR: Stijn Vermeulen
REM # 
REM # UPDATES:
REM # 18/02/2015 - Adil Dean
REM #	- Clean-up script for publishing
REM #
REM ###########################################################################
 
REM .SYNOPSIS
REM		Edits the Default User Profile
REM .Description
REM		Script is used to edit the default profile
REM 	It can be used within a deployment tool (SCCM, MDT, Netboot) or as a
REM		standalone deployment.
REM	.Requirements
REM		n/a
REM .EXAMPLE
    REM .\DefaultUserTweaks.bat
REM .Notes

REM Load the default user profile
reg load HKU\temporary "C:\Users\Default\ntuser.dat"

REM Default User Tweaks

REM *** Taskbar: Enable Small Icons
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d "1" /f
    reg add "HKU\temporary\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarSmallIcons" /t REG_DWORD /d "1" /f

REM *** Taskbar: Never combine buttons
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarGlomLevel" /t REG_DWORD /d "2" /f
    reg add "HKU\temporary\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarGlomLevel" /t REG_DWORD /d "2" /f

REM *** IE: Set default home page
    reg add "HKCU\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /t REG_SZ /d "http://www.configmonkey.co.uk" /f
    reg add "HKU\temporary\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /t REG_SZ /d "http://www.configmonkey.co.uk" /f

REM *** Explorer: Expand to current folder in Navigation Pane
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "NavPaneExpandToCurrentFolder" /t REG_DWORD /d "1" /f
    reg add "HKU\temporary\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "NavPaneExpandToCurrentFolder" /t REG_DWORD /d "1" /f

REM *** Desktop: Add icon to Internet Explorer
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {871C5380-42A0-1069-A2EA-08002B30309D} /t REG_DWORD /d 0 /f
    reg add "HKU\temporary\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {871C5380-42A0-1069-A2EA-08002B30309D} /t REG_DWORD /d 0 /f

REM *** Desktop: Set Wallpaper
    reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d C:\ConfigMonkey\Support\CorporateWallpaper.jpg /f
    reg add "HKU\temporary\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d C:\ConfigMonkey\Support\CorporateWallpaper.jpg /f

REM *** Desktop: Background Colour
    reg add "HKCU\Control Panel\Colors" /v Background /t REG_SZ /d "255 255 255" /f
    reg add "HKU\temporary\Control Panel\Colors" /v Background /t REG_SZ /d "255 255 255" /f

REM *** Desktop: Wallpaper Style
    reg add "HKCU\Control Panel\Desktop" /v WallpaperStyle /t REG_SZ /d 2 /f
    reg add "HKU\temporary\Control Panel\Desktop" /v WallpaperStyle /t REG_SZ /d 2 /f

REM *** Explorer: Show File extensions
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
    reg add "HKU\temporary\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
		
REM Unload Default User Profile
reg unload HKU\temporary