From 6f50cb3c37814bb0a2786d2704e7d912044a79ec Mon Sep 17 00:00:00 2001 From: John Doty Date: Tue, 31 Mar 2015 07:29:19 -0700 Subject: [PATCH] Function to query catalog Add a function to query the catalog by product ID. --- WindowsPowershell/Profile.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/WindowsPowershell/Profile.ps1 b/WindowsPowershell/Profile.ps1 index 2907178..ccc51f8 100644 --- a/WindowsPowershell/Profile.ps1 +++ b/WindowsPowershell/Profile.ps1 @@ -314,3 +314,12 @@ function Start-IIS( Start-Process -Wait -NoNewWindow -FilePath "${env:ProgramFiles}\IIS Express\iisexpress.exe" -ArgumentList $iis_args } + +function Get-ProductById( + [string]$ProductId, + [string]$Market='US', + [string]$Language='en-US') +{ + $x = Invoke-WebRequest "https://displaycatalog.md.mp.microsoft.com/products/$($ProductId)?fieldsTemplate=Full&market=$($Market)&language=$($Language)" -Headers @{ 'MS-Contract-Version'=5; } + return convertfrom-json $x.Content +} \ No newline at end of file