【问题标题】:Retrieve Dell current Bios Version检索戴尔当前的 Bios 版本
【发布时间】:2018-11-30 22:24:00
【问题描述】:

所以我设法编写了一个 powershell 脚本,它输出我域中所有计算机的列表及其 bios 版本。现在下一个任务是获取相应笔记本电脑的当前 BIOS 版本。 “当前”是指戴尔支持并建议更新到的版本。

问题是我没有找到任何 API(也许是 TechDirect?),我唯一能看到当前 bios 版本的地方是他们的支持网页。我尝试使用 Invoke-WebRequest 进行网络抓取

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$web = Invoke-WebRequest -Uri "https://www.dell.com/support/home/de/de/debsdt1/product-support/servicetag/2mx4wz1/drivers"

第一次尝试这个它有效,但现在我总是返回这个

Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send. At C:\Users\l.engleder\Documents\Scraper.ps1:3 char:8 + $web = Invoke-WebRequest -Uri "https://www.dell.com/support/home/de/d ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

非常感谢您,我期待向您学习

【问题讨论】:

    标签: powershell http web-scraping


    【解决方案1】:

    尝试做同样的事情,但放弃了,相反我找到了另一个解决方案,戴尔也有这个下载存储库,它们都是相同的格式,甚至更好的基于 html,所以只要他们不会改变这对我有用的结构。

    http://downloads.dell.com/published/pages/

    PS>$a = Invoke-WebRequest http://downloads.dell.com/published/pages/optiplex-3030-aio.html
    PS>($a.ParsedHtml.body.getElementsByTagName('div') | Where {$_.getAttributeNode('id').Value -eq 'Drivers-Category.BI-Type.BIOS'}).outerhtml.split('<')[26].Replace("TD","").replace(">","").trim()
    PS>A14
    

    它并不漂亮和整洁,但它适用于我测试过的所有型号。只要您使用该主页上的链接,它可能适用于那里的所有模型/链接。

    -R

    【讨论】:

      猜你喜欢
      • 2020-09-28
      • 2013-12-24
      • 2015-04-22
      • 1970-01-01
      • 2012-10-19
      • 2018-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多