Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $uri = 'https://css.api.hp.com/productWarranty/v1/queries'
- $serial = (Get-WmiObject Win32_SystemEnclosure).SerialNumber
- $modelSKU = (Get-WmiObject Win32_ComputerSystem | Select-Object *).SystemSKUNumber
- $model = (Get-WmiObject Win32_ComputerSystem | Select-Object *).Model
- #Get HP Access Token
- $tokenuri = 'https://css.api.hp.com/oauth/v1/token'
- $apitokenbody = @{
- apiKey = '<KEY GOES HERE>'
- apiSecret = '<SECRET GOES HERE>'
- grantType = 'client_credentials'
- scope = 'warranty'
- }
- #Get The access token needed for the Warranty API call. Access tokens expire
- $accesstoken = (Invoke-RestMethod -uri $tokenuri -Body $apitokenbody -Method Post -ContentType application/x-www-form-urlencoded -Verbose).Root.access_token
- #Get HP Warranty Information
- #HP Warranty Check
- $hpwarranty = @{
- Params =
- @{
- sn = "$serial"
- pn = "$modelSKU"
- }
- } | ConvertTo-Json
- $warrantyinfo = Invoke-RestMethod -uri $uri -Body $hpwarranty -Headers @{Authorization = "Bearer $accesstoken"} -Method Post -ContentType application/json -Verbose
Advertisement
Add Comment
Please, Sign In to add comment