Skip to content

Detect Xbox Game Pass subscription status and remove Xbox Game Pass games if expired #25

Description

@JMTK

image

The Xbox Game Pass status does appear to be set somewhere on the Windows machine, but I can't seem to find where. On launch, the application seems to be able to check the status. I was able to find the API call through Fiddler

image

Additionally, we can use the API to get the status, but that may require registering an application/OAuth etc: https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/commerce/service-to-service/xstore-detecting-game-pass

I also tried using the ManagementScope class to list Licensed Products but to no avail:

public static bool ListSoftwareLicensingProducts()
{
	ManagementScope scope = new ManagementScope(@"\\" + System.Environment.MachineName + @"\root\cimv2");
	scope.Connect();

	SelectQuery searchQuery = new SelectQuery("SELECT * FROM SoftwareLicensingProduct");
	ManagementObjectSearcher searcherObj = new ManagementObjectSearcher(scope, searchQuery);

	using (ManagementObjectCollection obj = searcherObj.Get())
	{
		obj.Cast<ManagementObject>().Select(g => new { ID = g.Properties.Cast<PropertyData>().FirstOrDefault(pd => pd.Name == "ApplicationID").Value, Description = g.Properties.Cast<PropertyData>().FirstOrDefault(pd => pd.Name == "Description").Value }).Dump();
		return obj.Count > 0;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions