October, 2014
Versioning and naming your base SOE .wim during OSD
If you replace the base wim (via build and capture) frequently it can be good to set versions and date the wim file that you import. It makes it easy to revert back if a change didn't go so well. Below are the steps in my build and capture to do versioning and work around a bug with naming your captured image.
1. At the top of my task sequence I set a task sequence variable SOEBaseVersion, each time I do a build and capture this is incremented.
2. After 'Setup Windows and Configuration Manager' I have a 'Run Command Line' step with the following command so that we can utilize that value on deployed machines if ever needed:
cmd.exe /c reg add HKLMSoftwareSOE /v SOEBaseVersion /d "%SOEBaseVersion%"
3. Next I run a vbscript to set the task sequence variable TSDate to the date in the format YYYYMMDD
Set env = CreateObject("Microsoft.SMS.TSEnvironment")
env("TSDate") = DatePart("yyyy",Date) & Right("0" & DatePart("m",Date), 2) & Right("0" & DatePart("d",Date), 2)
4. In the 'Capture the Reference Machine' step I can then use the TSDate Variable to create a unique file name for the capture and also use the version field. There is a bug with the SCCM console as it doesn't use the Description field when importing, the next 2 steps resolve that.
5. Connect to OS Capture share.
6. Copy imagex to a package, then use it to run the following command line
imagex.exe /info R:\WIN81_x64_Base-%TSDate%.wim 1 "Windows 8.1 Enterprise" "WIN81 x64 - %TSDate%"
7. You can now import into SCCM with all the fields filled in correctly
MDT UDI Pre-flight checks
One of the best things to come out of MDT is the User Driven Interface (UDI) and the preflight page which allows custom checks. You can control whether a check passes or not with the exit code of the script. The locations to put preflight scripts is MDT Toolkit files packagetoolsArchPreflight
Check Hardware Model
This is a VBscript that goes through from Win32_ComputerSystem Model and exits with 0 if it finds a match.
Preflight Name and Type
Display Name: Check Hardware Model
Type: Shell Execute Task
Preflight Parameter Settings
File Name: %windir%system32cscript.exe
Parameters: PreflightOSDCheckHWModel.vbs $OSDComputerName
Status Bitmap: imagesram.bmp
Exit Code Values
Type | Status | Matches Value | Displayed Message |
Success | Success | 0 | Hardware Model Supported |
Error | Error | 1 | This Model is not currently supported to run the Windows 7 SOE. |
Check TPM Chip
This is a powershell script that exits 0 if it is a VM or a MAC (machines allowed to not have TPM) then checks for the existence of a TPM chip. It then checks to see if it has been activated in the BIOS.
Takes a few seconds to run, hopefully I can optimise it in the future.
Preflight Name and Type
Display Name: Check TPM Chip
Type: Shell Execute Task
Preflight Parameter Settings
File Name: %windir%System32WindowsPowerShellv1.0powershell.exe
Parameters: -executionpolicy bypass -file %deployroot%toolsx64PreflightOSDCheckTPMChipV2.ps1
Status Bitmap: imagesram.bmp
Exit Code Values
Type | Status | Matches Value | Displayed Message |
Success | Success | 0 | TPM chip is enabled |
Error | Error | * | No TPM Chip found. Please enable in the BIOS before continuing |
Error | Error | 20 | Please activate the TPM chip in the BIOS |
Check AD Name
I have a script that looks to the AD to warn if the computer name exists. There's quite a bit of work involved to get it working, will share if anyone is interested.
Setting lockscreen and wallpaper based on resolution for Windows 8.1 during OSD
Lockscreen
First you need to create and name files in this convention (we used png files and renamed them to jpg - this somehow works)
LockScreen___2160_1440.jpg
LockScreen___1024_0768.jpg
We used the top 10 resolutions on client machines and also the Surface Pro 3 resolution
1680 x 1050
1920 x 1080
1280 x 1024
1366 x 768
1024 x 768
1600 x 900
1920 x 1200
1280 x 800
2560 x 1440
1600 x 1200
2160 x 1440
Notice each number is 4 characters.
During OSD run the following commands using a package with the images in it
xcopy /s LockScreen*.* C:ProgramDataMicrosoftWindowsSystemDataS-1-5-18ReadOnlyLockScreen_Z /y
xcopy /s LockScreen*.* C:ProgramDataMicrosoftWindowsSystemDataS-1-5-18ReadOnlyLockScreen_Y /y
xcopy /s LockScreen*.* C:ProgramDataMicrosoftWindowsSystemDataS-1-5-18ReadOnlyLockScreen_X /y
The reason for copying to 3 folders is that if the resolution changes it uses the next letter (Internet told me, haven't confirmed)
Wallpaper
Create a new package separate from the lockscreen package with the files above however with a new naming convention so the script below is happy
BackgroundDefault2160x1440.jpg
BackgroundDefault1024x768.jpg
and so on.
In your unattend.xml file Under Specializeamd64_Microsoft-Windows-Shell-Setup_neutralThemes
set DesktopBackground to "C:windowsWebWallpaperHappySCCMBackgroundDefault.jpg"
changing HappySCCM to your org/theme name.
In your package add the script https://send.estate/s?e=8d2b330455d4fcb
In your task sequence have 2 run commands using the package
xcopy /s *.jpg %windir%WebWallpaperHappySCCM /y
cscript.exe SetBackground.vbs
You can also modify the last section of the code, if the resolution doesn't match it uses the BackgroundDefault1920x1080.jpg, rename that to an image that scales well.
Deploy Windows 10 Preview with SCCM 2012 R2 (Unsupported)
Johan Arwidmark and Niall Brady have posted guides on deploying Windows 10 Preview injecting the Windows 10 version of Dism during the task sequence.
Adding custom programs to the Set Default Programs UI
Hi, today I wanted the CMTrace tool to be recognised in the Set Default Programs control panel applet. There is a bit of information on the net but it's confusing.
In the registry you can set the program, launch arguments, file types and icon. This can be used for any app by modifying the reg file.
Once added you may like to use DISM.exe to extract your chosen defaults and import during your task sequence.
12 Dism /Online /Export-DefaultAppAssociations:Defaults.xmlDism /Online /Import-DefaultAppassociations:Defaults.xml