### Get Capabilities Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-capabilities-package-servicing-command-line-options Lists all capabilities and their installation status for the online image. ```cmd DISM /Online /Get-Capabilities ``` -------------------------------- ### Get-Apps Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-application-servicing-command-line-options Example of retrieving basic information about all Windows Installer applications. ```cmd Dism /image:C:\test\offline /Get-Apps ``` -------------------------------- ### Optimize Image Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14 Examples of running image optimization for boot configuration or WIMBoot setup. ```cmd DISM.exe /Image:C:\test\offline /Optimize-Image /Boot ``` ```cmd DISM.exe /Image:C:\test\offline /Optimize-Image /WimBoot ``` -------------------------------- ### Add-Driver Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-driver-servicing-command-line-options-s14 Example of installing multiple .inf driver packages into an offline image in a specific order. ```cmd Dism /Image:C:\test\offline /Add-Driver /Driver:C:\test\drivers\1.inf /Driver:C:\test\drivers\2.inf /Driver:C:\test\drivers\3.inf ``` -------------------------------- ### Set Setup UI Language example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-languages-and-international-servicing-command-line-options Configures the default fallback language for the Windows Setup process. ```cmd Dism /image:C:\test\offline /Set-SetupUILang:fr-FR /distribution:C:\windows_distribution ``` -------------------------------- ### Install 64-bit Windows using 32-bit Setup with /InstallFrom Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-supported-platforms-and-cross-platform-deployments Use the /InstallFrom command-line option to specify the path to a 64-bit Windows image when running 32-bit Windows Setup. ```Windows Command Prompt D:\setup.exe /InstallFrom:"N:\Windows_64-bit\sources\install.wim" ``` -------------------------------- ### Create a Setupconfig.ini file Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-automation-overview Example configuration file for Windows Setup automation. Parameters are defined under the [SetupConfig] header. ```ini [SetupConfig] NoReboot ShowOobe=None Telemetry=Enable ``` -------------------------------- ### Install 64-bit Windows using 32-bit Setup with an unattend file Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-supported-platforms-and-cross-platform-deployments Execute 32-bit Windows Setup using an unattend file to configure the installation of a 64-bit Windows image. ```Windows Command Prompt D:\setup.exe /unattend:"D:\unattend_install_64-bit.xml" ``` -------------------------------- ### Get Provisioning Package Info Syntax and Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-provisioning-package-command-line-options Use these commands to retrieve metadata and information about a specific provisioning package. ```cmd DISM.exe /Get-ProvisioningPackageInfo /PackagePath: ``` ```cmd DISM.exe /Image=C:\ /Get-ProvisioningPackageInfo /PackagePath:C:\oem.ppkg ``` ```cmd DISM.exe /online /Get-ProvisioningPackageInfo /PackagePath:C:\oem.ppkg ``` -------------------------------- ### Get Image Information Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14 Examples of retrieving information from WIM and VHD files. ```cmd Dism /Get-ImageInfo /ImageFile:C:\test\offline\install.wim ``` ```cmd Dism /Get-ImageInfo /ImageFile:C:\test\images\myimage.vhd /Index:1 ``` -------------------------------- ### Enable Compact OS Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Configures Windows Setup to install using compressed system files. ```bash setup /compactos enable ``` -------------------------------- ### Install split image using Windows Setup Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/split-a-windows-image--wim--file-to-span-across-multiple-dvds Execute Windows Setup pointing to the location of the split .swm files. ```Windows Command Prompt D:\Setup.exe /InstallFrom:"C:\TempInstallFolder\install.swm" ``` -------------------------------- ### Specify Custom Install Image Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Directs Windows Setup to use a specific .wim or .swm file for the installation process. ```bash setup /installfrom D:\custom.wim ``` ```bash setup /installfrom D:\install.swm ``` -------------------------------- ### Install ADK tools on destination device Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/siloed-provisioning-packages Execute the setup executable to install the required tools on the destination device. ```Windows Command Prompt W:\ADKTools\amd64\WimMountAdkSetupAmd64.exe /Install /q ``` -------------------------------- ### Add Provisioning Package Syntax and Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-provisioning-package-command-line-options Use these commands to add provisioning package payloads to images or running Windows installations. ```cmd DISM.exe /Add-ProvisioningPackage /PackagePath: [/CatalogPath:] ``` ```cmd DISM.exe /Image=D:\mount /Add-ProvisioningPackage /PackagePath:C:\oem.ppkg ``` ```cmd DISM.exe /online /Add-ProvisioningPackage /PackagePath:C:\oem.ppkg ``` -------------------------------- ### Example package verification output Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/servicing-the-image-with-windows-updates-sxs Sample output showing the details of an installed package after running the Get-Packages command. ```Windows Command Prompt Package Identity : Package_for_RollupFix~31bf3856ad364e35~amd64~~15063.250.1.1 State : Installed Release Type : Security Update Install Time : 04/29/2017 6:26 PM The operation completed successfully. ``` -------------------------------- ### Get Feature Information Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-operating-system-package-servicing-command-line-options Examples demonstrating how to retrieve feature information from an offline image, optionally specifying a package path. ```Windows Command Prompt Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts ``` ```Windows Command Prompt Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts /PackagePath:C:\packages\package.cab ``` -------------------------------- ### Add-Capability Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-capabilities-package-servicing-command-line-options Examples demonstrating how to add a capability using different source and access configurations. ```cmd Dism /Online /Add-Capability /CapabilityName:Language.Basic~~~en-US~0.0.1.0 ``` ```cmd Dism /Online /Add-Capability /CapabilityName:Language.Basic~~~en-US~0.0.1.0 /Source:\server\share /Source:\server2\share ``` ```cmd Dism /Online /Add-Capability /CapabilityName:Language.Basic~~~en-US~0.0.1.0 /Source:\server\share /LimitAccess ``` -------------------------------- ### /SkipFinalize Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Instructs setup to start update operations on the down-level OS without initiating a reboot to start the offline phase. ```APIDOC ## /SkipFinalize ### Description Instructs setup to start update operations on the down-level OS without initiating a reboot to start the offline phase. ### Syntax /SkipFinalize ### Example setup /auto upgrade /quiet /priority low /skipfinalize ``` -------------------------------- ### Package identity output Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-update-to-winre Example output showing the state of an installed package. ```text Package Identity : Package_for_KB5021041~31bf3856ad364e35~amd64~~22621.815.1.0 State : Installed Release Type : Update ``` -------------------------------- ### Define multiple Start menu pins in LayoutModification.json Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/oem-deployment-of-windows-desktop-editions Example of a complete configuration file containing primary, secondary, and first-run OEM pins. ```json { "primaryOEMPins": [ { "packagedAppId": "OEM.App1_1abcde2f3ghjk!App"}, { "desktopAppLink": "%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk"}, { "packageAppId": "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App", "tileId": "MSEdge.paomdnjincdkenhiicpl.UserData.Default"} ], "secondaryOEMPins": [ { "packagedAppId": "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App", "tileId": "MSEdge.anfoedbkjbcacemdbigf.UserData.Default" }, { "desktopAppId": "Contoso.Desktop.Example.AUMID"} ], "firstRunOEMPins": [ { "desktopAppLink": "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\PutMeInRecommended.lnk", "caption": { "en-US": "(localized caption text for US English)", "de": "(localized caption text for German)", "default": "(fallback caption text for other languages)" } } ] } ``` -------------------------------- ### Get-AppPatches Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-application-servicing-command-line-options Examples of retrieving patch information for all applications or a specific product code. ```cmd Dism /image:C:\test\offline /Get-AppPatches ``` ```cmd Dism /image:C:\test\offline /Get-AppPatches /ProductCode:{B0F9497C-GUID-GUID-GUID-74D866BBDF59} ``` -------------------------------- ### Get-AppInfo Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-application-servicing-command-line-options Examples of retrieving application information for all apps or a specific product code. ```cmd Dism /image:C:\test\offline /Get-AppInfo ``` ```cmd Dism /image:C:\test\offline /Get-AppInfo /ProductCode:{B0F9497C-GUID-GUID-GUID-74D866BBDF59} ``` -------------------------------- ### Copype Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/copype-command-line-options An example command to create a working directory for the amd64 architecture. ```cmd copype amd64 C:\winpe_amd64 ``` -------------------------------- ### Copy Windows Installation Files Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-multilingual-support-to-windows-setup Create a local directory and copy installation media contents to it. ```Console md C:\my_distribution xcopy /E D: C:\my_distribution ``` -------------------------------- ### CertToReg.cmd execution example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/validation-os-convert-certificate-to-registry-file Example command execution specifying the certificate path, thumbprint, and output file. ```cmd CertToReg.cmd c:\temp\oem.cer 4ce12345678... c:\temp\oem_testcert.reg ``` -------------------------------- ### Set Setup UI Language syntax Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-languages-and-international-servicing-command-line-options Defines the default language for Windows Setup. ```cmd Set-SetupUILang: ``` -------------------------------- ### Get Installed MSP Patch Information Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-application-servicing-command-line-options Retrieves detailed information about installed MSP patches, optionally filtered by patch or product GUIDs. ```cmd /Get-AppPatchInfo: [/PatchCode:] [/ProductCode:] ``` ```cmd Dism /image:C:\test\offline /Get-AppPatchInfo ``` ```cmd Dism /image:C:\test\offline /Get-AppPatchInfo: /PatchCode:{B0B9997C-GUID-GUID-GUID-74D866BBDFFF} ``` ```cmd Dism /image:C:\test\offline /Get-AppPatchInfo: /ProductCode:{B0F9497C-GUID-GUID-GUID-74D866BBDF59} ``` ```cmd Dism /image:C:\test\offline /Get-AppPatchInfo: /PatchCode:{B0B9997C-GUID-GUID-GUID-74D866BBDFFF} /ProductCode:{B0F9497C-GUID-GUID-GUID-74D866BBDF59} ``` -------------------------------- ### Add-Driver Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-driver-servicing-command-line-options-s14 Examples demonstrating how to add drivers from folders, recursively, or as individual files, including the use of /ForceUnsigned. ```cmd Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers ``` ```cmd Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers /recurse ``` ```cmd Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers\mydriver.inf ``` ```cmd Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers\mydriver.inf /ForceUnsigned ``` -------------------------------- ### Run Windows Setup with an answer file Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-driver-online-in-audit-mode Command to initiate Windows Setup while specifying the path to the answer file. ```cmd Setup /unattend:C:\unattend.xml ``` -------------------------------- ### Apply Siloed Provisioning Package Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14 Example command applying multiple siloed provisioning packages to a Windows image. ```cmd Dism.exe /apply-SiloedPackage /PackagePath:C:\test\Word.spp /PackagePath:C:\test\spp2.spp /ImagePath:C:\ ``` -------------------------------- ### Example subgroup and setting GUID output Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/fine-tune-a-custom-power-plan-technicalreference Displays the GUIDs for a specific subgroup and power setting. ```text Subgroup GUID: {guidSubgroup-Display} (Display) ``` ```text Power Setting GUID: {guidPowerSetting-Brightness} (Display brightness) ``` -------------------------------- ### Disable Windows Setup Telemetry Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Configures Windows Setup to stop capturing and reporting installation data. ```bash setup /telemetry disable ``` -------------------------------- ### Initialize WSK Environment Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/factoryos/classic-settings Run the environment setup script from the mounted WSK ISO as an administrator. ```cmd D:\SetWSKImagGenEnv.cmd ``` -------------------------------- ### Winpeshl.ini configuration example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpeshlini-reference-launching-an-app-when-winpe-starts Example configuration file demonstrating both [LaunchApp] and [LaunchApps] sections for executing custom binaries during WinPE initialization. ```ini [LaunchApp] AppPath = %SYSTEMDRIVE%\Fabrikam\shell.exe [LaunchApps] %SYSTEMDRIVE%\Fabrikam\app1.exe %SYSTEMDRIVE%\Fabrikam\app2.exe, /s "C:\Program Files\App3" ``` -------------------------------- ### /Get-AppInfo Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-application-servicing-command-line-options Displays detailed information about a specific installed Windows Installer application or all applications if no GUID is provided. ```APIDOC ## /Get-AppInfo ### Description Displays detailed information about a specific installed Windows Installer application. If a product code GUID is not specified, information is displayed for all Windows Installer applications installed in the offline image. ### Syntax /Get-AppInfo [/ProductCode] ### Examples Dism /image:C:\test\offline /Get-AppInfo Dism /image:C:\test\offline /Get-AppInfo /ProductCode:{B0F9497C-GUID-GUID-GUID-74D866BBDF59} ``` -------------------------------- ### Copy localized Windows Setup files Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-multilingual-support-to-windows-setup Copies language-specific setup resources from the installation media to the distribution folder. ```Console xcopy E:\sources\fr-fr C:\my_distribution\sources\fr-fr /cherkyi ``` -------------------------------- ### Specify Temporary Installation Drive Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Directs Windows Setup to store temporary installation files on the specified partition. ```bash setup /tempdrive H ``` -------------------------------- ### Sample Script Output Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/factoryos/build-a-factoryos-image Example output showing the backup and registration process of apps into the feature manifest. ```Windows Command Prompt Script will backup then append new Apps to C:\FactoryWorkSpace\FMFiles\OEMAppsFM.xml if it exists. Existing Apps FM found. Backing up existing file to C:\Users\administrator\AppData\Local\Temp\WSKScriptBackups\OEMAppsFM_3.xml... Searching C:\FactoryWorkSpace\Apps for Apps to add to C:\FactoryWorkSpace\FMFiles\OEMAppsFM.xml... Adding C:\FactoryWorkSpace\Apps\Dependencies\arm\Microsoft.NET.Native.Framework.1.7.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\arm\Microsoft.NET.Native.Runtime.1.7.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\arm\Microsoft.VCLibs.Arm.14.00.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\x64\Microsoft.NET.Native.Framework.1.7.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\x64\Microsoft.NET.Native.Runtime.1.7.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\x86\Microsoft.NET.Native.Framework.1.7.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\x86\Microsoft.NET.Native.Runtime.1.7.appx to FM... Adding C:\FactoryWorkSpace\Apps\Dependencies\x86\Microsoft.VCLibs.x86.14.00.appx to FM... Adding C:\FactoryWorkSpace\Apps\HelloWorld_1.0.0.0_x64.appx to FM... FM file successfully created at C:\FactoryWorkSpace\FMFiles\OEMAppsFM.xml. All newly found Apps under C:\FactoryWorkSpace\Apps are now unconditionally in any image that includes C:\FactoryWorkSpace\FMFiles\OEMAppsFM.xml. Remember to make apps or drivers you do not want in every image "Optional" (apps) or in a FM Feature (drivers). The previous version of C:\FactoryWorkSpace\FMFiles\OEMAppsFM.xml is backed up at C:\Users\administrator\AppData\Local\Temp\WSKScriptBackups\OEMAppsFM_3.xml. ``` -------------------------------- ### Execute Post-OOBE Scripts with /PostOOBE Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Runs a setupcomplete.cmd script after Windows Setup finishes, either by specifying the file path or the containing folder. ```bash setup.exe /auto upgrade /postoobe C:\Fabrikam\setupcomplete.cmd ``` ```bash setup.exe /auto upgrade /postoobe C:\Fabrikam ``` -------------------------------- ### Example script output Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/factoryos/build-a-factoryos-image Sample output showing the backup and addition of drivers to the feature manifest. ```text Script will backup then append new Drivers to C:\FactoryWorkspace\FMFiles\OEMDriversFM.xml if it exists. Existing Drivers FM found. Backing up existing file to C:\Users\username\AppData\Local\Temp\WSKScriptBackups\OEMDriversFM.xml... Searching C:\FactoryWorkspace\DCHUDrivers for Drivers to add to C:\FactoryWorkspace\FMFiles\OEMDriversFM.xml... Adding C:\FactoryWorkspace\DCHUDrivers\devices.driver.display.inf to FM... … Adding C:\FactoryWorkspace\DCHUDrivers\audio.driver.inf to FM... FM file successfully created at C:\FactoryWorkspace\FMFiles\OEMDriversFM.xml. All newly found Drivers under C:\FactoryWorkspace\DCHUDrivers are now unconditionally in any image that includes C:\FactoryWorkspace\FMFiles\OEMDriversFM.xml. Remember to make apps or drivers you do not want in every image "Optional" (apps) or in a FM Feature (drivers). The previous version of C:\FactoryWorkspace\FMFiles\OEMDriversFM.xml is backed up at C:\Users\username\AppData\Local\Temp\WSKScriptBackups\OEMDriversFM.xml. ``` -------------------------------- ### /Get-Capabilities Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-capabilities-package-servicing-command-line-options Gets a list of capabilities in the image and their install status. ```APIDOC ## /Get-Capabilities ### Description Gets a list of capabilities in the image, and their install status. ### Syntax `DISM /Online /Get-Capabilities` ``` -------------------------------- ### Package metadata example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/factoryos/image-auditing An example of a package entry containing specific metadata such as partition, public key token, installed size, and version. ```xml ``` -------------------------------- ### Makewinpemedia usage examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/makewinpemedia-command-line-options Common usage patterns for creating USB and ISO media, including optional formatting flags. ```Windows Command Prompt Makewinpemedia /ufd C:\winpe_amd64 F: ``` ```Windows Command Prompt Makewinpemedia /iso C:\winpe_amd64 C:\winpe_amd64\winpe_amd64.iso ``` ```Windows Command Prompt Makewinpemedia /ufd /f C:\winpe_amd64 F: ``` ```Windows Command Prompt C:\winpe_amd64 ``` -------------------------------- ### Run Windows Setup with ConfigFile Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-automation-overview Command to execute setup.exe while specifying the path to a custom Setupconfig.ini file. ```cmd Setup.exe /ConfigFile ``` -------------------------------- ### Get-Features Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-operating-system-package-servicing-command-line-options Examples showing how to list features in an image, specify output format, or target a specific package or file path. ```Windows Command Prompt Dism /Image:C:\test\offline /Get-Features ``` ```Windows Command Prompt Dism /Image:C:\test\offline /Get-Features /Format:List ``` ```Windows Command Prompt Dism /Image:C:\test\offline /Get-Features /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0 ``` ```Windows Command Prompt Dism /Image:C:\test\offline /Get-Features /PackagePath:C:\packages\package1.cab ``` -------------------------------- ### Get Capability Information Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-capabilities-package-servicing-command-line-options Retrieves information for a specific language capability. ```cmd DISM /Online /Get-CapabilityInfo /CapabilityName:Language.Basic~~~en-US~0.0.1.0 ``` -------------------------------- ### Get TShell environment variables Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/factoryos/connect-using-tshell Retrieves the TShell installation path and version information. ```powershell PS C:\> Get-Variable TShell* Name Value ---- ----- TShellInstallPath C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\TShell\TShell TShellVersion 8.1.1801.9001 ``` -------------------------------- ### Initialize Networking via Wpeutil.dll Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-create-apps Example demonstrating how to load Wpeutil.dll and invoke the InitializeNetworkW function. ```cpp #include #include #include typedef int (*WpeutilFunction)( HINSTANCE hInst, HINSTANCE hPrev, LPTSTR lpszCmdLine, int nCmdShow ); int __cdecl _tmain( int argc, TCHAR *argv[] ) { HMODULE hWpeutil = NULL; WpeutilFunction InitializeNetwork = NULL; int result = 0; TCHAR szCmdLine[] = _T(""); hWpeutil = LoadLibrary( _T("wpeutil") ); if( NULL == hWpeutil ) { _tprintf( _T("Unable to load wpeutil.dll \ n") ); return GetLastError(); } InitializeNetwork = (WpeutilFunction)GetProcAddress( hWpeutil, "InitializeNetworkW" ); if( NULL == InitializeNetwork ) { FreeLibrary( hWpeutil ); return GetLastError(); } result = InitializeNetwork( NULL, NULL, szCmdLine, SW_SHOW ); if( ERROR_SUCCESS == result ) { _tprintf( _T("Network initialized. \ n") ); } else { _tprintf( _T("Initialize failed: 0x%08x"), result ); } FreeLibrary( hWpeutil ); return result;} ``` -------------------------------- ### Provision Packed App with Dependencies Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-app-package--appx-or-appxbundle--servicing-command-line-options Example of provisioning a packed .appx file with multiple dependency packages and a license file to an online image. ```cmd Dism /Online /Add-ProvisionedAppxPackage /PackagePath:C:\Test\Apps\MyPackedApp\MainPackage.appx /DependencyPackagePath:C:\Test\Apps\MyPackedApp\Framework-x86.appx /DependencyPackagePath:C:\Test\Apps\MyPackedApp\Framework-x64.appx /LicensePath:C:\Test\Apps\MyLicense.xml ``` -------------------------------- ### Apply Unattended Answer File Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Specifies the path to an XML answer file for automated Windows Setup installation. ```bash setup /unattend:\\server\share\unattend.xml ``` -------------------------------- ### Example output of powercfg -LIST Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/fine-tune-a-custom-power-plan-technicalreference Shows the format of the power scheme list including GUIDs and active status. ```text Existing Power Schemes (* Active) ----------------------------------- Power Scheme GUID: {guidPlan1} (Balanced) * Power Scheme GUID: {guidPlan2} (Power saver) ``` -------------------------------- ### Register a custom tool with a configuration file Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/reagentc-command-line-options Example of using a specific XML configuration file to define the tool's appearance in the boot menu. ```cmd Reagentc /setbootshelllink /configfile F:\BootMenu\AddDiagnosticsToolToBootMenu.xml ``` -------------------------------- ### Get WIMBoot Entry Syntax and Example Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14 Syntax and usage for displaying WIMBoot configuration entries on Windows 8.1. ```cmd Dism /Get-WIMBootEntry /Path: ``` ```cmd Dism /Get-WIMBootEntry /Path:C:\ ``` -------------------------------- ### Initialize Windows System Kit Environment Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/factoryos/prepare-a-workspace Run this command as an administrator to set up the build environment. Use CEIPON or CEIPOFF parameters to handle the Customer Experience Improvement Program prompt in automated environments. ```cmd E:\SetImagGenEnv.cmd {CEIPON | CEIPOFF} ``` -------------------------------- ### Get Provisioned App Packages Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-app-package--appx-or-appxbundle--servicing-command-line-options Lists app packages set to install for new users in an offline image. ```cmd Dism /Image:C:\test\offline /Get-ProvisionedAppxPackages ``` -------------------------------- ### Prepare temporary directory for image Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-10-s-deployment-sxs Creates a local directory and copies the install.wim file for processing. ```Windows Command Prompt md c:\temp copy d:\sources\install.wim c:\temp ``` -------------------------------- ### Specify Product Key with /PKey Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Provides a specific product key to Windows Setup during the upgrade process. ```bash setup.exe /auto upgrade /pkey xxxxx-xxxxx-xxxxx-xxxxx-xxxxx ``` -------------------------------- ### /Get-AppPatches Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-application-servicing-command-line-options Displays basic information about all applied MSP patches for applications installed on the offline image. Optionally filter by a specific product code GUID. ```APIDOC ## /Get-AppPatches ### Description Displays basic information about all applied MSP patches for all applications installed on the offline image. If a product code GUID is specified, information is displayed about all patches in the specified Windows Installer application. ### Syntax /Get-AppPatches: [/ProductCode:] ### Examples Dism /image:C:\test\offline /Get-AppPatches Dism /image:C:\test\offline /Get-AppPatches /ProductCode:{B0F9497C-GUID-GUID-GUID-74D866BBDF59} ``` -------------------------------- ### Get package information from a running operating system Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/take-inventory-of-an-image-or-component-using-dism Use these commands to inspect packages currently installed on the running operating system. ```Windows Command Prompt Dism /online /Get-PackageInfo /PackagePath:C:\packages\package.cab ``` ```Windows Command Prompt Dism /online /Get-PackageInfo /PackageName:Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0 ``` -------------------------------- ### Apply WIM Image Examples Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14 Examples for applying a standard WIM file and a split WIM (SWM) file. ```bash Dism /apply-image /imagefile:install.wim /index:1 /ApplyDir:D:\ ``` ```bash Dism /apply-image /imagefile:install.swm /swmfile:install*.swm /index:1 /applydir:D: ``` -------------------------------- ### Capture Windows Image with DISM Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/deploy-a-custom-image Capture the reference installation to a .wim file, ensuring Name and Description are provided for Windows Setup compatibility. ```cmd Dism /Capture-Image /ImageFile:C:\myimage.wim /CaptureDir:c:\ /Compress:fast /CheckIntegrity /Name:"Home" /Description:"Home reference installation" ``` -------------------------------- ### /Compat Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options Instructs Windows Setup how to handle compatibility scans and messages. ```APIDOC ## /Compat ### Description Instructs Windows Setup how to handle compatibility scans and messages. ### Syntax /Compat {IgnoreWarning | ScanOnly} ### Parameters - **IgnoreWarning** - Windows Setup completes installation, ignoring any dismissible compatibility messages. - **ScanOnly** - Windows Setup runs through compatibility scans, and then exits without completing the installation, returning specific exit codes based on findings. ### Example setup /compat ignorewarning ``` -------------------------------- ### Enable Windows RE with OS GUID Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/reagentc-command-line-options Example of enabling a custom Windows RE boot image from Windows PE using a specific BCD identifier. ```Windows Command Prompt Reagentc /enable /osguid {00000000-0000-0000-0000-000000000000} ``` -------------------------------- ### Initialize New Project Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/system-builder-deployment Run the CreateProject script to set up a new project directory based on a Windows installation image. ```cmd CreateProject.cmd D:\Sources\install.wim ``` -------------------------------- ### Specify Boot Order File Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/oscdimg-command-line-options Example of using the -yo option to specify a text file containing the desired file layout. ```text -yoC:\temp\bootOrder.txt ``` -------------------------------- ### Example Output of Power Plan List Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/create-a-custom-power-plan-technicalreference Shows the expected output format when listing power schemes, including GUIDs and plan names. ```Windows Command Prompt Existing Power Schemes (* Active) ----------------------------------- Power Scheme GUID: {guidPlan1} (Balanced) * Power Scheme GUID: {guidPlan2} (Power saver) Power Scheme GUID: {guidPlan3} (OutdoorPlan) ``` -------------------------------- ### List Windows Installer applications Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/take-inventory-of-an-image-or-component-using-dism Retrieve a list of all Windows Installer applications installed in an offline image. ```cmd Dism /image:C:\test\offline /Get-Apps ``` ```text Product Code : {DB935363-5A68-47AF-A55A-CFC90F2E83BC} Product Name : MsiTestApplication2 ```