Monday, December 19, 2016

Starting early

I am going to try and get into the habit about posting often now. Why wait?

I wrote this today when I had to look up a bunch of warranty info for some Dell laptops at work. This is much easier than typing the service code into the webpage.
The formatting is currently VERY ugly, but I will work on rearranging the page to adjust and make it prettier. For now I have added #lineBreak at the end of every line so you can format it properly if you C&P.
Quick context

ps c:\ get-dellTagInfo (yourDellServiceTag#)

Pretty straight forward. You should be abel to add this to your $profile and use it, and/or use it in any scripts where you have a lot of service tag numbers. I may write that up and post it to here soon.
Let me know if you have an Qs!


function get-dellTagInfo {  #lineBreak
    param  ($svcTag) #lineBreak
    $url = "https://api.dell.com/support/v2/assetinfo/warranty/tags.xml?svctags=" + $svcTag + "&apikey=849e027f476027a394edd656eaef4842" #lineBreak
    Invoke-WebRequest -Uri $url | Select-Object -ExpandProperty content | Out-File .\"$svctag".dell.xml #lineBreak
    [xml]$xml = Get-Content .\"$svctag".dell.xml #lineBreak
    write-host "Service tag:" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.ServiceTag #lineBreak
    write-host "ShipDate:" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.ShipDate #lineBreak
    write-host "ModelInfo:" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.MachineDescription #lineBreak
    write-host "Warranty End Date:" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[1].EndDate #lineBreak
    write-host "Warranty Service Levels:"  #lineBreak
    write-host "-----" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[0].ServiceLevelDescription #lineBreak
    write-host "-----" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[1].ServiceLevelDescription #lineBreak
    write-host "-----" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[2].ServiceLevelDescription #lineBreak
    write-host "-----" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[3].ServiceLevelDescription #lineBreak
    write-host "-----" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[4].ServiceLevelDescription #lineBreak
    write-host "-----" $xml.GetAssetWarrantyResponse.GetAssetWarrantyResult.Response.DellAsset.Warranties.Warranty[5].ServiceLevelDescription #lineBreak
} #lineBreak

1 comment:

  1. Play The Real Money Slot Machines - Trick-Taking Game - Trick-Taking
    How to Play. jancasino.com Play The Real Money 토토 Slot Machine. If you are searching for a fun, deccasino exciting game 토토사이트 to poormansguidetocasinogambling.com play online, we have you covered.

    ReplyDelete