【发布时间】: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