Download presentation
1
Customizing your Windows Deployments
Tips, Tricks and Code Keith Garner @KeithGa1 DeploymentLive.com MMS Minnesota 2014
2
Agenda Welcome All About Customizations Customizing the Task Sequence
Customizing with Code Cmd.exe, VBScript, Powershell, C#, C++ and more! Customizing your MDT LTI and SCCM ZTI environments! With Hydration! Questions / Discussions and more! MMS Minnesota 2014
3
Customization Step Zero
Why Customize (why not)? Stick with Well-Known and Proven Solutions (Aaron Margosis) Be careful when modifying existing code. Use revision control. Don’t make changes to your production environment. Test First! Are you using a Hacks? or Proven technologies. CopyProfile=True (Imperfect solution, use GPO) Tip: KISS – Keep It Simple Stupid! Customization – When the default just won’t do! MMS Minnesota 2014
4
Customizing Windows with Unattend.xml
Quick and Dirty deployments Automated Settings through Unattend.xml ComputerName=* For Manual let the OS go through OOBE Setup. Best when image is “Ready to Go!” Applications, Settings, and Drivers pre-installed. Not recommended for heavy customizations. Place Unattend.xml into OS for detection. Tip: Be aware of where your steps go in Unattend.xml… MMS Minnesota 2014
5
Windows Configuration Passes
WindowsPE Run during WinPE OfflineServicing Run Offline Specialize Apply System Specific Info Generalize Run during Sysprep AuditSystem Audit Mode (System) AuditUser Audit Mode (User) OOBESystem Customize the machine MMS Minnesota 2014
6
Demo Unattend.xml All about Unattend.xml Where instructions go.
CopyProfile Specialize PersistAllDeviceInstalls Generalize Code: Create a Bootable VHD MMS Minnesota 2014
7
MDT and SCCM When to use MDT/SCCM?
Don’t create your own “Environment/System” Let MDT/SCCM handle it all: Settings,Tasks,Reporting,Events… Choose the right tool: MDT LTI – Lightweight, Self Service, Cheap. SCCM ZTI – Heavy Duty, Fully Automated. SCCM UDI – Admin Directed with User Input. MMS Minnesota 2014
8
The Task Sequencer Task Sequencer Wizard Bootstrap.ini WMI ZTIGather
[Settings] Priority=Default [Default] DeployRoot=\\MDT01\Deploy$ ZTIGather Script CustomSettings.ini [Settings] Priority=Default,Csettings,WS [Default] JoinDomain=Corp.Contoso.com UserExit = MyCustomScript.vbs ... Variables K – 3 minutes OSDComputerName=PSX0304 Applications1={427e7d …} JoinDomain=Corp.Contoso.com BDEInstall=TPM DoCapture=SysPrep [Csettings] SQLServer=SQL01 … WebService [WS] WebService= Parameters=MacAddress, … MMS Minnesota 2014
9
Customization before the Task Sequence Starts
ZTIGather.wsf and CustomSettings.ini Bootstrap.ini ZTIGather.xml UserExit.vbs Wizards mdtwizardstudio.codeplex.com Litetouch.wsf Edit as a last resort. MMS Minnesota 2014
10
Demo Pre-Task Sequence
ZTIGather.wsf and CustomSettings.ini /INIFile:FileName.ini Wizards Mshta.exe Enable Debugging in IE Mshta.exe c:\DeploymentShare\Scripts\Wizard.hta /definition:DeployWiz_AdminPassword.xml SCCM – ZTIMediaHook.wsf MMS Minnesota 2014
11
Running Custom Steps Import Deployment Packages
Into SCCM (Packages/Applications) Into MDT (Applications) Task Sequencer may not understand every \\UNC Share Will your steps run in all scenarios? \\UNC Offline USB MMS Minnesota 2014
12
Demo Task Sequence Add Steps to the Task Sequence Continue on Error
MMS Minnesota 2014
13
Code – Know your language
Shell Ext OS Completeness WMI COM .NET Win32 NTShell .cmd All Limited (Ideal for file manipulation) VBScript / Jscript .vbs .js Highly Functional (Some limitations) Yes PowerShell .ps1 WMF Fully Functional, Can call .net/Win32 Pinvoke C# .cs Fully Functional / Compiled YES C++ .c Fully Functional / Compiled MMS Minnesota 2014
14
Language 1 - CMD Been around since before Windows
Ideal language for file operations. Variables stored in the Environment %ComputerName% Cmd.exe is the interpreter Required to parse *.cmd and *.bat files. Some commands are native and some are external. Copy – Native XCopy and RoboCopy – external MMS Minnesota 2014
15
Demo CMD Add a command to the task sequence
Native vs external Call a script over the network. Scripting Best Practices. Logging Tip: 2>&1 MMS Minnesota 2014
16
Language 2 – VBScript Available on all released versions of Windows
Supports WMI and COM objects for extensibility No direct support for .NET or Win32 API’s Use ZTIUtility.vbs from MDT in your scripts Logging access to bdd.log SCCM Variables Store Many Common routines MMS Minnesota 2014
17
Demo VBS Example script Error handling Debugging
On Error Resume Next Debugging Cscript.exe /x File.wsf /Debug:True /DebugCapture Write to the bdd.log file and crash a script! MMS Minnesota 2014
18
Language 3 – PowerShell One cool language!
Scripting environment of choice for Windows Server Admins Tip: Use the built in MDT PowerShell host! Built in Logging Access to Task Sequence Environment $TSEnv:OSDComputerName MMS Minnesota 2014
19
Better Practices for PowerShell
Use the PowerShell ISE About_Comment_Based_Help – Self documenting Don’t use Write-Host Use Write-Output Or Write-verbose Comments… Documentation Prototype with the console, use “h” to get history. MMS Minnesota 2014
20
Demo PowerShell Commands with the ISE Get history with PowerShell
PowerShell Best practices PowerShell with MDT MMS Minnesota 2014
21
Customizing the Hosts Just about everything can be automated on Servers. Windows Server 2012 R2 MDT/SCCM Hyper-V/SCVMM Don’t document! SCRIPT! Don’t get hit by a bus… MMS Minnesota 2014
22
Demo – Customizing the Hosts
Use MDT to build the command for you. Self Documenting! SCCM Automation. MMS Minnesota 2014
23
Resources DeploymentLive.com For these slides
MDT TechNet Forums for scripting help Google/Bing Technet and StackOverflow More Sessions! MMS Minnesota 2014
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.