[registry] How to programmatically get the Windows 11 WSA install directory?

Discussion in 'Scripting' started by alesimula, Nov 19, 2021.

  1. alesimula

    alesimula MDL Novice

    Sep 6, 2015
    15
    5
    0
    I don't know whether this is the right place to ask but here goes nothing

    I need a programmatic way (hopefully just using windows registry keys) to identify the WSA install location; I know it's usually C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForAndroid_1.8.32822.0_x64__8wekyb3d8bbwe, but this might not always be the case (Just for the sake of an example, a customized subsystem with Play Services installed will be in a different location)

    Can anyone here help me?
     
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,220
    84,897
    340
    Powershell
    Code:
    (Get-AppxPackage -AllUsers | ? Name -Like *WindowsSubsystemForAndroid*).InstallLocation
    or check registry key
    Code:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore