microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.24k stars 8.27k forks source link

Sysprep removes the provisioned Windows Terminal appx package #12023

Closed eblikstad closed 2 years ago

eblikstad commented 2 years ago

Windows Terminal version

1.11.3471.0

Windows build number

10.0.20348

Other Software

Windows Server 2022

Steps to reproduce

  1. Install package with license file using Add-AppxProvisionedPackage
  2. Run sysprep (OOBE+generalize)
  3. Create new local admin user account
  4. Login with new user
  5. Check package with Get-AppxProvisionedPackage

Appx package installation: Install-AppxProvisionedPackage -Online -PackagePath file.appx -LicensePath file.xml

Expected Behavior

`C:>Get-AppxProvisionedPackage -Online | ? DisplayName -like *WindowsTerminal

DisplayName : Microsoft.WindowsTerminal Version : 2021.1214.340.0 Architecture : neutral ResourceId : ~ PackageName : Microsoft.WindowsTerminal_2021.1214.340.0neutral~_8wekyb3d8bbwe Regions : `

Actual Behavior

Package is not found and the Windows Terminal is not installed and available for the admin user. At least one other Appx package isn't removed by sysprep, the Windows Package Manager package is available after sysprep has been run.

eblikstad commented 2 years ago

After further investigation, the package isn't removed by the sysprep operation, it's the first GUI user login which causes the removal. The event log Windows/AppxDeployment registers a removal of the provisioned Appx package.

The following packages will be installed: Microsoft.Windows.CloudExperienceHost_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.BioEnrollment_10.0.19585.1001_neutral_neutral_cw5n1h2txyewy Microsoft.AAD.BrokerPlugin_1000.19580.1000.0_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.OOBENetworkConnectionFlow_10.0.19581.1000_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.OOBENetworkCaptivePortal_10.0.19580.1000_neutral_neutral_cw5n1h2txyewy MicrosoftWindows.UndockedDevKit_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.StartMenuExperienceHost_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.ShellExperienceHost_10.0.20348.1_neutral_neutral_cw5n1h2txyewy windows.immersivecontrolpanel_10.0.4.1000_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.Search_10.0.20348.1_neutral_neutral_cw5n1h2txyewy 1527c705-839a-4832-9118-54d4Bd6a0c89_10.0.19640.1000_neutral_neutral_cw5n1h2txyewy c5e2524a-ea46-4f67-841f-6a9465d9d515_10.0.20348.1_neutral_neutral_cw5n1h2txyewy E2A4F912-2574-4A75-9BB0-0D023378592B_10.0.19640.1000_neutral_neutral_cw5n1h2txyewy F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.AccountsControl_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.AsyncTextService_10.0.20348.1_neutral_neutral_8wekyb3d8bbwe Microsoft.CredDialogHost_10.0.19595.1001_neutral_neutral_cw5n1h2txyewy Microsoft.ECApp_10.0.20348.1_neutral_neutral_8wekyb3d8bbwe Microsoft.LockApp_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Win32WebViewHost_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.AppRep.ChxApp_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.CapturePicker_10.0.19580.1000_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.NarratorQuickStart_10.0.20348.1_neutral_neutral_8wekyb3d8bbwe Microsoft.Windows.PeopleExperienceHost_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.PinningConfirmationDialog_10.0.20348.1_neutral_neutral_cw5n1h2txyewy Microsoft.Windows.SecHealthUI_10.0.20348.1_neutral__cw5n1h2txyewy Microsoft.Windows.XGpuEjectDialog_10.0.20348.1_neutral_neutral_cw5n1h2txyewy MicrosoftWindows.Client.CBS_120.27512.10351.0_neutral_neutral_cw5n1h2txyewy Windows.CBSPreview_10.0.19580.1000_neutral_neutral_cw5n1h2txyewy Windows.PrintDialog_6.2.1.0_neutral_neutral_cw5n1h2txyewy Microsoft.DesktopAppInstaller_2021.923.524.0_neutral_~_8wekyb3d8bbwe Microsoft.UI.Xaml.2.2_2.21909.17002.0_x64__8wekyb3d8bbwe Microsoft.UI.Xaml.2.4_2.42007.9001.0_x64__8wekyb3d8bbwe Microsoft.VCLibs.140.00.UWPDesktop_14.0.30035.0_x64__8wekyb3d8bbwe Microsoft.VCLibs.140.00_14.0.27810.0_x64__8wekyb3d8bbwe . The following packages will be removed: Microsoft.WindowsTerminal_2021.1214.340.0_neutral_~_8wekyb3d8bbwe

eblikstad commented 2 years ago

I have done systematic testing of provisioning of the package after sysprep has been run. The package cannot be provisioned before one GUI login has been performed. The GUI login of a user obviously initializes the package system which makes provisioning of the package possible (without it beeing removed when another user login).

This issue occurs with the Windows Terminal package but not with the Windows Package Manager (winget) package.

Nevexo commented 2 years ago

Now that Terminal is (rightly) the default now in Windows 11, various links to open PowerShell (such as WIN+X + i) don't launch following a sysprep.

We're having the same issue after sysprepping, imaging and deploying images with MDT.

zadjii-msft commented 2 years ago

Hey guys, thanks for bringing this up. I don't know anything about how sysprep works, but I found some folks internally who gave me the following advice:

Could this be happening because the Terminal app wasn’t provisioned with the /region option specified and isn’t pinned to Start?

Yes, I think that’s the issue here.

The component that performs region enforcement runs after region selection in OOBE. Provisioning without a region set is fine after that enforcement runs, but will cause the package to get removed if OOBE is subsequently run.

If the user adds -Regions “all” to the command, the package should stick around after sysprep/OOBE.

Can you try doing that?

ghost commented 2 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

vblikstad commented 2 years ago

Yes, specifying regions resolved the issue. I did a test without the regions parameter and ran sysprep, and repeated the test with the regions parameter. The provisioned Appx package was removed without the regions parameter, but it wasn't removed with the regions parameter. Working install command with the regions parameter: Add-AppxProvisionedPackage -Online -PackagePath .\6c2f7ae7a8704900905b0d7eabd22fdf.msixbundle -LicensePath .\6c2f7ae7a8704900905b0d7eabd22fdf_License1.xml -Verbose -LogLevel Debug -Regions all

zadjii-msft commented 2 years ago

(reading between the lines, I'm gonna assume you're OP)

Cool! Glad we were able to get this one sorted out.