So Anyweb asked me in this post to describe where and how i would used this in one of my task Sequences. I will use a current Windows 7 LAB in vNEXT to describe this. Now its not perfect as its currently under construction. The purpose of this LAB is to dynamically provision VM's in Citrix XenDesktop and to add these Desktops to the Pooled Desktop.
For the purposes of this however we will limit the scope to just building and provisioning the vDesktop, without any Backend Infra or adding the vDesktop to Citrix.
You will need to create Two (2) Packages for these scripts to be distributed. I used to dynamically update the scripts from the source since they are so small, however i find this just as quick in SCCM 2012/vNEXT.
Firstly we install our Runtimes and Frameworks like Java, Silverlight, etc. I have just included the command lines here as normally we will copy the data locally to the PC, STORE a COPY and then run a VBS file to do the installation. this is helpfull for troubleshooting and allowing SLOWLINK re-installation and repairs of packages. However in this LAB everthing will be in the DC so speed and data transfers are of no consequence.
After these are completed we begin installing software, We are only going to install Adobe, Lync Client and Office 2010. Again i have included only command lines so you can see how it is done, and the methods are generally the same throughout.
Next we begin customizing the WIM FILE. This is where we copy the scripts and start running them. This looks like a small amount of things that happens here however it is quite substantial and we are in the process of moving everything to powershell from vbscript. We still utilize .cmd files to launch most of the tools as its easier to track the process with multiple open windows.
INSTALL-ImageFilesV0.2.cmd
@echo off
cls
echo.
echo BEGIN BUILD of Windows 7 Enterprise VDI Image.
echo Version v0.2
echo.
echo.
echo Apply Versioning Information
echo Allows you to see which BUILD TS the Image is
echo.
regedit /s %~d0%~p0BuildVersionV0.2.reg
echo.
echo Copy Profile Customized Sysprep File
echo.
del /f /q C:\Windows\system32\sysprep\panther\unattend.xml
del /f /q C:\Windows\system32\sysprep\unattend.xml
del /f /q C:\WINDOWS\Panther\unattend.xml
del /f /q C:\WINDOWS\MININT\unattend.xml
xcopy /y %~d0%~p0unattend.xml C:\Windows\system32\sysprep\
echo.
echo Copying Standard Operating System Based Customisations
echo
xcopy /y %~d0%~p0Corporate.jpg C:\WINDOWS\Web\Wallpaper\
xcopy /y %~d0%~p0Corporate.Theme C:\WINDOWS\Resources\Themes\
echo.
echo Copying PRE-SYSPREP FILES
echo.
xcopy /y /e /i %~d0%~p0PRESETUP\*.* C:\PRESETUP\
echo.
echo Copying post-sysprep files
echo.
xcopy /y /e /i %~d0%~p0POSTSETUP\*.* C:\POSTSETUP\
REM You can include anything you want here. MAP a network drive and copy A/V, other agents, etc. here if you have a need to run locally.
echo.
echo Copying cleanup scripts
echo.
xcopy /y /e /i %~d0%~p0CleanupScripts\*.* C:\WINDOWS\Temp\
echo.
echo Copying Tools
echo.
xcopy /y /e /i %~d0%~p0Tools\*.* C:\WINDOWS\
exit
BuildVersionV0.2.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Corporate\Build]
"Name"="Win7ent_Off2010_VDI_SCCMToolSet"
"Build"="0.2"
"BuildDate"="01/10/2010"
"BuildOwner"="Virtual Desktop Engineering"
CALL-Pre-Setup
Pre-SysprepCmds.cmd
@echo off
cls
cd\
cd PRESETUP
echo.
echo *****************************
echo
echo Running PRE SYSPREP commands
echo
echo *****************************
echo.
echo.
echo Set OEM Information
echo.
regedit /s OEM.reg
echo.
echo Enable features based on customer request
echo.
start /wait EnableWindowsFeatures.cmd
echo.
echo Remove US English
echo.
regedit /s RemoveUSEnglish.reg
echo.
echo Remove Shortcuts
echo.
del /f /q "C:\ProgramData\Microsoft\Windows\Start Menu\Default Programs.lnk"
del /f /q "C:\ProgramData\Microsoft\Windows\Start Menu\Windows Update.lnk"
del /f /q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools\System Restore.lnk"
rmdir /s /q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Maintenance"
rmdir /s /q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Games"
echo.
echo Adding Shortcuts
echo.
xcopy /Y "BGInfo.lnk" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
echo.
echo Customise Current Profile
echo Set Corporate Theme
echo Close the Theme setting window to set the Theme
echo.
rem start C:\WINDOWS\Resources\Themes\Corporate.Theme
echo.
echo ***********************************
echo
echo Running PRE configuration commands
echo
echo ***********************************
echo.
echo.
echo Waiting for 30 seconds
echo.
ping 127.0.0.1 -n 31 > %TEMP%null
echo.
echo Copy Default User Picture
echo.
rename "C:\ProgramData\Microsoft\User Account Pictures\user.bmp" user.bmp.bk
xcopy /y user.bmp "C:\ProgramData\Microsoft\User Account Pictures\"
echo.
echo Set NumLock Off
echo.
regedit /s HKCU_ControlPanel_Keyboard.reg
echo.
echo Set Default Keyboard
echo.
regedit /s HKCU_CTF.reg
echo.
echo Set Explorer View and Start Menu Options
echo.
regedit /s HKCU_Explorer_Advanced.reg
echo.
echo Set Keyboard Layout
echo.
regedit /s HKCU_KeyboardLayout.reg
echo.
echo Set Language Bar Options
echo.
regedit /s HKCU_LangBar.reg
echo.
echo Set Media Player first Run preference
echo.
regedit /s HKCU_MediaPlayerFirstRun.reg
echo.
echo Set Default Locale
echo.
REG DELETE "HKU\.Default\Software\Microsoft\CTF\Assemblies" /f
regedit /s HKU_DOT_DEFAULT_CTF.reg
echo.
echo Set Default NumLock off
echo.
REG DELETE "HKU\.DEFAULT\Control Panel\Keyboard" /f
regedit /s HKU_DOT_DEFAULT_ControlPanel_Keyboard.reg
echo.
echo Set Default Keyboard
echo.
REG DELETE "HKU\.Default\Keyboard Layout" /f
regedit /s HKU_DOT_DEFAULT_KeyboardLayout.reg
echo.
echo Set Default Wallpaper to avoid blank background for default users
echo.
REG LOAD HKU\DefaultUser C:\Users\Default\NTUSER.DAT
REG IMPORT HKDU_ControlPanel_Desktop.reg
REG UNLOAD HKU\DefaultUser
echo.
echo Removes MS Office Registration Info
echo.
regedit /s Remove_MS_Off_UserInfo.reg
echo.
echo Add MS Office Registration only for Company
echo Will prompt for name and initials
echo.
regedit /s Add_MS_Off_CompanyInfo.reg
echo.
echo Disable Windows Media Player Network Sharing Service
echo Requirement for Win 7 Sysprep
echo.
net stop WMPNetworkSvc
sc config WMPNetworkSvc start= disabled
echo .
echo Adding Local Admins
echo Requirement for Autologon
echo .
CreateLocalAdmins.cmd
cls
echo.
echo Pause to customise anything else in your image
echo Check to make sure NumLock is off for the user
echo Check Windows Updates
echo Check to see if all PRE SYSPREP apps are installed
echo.
pause
echo.
echo Waiting for 30 seconds
echo.
ping 127.0.0.1 -n 31 > %TEMP%null
exit
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background]
"OEMBackground"=dword:00000001
SET-AutoLogon
desktopadminautologon.cmd
On Error Resume Next
Dim WshShell
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Dim objFileSys
Set objFileSys = CreateObject("Scripting.FileSystemObject")
Dim oNetwork
Set oNetwork = CreateObject("WScript.Network")
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", "1"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", "desktopadmin"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", "password"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", "."
CustomiseDefaultProfile.cmd
@ECHO OFF
REM *****************************************************
REM Script configures the Default User Profile
REM *****************************************************
REM Load the default profile hive
REG LOAD HKU\Default C:\Users\Default\NTUSER.DAT
REM Configure the default user profile
REM Customise Wallpaper Theme Screensaver
REG IMPORT HKDUser\HKU_ControlPanel_Desktop.reg
REG IMPORT HKDUser\HKU_Themes.reg
REG IMPORT HKDUser\HKU_Software_MSWin_DWM.reg
REG IMPORT HKDUser\HKU_ControlPanel_Colors.reg
REG IMPORT HKDUser\HKU_ControlPanel_Cursors.reg
REM Set Keyboard Layout Settings
REG DELETE "HKU\Default\Keyboard Layout" /f
REG IMPORT HKDUser\HKU_KeyboardLayout.reg
REM Turn off NumLock as a default
REG IMPORT HKDUser\HKU_ControlPanel_Keyboard.reg
REM Turn off Language bar
REG IMPORT HKDUser\HKU_LangBar.reg
REM Set Default Language
REG DELETE "HKU\Default\Software\Microsoft\CTF\Assemblies" /f
REG IMPORT\HKDUser\HKU_CTF.reg
REM Set Explorer Settings
REG IMPORT HKDUser\HKU_Explorer_Advanced.reg
REM Set Media Player Settings
REG IMPORT HKDUser\HKU_MediaPlayer.reg
REM Unload the default profile hive
REG UNLOAD HKU\Default
exit
WSUS-WindowsUpdate
WindowsUpdate.cmd
@echo off
cls
cd\
cd PRESETUP
echo.
echo Connects machine to WSUS SOEBUILD Group
echo Runs the powershell script WSUSNow to obtain updates and install
echo.
regedit /s %~d0%~p0wsusWin7SOEBuild.reg
PowerShell set-executionpolicy remotesigned -force
start /wait PowerShell "& {%~d0%~p0WSUSNow.ps1}"
exit
WSUSNow.ps1
I cannot provided this file as it is very proprietary. Basically it connects to your WSUS Server and downloads the mandatory updates , downloads and installs.
That's the Basics of building our image upto the point of Capturing... once sysprep kicks in we run a heap of other things, but you'll be able to figure out what and where in the next part. Another week or so and i'll get it up.
I have included the .ZIP of all the reg files, but these should be customized to what you wish to setup. Yes, we use GPO to apply alot of this also, however alot of this is easily locked into the image so we do.
So Anyweb asked me in this post to describe where and how i would used this in one of my task Sequences. I will use a current Windows 7 LAB in vNEXT to describe this. Now its not perfect as its currently under construction. The purpose of this LAB is to dynamically provision VM's in Citrix XenDesktop and to add these Desktops to the Pooled Desktop.
For the purposes of this however we will limit the scope to just building and provisioning the vDesktop, without any Backend Infra or adding the vDesktop to Citrix.
You will need to create Two (2) Packages for these scripts to be distributed. I used to dynamically update the scripts from the source since they are so small, however i find this just as quick in SCCM 2012/vNEXT.
PACKAGE 1: Customized Build Scripts.
The folder Structure is as Follows:
PRESETUP
POSTSETUP
TOOLS
CLEANUPSCRIPTS
PACKAGE 2: Customized Deploy Scripts (GoProduction)
The folder Structure is as Follows:
(To be Attached later)
The TASK SEQUENCE.
As you can See its mostly just standard, but down the bottom is where we start running commands.
BUILD Windows 7 ENT for VDI Image.xml
Begin:
Firstly we install our Runtimes and Frameworks like Java, Silverlight, etc. I have just included the command lines here as normally we will copy the data locally to the PC, STORE a COPY and then run a VBS file to do the installation. this is helpfull for troubleshooting and allowing SLOWLINK re-installation and repairs of packages. However in this LAB everthing will be in the DC so speed and data transfers are of no consequence.
After these are completed we begin installing software, We are only going to install Adobe, Lync Client and Office 2010. Again i have included only command lines so you can see how it is done, and the methods are generally the same throughout.
Next we begin customizing the WIM FILE. This is where we copy the scripts and start running them. This looks like a small amount of things that happens here however it is quite substantial and we are in the process of moving everything to powershell from vbscript. We still utilize .cmd files to launch most of the tools as its easier to track the process with multiple open windows.
INSTALL-ImageFilesV0.2.cmd
BuildVersionV0.2.reg
CALL-Pre-Setup
Pre-SysprepCmds.cmd
SET-SpecialLogonScreen
SetSpecialLogonScreen.cmd
EnableLogonInWindows7.reg
SET-AutoLogon
desktopadminautologon.cmd
CustomiseDefaultProfile.cmd
WSUS-WindowsUpdate
WindowsUpdate.cmd
WSUSNow.ps1
I cannot provided this file as it is very proprietary. Basically it connects to your WSUS Server and downloads the mandatory updates , downloads and installs.
WSUS-Cleanup
WSUSCleanup.cmd
That's the Basics of building our image upto the point of Capturing... once sysprep kicks in we run a heap of other things, but you'll be able to figure out what and where in the next part. Another week or so and i'll get it up.
I have included the .ZIP of all the reg files, but these should be customized to what you wish to setup. Yes, we use GPO to apply alot of this also, however alot of this is easily locked into the image so we do.
PRESETUP.zip
Share this post
Link to post
Share on other sites