Use diagnostic Win32 apps in Factory OS

The Factory OS win32_manufacturing and win32_development product configurations allow you to run your existing Win32 manufacturing and diagnostic apps in a container during manufacturing, provisioning, and hardware validation flows. These Factory OS product configurations use Hyper-V for container support and RDP to communicate between the host and guest operating systems.

Creating a workspace for a Factory OS image that includes win32 support

To get started creating a Factory OS image that includes win32 support, you'll have to create a new workspace:

  1. Open the Windows System Kit environment as administrator.

  2. Run PrepWSKWorkspace, specifying the FactoryOS product and either the win32_manufacturing or win32_development product configuration:

    PrepWSKWorkspace C:\FactoryOSWin32Manufacturing -Product FactoryOS -ProductConfiguration win32_manufacturing
    

    The OEMInput.xml in your new workspace includes the features to include the container in your image.

  3. Customize your image. Follow the instructions, starting at step 5, at [Create a Factory OS image](build-a-Factory OS-image.md#5-add-drivers) to finish customizing your image. See Add collateral to the container below to learn about how to use the Test content folder to add collateral to the container.

Interacting with containers in Factory OS

You can control and interact with the Factory OS containers from both shell boot and console boot.

Shell boot

When booted into the Factory OS shell, you can interact with the containers using:

  • Factory Orchestrator Tasklists, including the special Factory Orchestrator XML files
  • The Factory Orchestrator App or APIs remotely or locally on the device
  • Locally via the Remote Desktop app, which launches a Command prompt in the container

Console boot

When booted into Factory OS in console boot mode, you can interact with the containers by using:

  • Factory Orchestrator Tasklists, including the special Factory Orchestrator XMl files
  • Factory Orchestrator APIs either remotely or locally on the device
  • The Factory Orchestrator App remotely

Add collateral to the container

You can deploy and run diagnostic Win32 apps during imaging and runtime when you build a Factory OS image using this product configuration:

  • Add container apps during image creation: Include a folder called Container in your Test content folder:
    • Content in the Container folder will be available in both Factory OS and the container at C:\TestContent\Container
    • The Container folder is the only folder in the container whose contents are persisted after a reboot. All other file and registry changes you make in the container will be removed when you reboot your device
  • Add apps during runtime: If you have a running device and need to add an app to the container, you can:

Run GUI win32 apps

If you have a win32 app that requires a GUI, use the Remote Desktop UWP app that's included in Factory OS. The following instructions assume that you have a running Factory OS device with a container loaded with a GUI app:

  1. In Factory Orchestrator, go to the Command Prompt tab.
  2. Check Run in the Container.
  3. Click the Show Container UI button that appears.
  4. You're now connected to the container on your device and should see a command prompt minimized in the lower left corner in the container. You can maximize and then use this command prompt to launch your apps.

To return to Factory OS

You can return to Factory OS by:

  1. Click the ... in the top-center of the Remote desktop app window
  2. Press Alt + Tab until you see Factory Orchestrator or another app you want to switch to.

If you accidentally close the Command prompt Window

  1. return to Factory OS:

    1. Click the ... in the top-center of the Remote desktop app window
    2. Press Alt+Tab until you see Factory Orchestrator
  2. In factory orchestrator go to the “Command Prompt” tab

  3. Check “Run in Container”

  4. Run the following command in the Command text box:

    RunAsRdUser "c:\windows\system32\cmd.exe` `/C start cmd.exe`
    
  5. Click the run icon

  6. Click the "Show Container UI" button, the command prompt will now be visible again

Run win32 apps in the container as part of a Factory Orchestrator TaskList

When you create a task in Factory Orchestrator, you can configure that task to run in the container by selecting the Run In Container? checkbox when you create the task:

Factory Orchestrator new executable task window showing the Run in container checkbox

You can also do this by authoring a FactoryOrchestratorXML file and adding a RunInContainer="true" attribute to the tasks you want run in the container.

  • When you run a TaskList, Factory Orchestrator automatically detects if the task running in the container requires a GUI.
  • If the task requires a GUI, a remote desktop connection is automatically established to the container. Once the connection is established, the task will automatically launch. When the program is closed, the remote desktop connection is terminated and the next task in the TaskList will automatically start.

Support scopes

App categories

Not all app categories are in scope for container support Here is a broad list of what's in-scope and what's out-of-scope for app compatibility in Factory OS containers:

  • In-scope:
    • Unpackaged Win32 console apps
    • Unpackaged Win32 apps with limited UI
    • Packaged Win32 console apps
    • Packaged Win32 apps with limited UI
  • Out-of-scope:
    • App categories that require high-spec hardware such as professional video editing
    • Apps that need COM (Component object model) support between the host and guest operating systems

Unsupported scenarios

Some scenarios are unsupported:

Area Scenarios
Media transfer protocol (MTP)
  • Connecting to device
  • Pairing devices like phones
    USB printing Printer support
    Virtualization Apps that install their own hypervisor
    Apps that install their own drivers Win32 apps that install and launch drivers may behave unexpectedly due to necessary interaction across the container boundary
    Screen Capture Apps that try to create a screen capture of the host OS
    Apps that require shell integration Apps that need taskbar interactions or other shell interactions