0

I have a ton of Dell Equipment that I need to check the warranty date on. I would like to use PowerShell to go the the Dell support page and just scrape the expiration date from the site, but I can't seem to get to the information.

#### Make sure that you are using TLS1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

#### Open request to Dell.com to get session info
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
Invoke-WebRequest -Uri https://www.dell.com/support/home -SessionVariable Session

#### Get page with serial number
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36"
$FullPage = (Invoke-WebRequest -Uri "https://www.dell.com/support/home/en-us/product-support/servicetag/9S2MVR2/overview" `
-WebSession $session `
-Headers @{
"method"="POST"
  "authority"="www.dell.com"
  "scheme"="https"
  "path"="/support/home/en-us/product-support/servicetag/14m1dh2/overview"
  "sec-ch-ua"="`" Not A;Brand`";v=`"99`", `"Chromium`";v=`"99`", `"Google Chrome`";v=`"99`""
  "sec-ch-ua-mobile"="?0"
  "sec-ch-ua-platform"="`"Windows`""
  "upgrade-insecure-requests"="1"
  "accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
  "sec-fetch-site"="none"
  "sec-fetch-mode"="navigate"
  "sec-fetch-user"="?1"
  "sec-fetch-dest"="document"
  "accept-encoding"="gzip, deflate, br"
  "accept-language"="en-US,en;q=0.9"
})
  • @Fester_Stank: Sorry it took so long to get back to this. Ultimately, I was able to get API keys for the Dell site. Once I had that, I was literally able to use the PS script in the link you had in your first response. This solution won't work for people who do not have the ability to do that but I I think your other response is going down the right path. For once, I took the easy way out. Thank you! – n00b2Everything Apr 15 '22 at 17:31

1 Answers1

1

Have you considered using Dells warranty API? There's some great info here

  • I had not. I have applied for the API Key but don't know if it'll be approved since I'm not the signatory for my company. Don't even know who is... Still looking to use PS or wget... – n00b2Everything Mar 06 '22 at 00:09
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 06 '22 at 10:25
  • @n00b2Everything I have a feeling you're going to have a lot of trouble using exclusively powershell to get what you're after as the page itself is likely not designed to be used in such a way. If I were going down the same route, I would probably begin my search taking some advice from the website monitoring play book and instantiate some javascript in the browser to effectively carry out a set of instructions, effectively like a bot. Take a look at this vid, it gives a solid idea of using Javascript in the browser to automate a task: https://www.youtube.com/watch?v=xHGPBX5_lhw – Fester_Stank Mar 07 '22 at 17:05
  • What I would try to do is consider going for the above, using "New-Object" to make a new internet explorer com object and parsing the site / executing the javascript that way. Alternatively, take a look at Dirk's answer on another question here: https://stackoverflow.com/a/19368775/18385630 This using the PS Wrapper for Selenium would really be the strongest approach :) – Fester_Stank Mar 07 '22 at 17:09