DEV Community

Antidisestablishmentarianism
Antidisestablishmentarianism

Posted on • Updated on

Search Microsoft Store from PowerShell

This is an old version, I can't find the latest one I wrote before I moved on to other things...

Alt Text

Leaving out deviceFamilyVersion and userSegments.
I believe device family version tells the site what category of content to search, e.g. kids, adults, and i'm not sure what usersegments does, i think it might be unique to each user but both are not mandatory parameters.
oemid and scmid, while not mandatory are important if you want to search for apps that are only for your make of computer, e.g. you will not see the lenovo vantage program in a search if you don't inlclude those fields.

Function Search-MSStore ($query) {

$base = "https://storeedgefd.dsx.mp.microsoft.com/v8.0/search?"; $market = "US"; $locale = "en-US"

$paramstring = [ordered]@{
market = "US"
locale = "en-US"
query = "microsoft"
mediaType = "apps"
category = "all"
moId = "Public"
oemId = "LENOVO"
scmId="Lenovo3_Idea"
deviceFamily="windows.desktop"
appVersion="12006.1001.0.0"
catalogLocales="en-US"
availableOn="windows.desktop"
maturityRating="all"
cardsEnabled="true"
pzn="0"
pageSize="25"
skipItems="0"}

$paramobject = New-Object -TypeName PSObject
$paramobject | Add-Member -NotePropertyMembers $paramstring
$paramobject.query=$query

[string]$param = (-join ($paramobject.psobject.Properties.name | foreach {$_ + "=" + $paramobject.$_ + "&"})).trimend("&")

$response = Invoke-WebRequest -UseBasicParsing -Uri ($base+$param)
$cards = ($response.content | ConvertFrom-Json -ashashtable).Payload.Cards
$cards | select Title,Price,ProductId
Enter fullscreen mode Exit fullscreen mode

}

Top comments (5)

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
farag2 profile image
farag2

Can you send me too?

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
farag2 profile image
farag2

You are wesome! Here is much more cleaner version: github.com/farag2/Utilities/blob/m...

Collapse
 
farag2 profile image
farag2

Thanks)
Seems the url is the similar like store.rg-adguard.net/