Skip to content

Commit 6e0ce5e

Browse files
aq
TODO: Merge this after adding Microsoft.WindowsTerminal Others report: Microsoft.549981C3F5F10_8wekyb3d8bbwe CortanaStartupId 31/10/2021 09:25:17 0 0 Microsoft.GamingApp_8wekyb3d8bbwe Xbox.App.Tasks.FullTrustComponent 0 0 Microsoft.WindowsTerminal_8wekyb3d8bbwe StartTerminalOnLoginTask 03/12/2022 13:40:59 1 1 Microsoft.YourPhone_8wekyb3d8bbwe YourPhone.Start 03/09/2022 15:02:11 1 0 MicrosoftTeams_8wekyb3d8bbwe TeamsStartupTask 31/10/2021 13:29:35 1 0 https://www.tenforums.com/general-support/191408-convert-ps-cmd-17.html
1 parent 65f0002 commit 6e0ce5e

File tree

1 file changed

+182
-5
lines changed

1 file changed

+182
-5
lines changed

src/application/collections/windows.yaml

Lines changed: 182 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30988,8 +30988,28 @@ actions:
3098830988
-
3098930989
name: Remove "Cortana" app
3099030990
recommend: standard
30991-
docs: |-
30991+
docs: |- # TODO: Improve
30992+
This app
30993+
3099230994
[Microsoft Store Page](https://web.archive.org/web/20231003195834/https://apps.microsoft.com/store/detail/cortana/9NFFX4SZZ23L)
30995+
30996+
### Technical Details
30997+
30998+
This scripts uninstall store app with id `Microsoft.549981C3F5F10`.
30999+
31000+
It also disables its associated auto start app `CortanaStartupId`.
31001+
According to tests, this app exists on:
31002+
31003+
| OS | Version | Existence |
31004+
| -- |:-------:|:---------:|
31005+
| Windows 10 | 19H2 | ❌ |
31006+
| Windows 10 | 20H2 | ❌ |
31007+
| Windows 10 | 21H2 | ❌ |
31008+
| Windows 10 | 22H2 | ❌ |
31009+
| Windows 11 | 21H2 | ✅ |
31010+
| Windows 11 | 22H2 | ✅ |
31011+
| Windows 11 | 23H2 | ✅ |
31012+
| Windows 11 | 24H2 | ❌ |
3099331013

3099431014
### Overview of default preinstallation
3099531015

@@ -31004,13 +31024,24 @@ actions:
3100431024
| Windows 11 | 21H2 | ✅ |
3100531025
| Windows 11 | 22H2 | ✅ |
3100631026
| Windows 11 | 23H2 | ✅ |
31027+
| Windows 11 | 24H2 | ❌ |
3100731028

3100831029
[1]: https://web.archive.org/web/20240613063743/https://www.sita.co.za/sites/default/files/documents/Product_Certification/TASRR40_Windows_optimisation.pdf "List of installed apps: Windows 11 | TAS Research Report: Desktop Windows Optimisation | www.sita.co.za"
3100931030
call:
31010-
function: UninstallStoreApp
31011-
parameters:
31012-
packageName: Microsoft.549981C3F5F10 # Get-AppxPackage Microsoft.549981C3F5F10
31013-
publisherId: 8wekyb3d8bbwe
31031+
-
31032+
function: UninstallStoreApp
31033+
parameters:
31034+
packageName: Microsoft.549981C3F5F10 # Get-AppxPackage Microsoft.549981C3F5F10
31035+
publisherId: 8wekyb3d8bbwe
31036+
-
31037+
function: DisableStoreAppAutoStart
31038+
parameters:
31039+
packageName: Microsoft.549981C3F5F10
31040+
publisherId: 8wekyb3d8bbwe
31041+
taskName: CortanaStartupId
31042+
enabledByDefault: 'true' # reg query "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\Microsoft.549981C3F5F10_8wekyb3d8bbwe\CortanaStartupId"
31043+
minimumWindowsVersion: Windows11-21H2
31044+
maximumWindowsVersion: Windows11-23H2
3101431045
-
3101531046
name: Remove "App Installer" app
3101631047
docs: |-
@@ -43529,3 +43560,149 @@ functions:
4352943560
deleteOnRevert: 'true' # Missing by default since Windows 10 Pro (≥ 22H2) and Windows 11 Pro (≥ 23H2) | Tested since EdgeUpdate ≥ 1.3.187.41
4353043561
minimumWindowsVersion: Windows11-FirstRelease # No TrustedInstaller is needed on Windows 10, but the functionality is missing so the script won't work.
4353143562
elevateToTrustedInstaller: 'true' # Without TrustedInstaller: ✅ Windows 10 Pro (>= 20H2) | ❌ Windows 11 Pro (>= 23H2)
43563+
-
43564+
name: DisableStoreAppAutoStart
43565+
parameters:
43566+
- name: packageName
43567+
- name: publisherId
43568+
- name: taskName
43569+
- name: enabledByDefault
43570+
optional: true
43571+
- name: missingByDefault
43572+
optional: true
43573+
- name: minimumWindowsVersion # See `RunPowerShellWithWindowsVersionConstraints`
43574+
optional: true
43575+
- name: maximumWindowsVersion # See `RunPowerShellWithWindowsVersionConstraints`
43576+
optional: true
43577+
# Marked refactor-with-if-syntax:
43578+
# `enabledByDefault` and `disabledByDefault` can be merged
43579+
docs: |- # TODO: Revise
43580+
This function disables startup items of an UWP app [1].
43581+
43582+
These startup items are registered using a special mechanims, not visible via conventional ways [1].
43583+
43584+
This function disables them using registry entries.
43585+
43586+
You can find all entries using:
43587+
43588+
```ps1
43589+
$basePath = "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData"
43590+
$results = @()
43591+
if (Test-Path $basePath) {
43592+
Get-ChildItem -Path $basePath -ErrorAction SilentlyContinue | ForEach-Object {
43593+
$packagePath = $_.PSPath
43594+
$packageDir = $_.PSChildName
43595+
if ($packageDir -match "(.+)_(.+)") {
43596+
$packageName = $matches[1]
43597+
$publisherId = $matches[2]
43598+
} else {
43599+
$packageName = $packageDir
43600+
$publisherId = "Unknown"
43601+
}
43602+
Get-ChildItem -Path $packagePath -ErrorAction SilentlyContinue | ForEach-Object {
43603+
$subkeyPath = $_.PSPath
43604+
$subkeyName = $_.PSChildName
43605+
$properties = Get-ItemProperty -Path $subkeyPath -Name "State" -ErrorAction SilentlyContinue
43606+
$hasState = $properties -ne $null -and $properties.State -ne $null
43607+
if ($hasState) {
43608+
$fullPath = "$subkeyPath\State"
43609+
$fullPath = $fullPath.Replace("Microsoft.PowerShell.Core\Registry::", "")
43610+
$fullPath = $fullPath.Replace("HKCU:", "HKCU")
43611+
$results += [PSCustomObject]@{
43612+
FullPath = $fullPath
43613+
PackageName = $packageName
43614+
PublisherId = $publisherId
43615+
TaskName = $subkeyName
43616+
}
43617+
}
43618+
}
43619+
}
43620+
}
43621+
$results | Format-Table -AutoSize PackageName, PublisherId, TaskName, FullPath
43622+
```
43623+
43624+
### Overview of default existence
43625+
43626+
According to tests, these startup tasks exists only on Windows 11.
43627+
43628+
| Task | Package | 21H2 | 22H2 | 23H2 | 24H2 |
43629+
|-------------------------------|-------------------------------|:----:|:----:|:----:|:----:|
43630+
| `CortanaStartupId` | `Microsoft.549981C3F5F10` | ✅ | ✅ | ✅ | ❌ |
43631+
| `StartTerminalOnLoginTask` | `Microsoft.WindowsTerminal` | ❌ | ✅ | ✅ | ✅ |
43632+
43633+
According to tests, these tasks get enabled after some usage on Windows 11 Pro 24H2:
43634+
43635+
| Task | Package Name | Publisher ID |
43636+
|---------------------------------------|----------------|--------------|
43637+
| `Copilot.StartupTaskId` | `Microsoft.Copilot` | `8wekyb3d8bbwe` |
43638+
| `Xbox.App.Tasks.FullTrustComponent` | `Microsoft.GamingApp` | `8wekyb3d8bbwe` |
43639+
| `WebViewHostStartupId` | `Microsoft.MicrosoftOfficeHub` | `8wekyb3d8bbwe` |
43640+
| `AutoStartTask` | `Microsoft.PowerAutomateDesktop` | `8wekyb3d8bbwe` |
43641+
| `ToDoStartupId` | `Microsoft.Todos` | `8wekyb3d8bbwe` |
43642+
| `StartTerminalOnLoginTask` | `Microsoft.WindowsTerminal` | `8wekyb3d8bbwe` |
43643+
| `YourPhone.Start` | `Microsoft.YourPhone` | `8wekyb3d8bbwe` |
43644+
| `CrossDevice.Start` | `MicrosoftWindows.CrossDevice` | `cw5n1h2txyewy` |
43645+
| `TeamsTfwStartupTask` | `MSTeams` | `8wekyb3d8bbwe` |
43646+
43647+
### Technical Details
43648+
43649+
It sets `State` to `Disabled`.
43650+
The default is Disabled, so in the normal case, the user must run the app at least once explicitly [3].
43651+
Here are the possible values for the `State` [2] [3]:
43652+
43653+
| Value | Name | Description |
43654+
| ----- | ---- | ----------- |
43655+
| `0` | Disabled | The task is disabled. |
43656+
| `1` | DisabledByUser | The task was disabled by the user. It can only be re-enabled by the user. |
43657+
| `2` | Enabled | The task is enabled. |
43658+
| `3` | DisabledByPolicy | The task is disabled by the administrator or group policy. Platforms that don't support startup tasks also report DisabledByPolicy. |
43659+
| `4` | EnabledByPolicy | The task is enabled by the administrator or group policy. |
43660+
43661+
[1]: https://web.archive.org/web/20250414111920/https://stackoverflow.com/questions/63746294/how-to-use-powershell-to-manage-startup-items-of-uwp-app-in-windwos-10/63759561#63759561 "c# - How to use powershell to manage startup items of uwp app in windwos 10? - Stack Overflow | stackoverflow.com"
43662+
[2]: https://web.archive.org/web/20250414111811/https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.startuptaskstate?view=winrt-19041 "StartupTaskState Enum (Windows.ApplicationModel) - Windows apps | Microsoft Learn | learn.microsoft.com"
43663+
[3]: https://web.archive.org/web/20190629014652/https://windowsadmins.com/configure-your-app-to-start-at-log-in/ "Configure your app to start at log-in - Windows Admins | windowsadmins.com"
43664+
call:
43665+
-
43666+
function: Comment
43667+
parameters:
43668+
codeComment: >-
43669+
Disable auto-start task '{{ $taskName }}' from {{ $packageName }}_{{ $publisherId }}
43670+
revertCodeComment: >-
43671+
{{ with $enabledByDefault }}
43672+
Enable auto-start task '{{ $taskName }}' from {{ $packageName }}_{{ $publisherId }}
43673+
{{ end }}{{ with $missingByDefault }}
43674+
Remove disabling auto-start task '{{ $taskName }}' from {{ $packageName }}_{{ $publisherId }}
43675+
{{ end }}
43676+
-
43677+
function: SetRegistryValue
43678+
parameters:
43679+
keyPath: HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\{{ $packageName }}_{{ $publisherId }}\{{ $taskName }}
43680+
valueName: State
43681+
dataType: REG_DWORD
43682+
data: "0" # Options: 0: Disabled | 1: DisabledByUser | 2: EnabledByUser | 3: DisabledByPolicy | 4: EnabledByPolicy
43683+
dataOnRevert: '{{ with $enabledByDefault }}true{{ end }}'
43684+
deleteOnRevert: '{{ with $missingByDefault }}true{{ end }}'
43685+
minimumWindowsVersion: '{{ with $minimumWindowsVersion }}{{ . }}{{ end }}'
43686+
# maximumWindowsVersion: '{{ with $maximumWindowsVersion }}{{ . }}{{ end }}'
43687+
-
43688+
function: SetRegistryValue
43689+
parameters:
43690+
keyPath: HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\{{ $packageName }}_{{ $publisherId }}\{{ $taskName }}
43691+
valueName: LastDisabledTime
43692+
dataType: REG_DWORD
43693+
data: (Get-Date -Date ((Get-Date).DateTime) -UFormat %s)
43694+
evaluateDataAsPowerShell: 'true'
43695+
deleteOnRevert: 'true' # Users do not disable by default on clean installation
43696+
minimumWindowsVersion: '{{ with $minimumWindowsVersion }}{{ . }}{{ end }}'
43697+
# maximumWindowsVersion: '{{ with $maximumWindowsVersion }}{{ . }}{{ end }}'
43698+
-
43699+
function: SetRegistryValue
43700+
parameters:
43701+
keyPath: HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\{{ $packageName }}_{{ $publisherId }}\{{ $taskName }}
43702+
valueName: UserEnabledStartupOnce
43703+
dataType: REG_DWORD
43704+
data: "0"
43705+
dataOnRevert: '{{ with $enabledByDefault }}0{{ end }}' # `0` for apps by default
43706+
deleteOnRevert: '{{ with $missingByDefault }}true{{ end }}'
43707+
minimumWindowsVersion: '{{ with $minimumWindowsVersion }}{{ . }}{{ end }}'
43708+
# maximumWindowsVersion: '{{ with $maximumWindowsVersion }}{{ . }}{{ end }}'

0 commit comments

Comments
 (0)