Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/25/20 in all areas

  1. 1 point
    This is only for Lenovo. Within the webresponse variable, there's a value which is being queried, which makes up the warranty end-date. Basically I query two variables instead of one. After exporting the webresponse as XML, I analyzed it, and found that there are two variable (depending on whether there's extended warranty or not) being filled. The first one is: $webresponse.wiOutputForm.warrantyInfo.serviceInfo.wed | select -first 1 That one, is the factory warranty. But after looking at the XML file, I found that there's another one too. That one is found by querying a bit different: $webresponse.SelectSingleNode("//mEndDate") | Select-Object -ExpandProperty `#text After finding this, I realised, that the mEndDate is only set, if extended warranty is present. So I made a simple if-else statement, to check for $null value: $WarrantyEndDate_Expanded = $webresponse.SelectSingleNode("//mEndDate") | Select-Object -ExpandProperty `#text if ($WarrantyEndDate_Expanded -eq $null) { $WarrantyEndDate_Expanded = $webresponse.wiOutputForm.warrantyInfo.serviceInfo.wed | select -first 1 } I have uploaded a text file for the updated Function: Get-LenovoWarrantyInfo. When updating the original script, just replace the function with the modified one The only changed made, is written above. Thanks again for your work. Updated_Get-LenovoWarrantyInfo.txt
×
×
  • Create New...