Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP EmbeddedMicrosoft Corporation
Take Advantage of Feature Pack 2007 Footprint Reduction and Using XPECMD
Scripting XPECMD & Additional tasks
Footprint reduction in XPe SP2 FP2007
Creating a configuration using XPECMD
Modifying an existing configuration
Checking dependencies and building an image
AgendaGetting started with XPECMD
Key components re-factored to optimize footprint
How to take advantage of footprint reduction
XPECMD.wsf
Using resolution files
Getting Started with XPECMD
Entering console commands
Creating a new configuration
Modifying a configuration
Saving a configuration
What is XPECMD Tool?Command line tool
Combine GUIs (CD, CDM, TD)
Target configuration
Create/manipulate target configuration (.SLX)
Resolve dependencies & build target images
Working with XPe database
Import components
Look up components
Look up dependencies*
Automating build process*
Resolution Files*
Scripting*
Save Development Time!
GUI Tools
Database
CMI
Component
Designer
Component
Database Manager
Target Designer
XPECMD
Note: * Not in GUI tools
Console CommandsActivating a command window
‘Start’ -> ‘Run’ -> ‘Cmd’
Setting default script hostCscript //H:Cscript
Invoking XPECMD toolXpecmd
XPECMD commandsHelp – display a list of online command helps
Help <command> - display usage of a command (e.g. help dbopen)
Dbopen – open the database (e.g. dbopen local)
Dbclose – close the database
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Console Commands
Demo
Creating a New Configuration
Open XPe databaseXPECMD /db:local
Dbo local
Set visibilityMinvis 100
Create and activate configuration objectnew cfg Configuration
Save cfg “.\myConfigs\myCfg1.slx”
Use Target Designer to examine the configuration
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Creating a New Configuration
Demo
Adding a component
Viewing components
Viewing and changing component properties
Viewing resources in detail
Removing components
Modifying an Existing Config
Modifying Config – Adding a Component
Open database and set minimum visibilityDbo local
Minvis 100
Loading an existing configurationLoad cfg “.\myConfigs\myCfg1.slx”
Directly add an instance of the component into the configuration
Add cfg ‘inst:^Winlogon Sample Macro’
Save the modified configurationSave cfg “.\myConfigs\myCfg1.slx”
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Modifying Config - Adding a Component
Demo
Modifying Config – Viewing Components
Open database and set minimum visibilityDbo local
Minvis 100
Loading an existing configurationLoad cfg “.\myConfigs\myCfg1.slx”
View the instances of a configurationShow cfg.instances
Or, Show cfg
View the properties of a componentGet myInst cfg “Winlogon Sample Macro”
Show myInst.Properties
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Modifying Config - Viewing Components
Demo
Modifying Config – Changing Component Properties
Open database and set minimum visibilityDbo local
Minvis 100
Loading an existing configurationLoad cfg “.\myConfigs\myCfg1.slx”
Get an instance of a component in the configurationGet myInst cfg “Winlogon Sample Macro”
Change the properties of a componentmyInst.Properties(“cmiLangEnableMUI”) = “FALSE”
Save the modified configurationSave cfg “.\myConfigs\myCfg1.slx”
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Modifying Config – Changing Component Properties
Demo
Modifying Config – Viewing Resources
Component resources include
Registry data, files, properties or settings, and CMI advanced properties
View resources of any component in the database
New myComp = ‘comp:^Internet Explorer’
Show myComp.Resources – show registry data, files, and FBA actions
Show myComp.Properties – show settings and CMI advanced properties
Show myComp.Dependencies – list all dependencies
View resources of a component instance in a configuration
Load cfg “.\myConfigs\myCfg1.slx”
Get myInst cfg “WinLogon Sample Macro”
Show myInst.Resources
Show myInst.Properties
Show myInst.Dependencies
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Modifying Config - Viewing Resources
Demo
Modifying Config – Removing Components
Open database and set minimum visibility
Dbo local
Minvis 100
Loading an existing configuration
Load cfg “.\myConfigs\myCfg1.slx”
Remove the component instance by the component name
Remove cfg “Winlogon Sample Macro”
Or, remove the component instance by index number
Get myInst cfg “Winlogon Sample Macro”
Cfg.Instances.Remove(myInst.index)
Note: index number may change between loads of the same configuration!
Save the modified configuration
Save cfg “.\myConfigs\myCfg1.slx”
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Modifying Config - Removing Components
Demo
Using Resolution Files
Creating Resolution FileUse a text editor (e.g. notepad.exe)
Type in each command on each line (example below):
Dbopen local
Minvis 100
Load cfg Winlogon.slx
Show cfg.instances
Dbclose
Save as .res file (e.g. myRes.res)
Executing Resolution FileXpecmd @myRes.res /echo
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Using Resolution Files
Demo
Checking
Resolving
Building
Checking Dependencies and Building
Dependencies
Checking Dependencies and Building
Resolve the dependencies of the components for a configuration by adding the dependency chain
Load Cfg “myCfg.slx”
Cfg.ResolveDependencies 2
Check the dependencies of the components to see if they can resolve
Cfg.CheckDependencies 2
Build to generate runtime (with image path)Build cfg “.\myImages\myImage” /f /verbose
Note: /f – delete and write to existing folder
Save the final configurationSave Cfg “myCfg.slx”
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Checking Dependencies and Building
Demo
Scripting with XPECMD
Building res files using a script
Calling XPECMD from a script
Passing command line parameters to XPECMD
Calling other scripts from XPECMD
Using multiple .res files
Directing output to a file
Building res file using script' XPECMD Demo' autosetting.vbs – Setting properties of configuration files' --------------
Dim g_oFSO : Set g_oFSO = CreateObject("Scripting.FileSystemObject")Dim g_oShell : Set g_oShell = CreateObject("WScript.Shell")
Dim oFolder : Set oFolder = g_oFSO.GetFolder(".\myConfigs")Dim oRSP : Set oRSP = g_oFSO.CreateTextFile("Setting.rsp", true)
oRSP.WriteLine "dbopen local"For Each oFile in oFolder.Files If( LCase(Right(oFile.Name,3)) = "slx" ) Then oRSP.WriteLine "load myConfig "".\myConfigs\" & oFile.Name & """" oRSP.WriteLine "myconfig.Properties(""cmiTargetBootDrive"") = ""D:""" oRSP.WriteLine "myconfig.Properties(""cmiTargetDocsAndSettings"") = ""D:\Documents and Settings""" oRSP.WriteLine "myconfig.Properties(""cmiTargetProgramFiles"") = ""D:\Program Files""" oRSP.WriteLine "myconfig.Properties(""cmiTargetWinDir"") = ""D:\Windows""" oRSP.WriteLine "save myConfig "".\myConfigs\" & oFile.Name & """" oRSP.WriteLine "" End IfNextoRSP.WriteLine "dbclose"
oRSP.Close
Dim nResultnResult = g_oShell.Run( "cscript.exe xpecmd.wsf @Setting.rsp", 7, True )WScript.StdOut.WriteLine "Done. XPECMD exit code: " & nResult
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Building res file using scripting
Demo
Using multiple .res files
Invoking .res files using nested calls
.res file to remove the component (RemoveComp.res)
dbo local
load cfg .\myConfigs\myCfg.slx
Remove cfg "Winlogon Sample Macro"
save cfg .\myConfigs\myCfg.slx
@AddComp.res
dbclose
.res file to add a component (AddComp.res)
load cfg .\myConfigs\myCfg.slx
Add cfg 'inst:^Internet Explorer'
save cfg .\myConfigs\myCfg.slx
Execute the multiple .res files in nested call
Xpecmd /echo /log:multres.log @RemoveComp.res
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Using multiple .res files
Demo
Other Scripting CapabilitiesCalling XPECMD from a script (creating a shell object)
Dim g_oShell : Set g_oShell = CreateObject("WScript.Shell")
g_oShell.Run( "cscript.exe xpecmd.wsf @Setting.rsp", 7, True )
Passing command line parameters to XPECMDXPECMD /Db:local /log:mylog.log “load cfg .\myconfigs\myCfg1.slx” “cfg.CheckDependencies 0”
Note: Cannot pass parameters that require quotes!
Running shell commands from within XPECMD
Shell dir
Directing output to a fileXpecmd /echo /log:multres.log @RemoveComp.res
Note: /echo – echoing commands to screen and log file
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Other scripting capabilities with XPECMD
Demo
Importing custom components
Finding reverse dependencies
Finding component dependencies
Additional Tasks
Searching for components
Display name searchCollections of componentsDisplay name searchCollections of components
Additional Tasks
Importing custom components
Dbopen local
Dbimport .\mySLDs\myComp.SLD
Dbimport .\mySLDs\myComp.SLD \\localhost\Repositories
Searching for components
Show cfg.instances
Show ‘inst:^Internet Explorer’
Show ‘comp:^Internet Explorer’
Show ‘comps:Internet Explorer’
Finding component dependencies
Deptree /4 ‘comp:^Internet Explorer’
Finding reverse dependencies
Deptrace revscomps ‘comp:^Internet Explorer’
Thomas Yong, Program ManagerMatt Kellner, Software Test EngineerWindows XP Embedded
Additional Tasks
Demo
Footprint Reduction in FP2007
Key components re-factored
Internet Explorer 6 re-factoring
How to take advantage of footprint reduction?
How to remove old (unwanted) dependencies?
Configuration upgrade example
Feature Pack 2007 went through significant footprint reduction work – resulting in 3 to 30% depending upon applications
Key Components Re-factoredRe-factored Component Beneficiary ComponentsInternet Explorer 6 .NET Framework 1.1
Help and Support ServicesHTML Rendering EngineIMAPI - CD BurningInternet Connection WizardMicrosoft Vector Graphics Rendering (VML)Outlook ExpressShell Namespace ExtensionsSoap Client RuntimeWindows .Net MessengerWindows Media Player 10.0Windows Media Player 9.0Windows Movie Maker
Volume Shadow Copy WMI CoreSimple Network Management Protocol (SNMP) IIS FTP Server, IIS Web ServerOutlook Express Dialer Application, IIS Internet ManagerHelp and Support Services Remote Assistance Channel (for SMS Client
scenario)Administration Support Tools Users Control Panel
Internet Explorer 6 Re-factoring
Internet Explorer
in FP2007
Mshta.exe
Actxprxy.dll
Inetcpl.cpl
Hlink.dll
Iedkcs32.dll
Iexplore.exe
Cryptdlg.dll
Ieinfo5.ocx
Msidntld.dll
Msident.dll
Msrating.dll
Inseng.dll
Imgutil.dll
Jsproxy.dll
Dxtrans.dll
User Control Panel
Shell Namespa
ce Extension
.NET FWK 1.1
IMAPI CD
Burning
Help and
Support
Services
IE Group Policy
Support
Internet
Connect
Wizard
Outlook
Express
.NET FWK 2.0
HTML Rendering Engine
Windows Media Player (9 & 10)
.NET Messeng
erWindows Movie Maker
Misc. files
IE Core ComponentRe-factored IE PrimitiveOther Component
How to take advantage of footprint reduction?
Creating new configurationAutomatically taken care of by Target Designer
Upgrading from existing SP2 configurationNeed to manually identify old dependencies
Steps provided next
Use published article on MSDNGo here: http://msdn2.microsoft.com/en-us/library/bb147519.aspx
List of re-factored/optimized components in FP2007
Steps to follow to remove old dependencies
Tables listing removed dependencies and their sub-sequent dependencies
MSDN Article
How to remove old dependencies?
Find its dependencies in SP2(XPECMD>Deptree /4
‘comp:Internet Explorer|R2890’)
Next component?
For each component in the configuration
Find its dependencies in FP2007
(XPECMD>Deptree /4 ‘comp:Internet Explorer|
R3333’)
Delete old SP2 dependencies
For each old SP2 component removed
Find & remove all next level dependencies in SP2
Next removed SP2 component?
Remove all primitives from config
Run <Upgrade Configuration>
Run <Check Dependencies>
Build Image & Deploy
Yes
No
Yes
No
*
*
*
* Refer to dependency tables in MSDN article
Upgrade Demo - HTML Help Engine
PurposeUpgrading HTML Help Engine configuration from XPe SP2 to FP2007
GoalAchieve optimized footprint by removing old dependencies
ProcessBuild a new or use existing .SLX file based on XPe SP2
Go through the steps as outlined in previous slides
Show how XPECMD can help partial automation
Compare image footprints between SP2 and FP2007
Thomas YongProgram ManagerWindows XP Embedded
Upgrading Configuration from SP2 to FP2007
Demo
Demo – HTML Help EngineOriginal configuration based on XPe SP2
Demo – HTML Help EngineResolution file to remove SP2 dependencies
Demo – HTML Help EngineUpgraded configuration shows smaller footprint
Wow! 20% smaller!
Demo – HTML Help EngineNew configuration based on FP2007
Amazing! Same size!
Community Resources
Team Blog
http://blogs.msdn.com/embedded/default.aspx
Forums
http://forums.microsoft.com/EmbeddedWindows/
Newsgroups
Microsoft.public.windows.xp.embedded
MSDN Web Chats
http://msdn.microsoft.com/chats
General Embedded Community Website
http://msdn.microsoft.com/embedded/community
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date
of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Backup Slides
Console Commands - sample
Creating a New Configuration - sample
Adding a Component - sample
Viewing Components - sample
Changing Component Properties - sample
Viewing Resources - sample
Removing Components - sample
Using Resolution Files - sample
Checking Dependencies and Building - sample
Building res file using script – sample result
Passing Cmd Line ParametersPass the parameters on invoking XPECMD
XPECMD /Db:local /log:mylog.log “load cfg .\myconfigs\myCfg1.slx” “cfg.CheckDependencies 0”
Note: Cannot pass parameters that require quotes!
Running shell commands from winthin XPECMD
Using the built-in ShellShell dir
Using multiple .res files - sample
Directing output to a file - sample
Directing output to a text fileXpecmd /echo /log:multres.log @RemoveComp.res
Note: /echo – echoing commands to screen and log file
Importing Custom Component - sample
Searching for Components - sample
Finding Component Dependencies - sample
Finding Reverse Dependencies - sample