Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JMTK opened this issue Nov 1, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@JMTK
Copy link
Owner

JMTK commented Nov 1, 2024

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;
	}
}
@JMTK JMTK added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant