Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell-解析网页内容_Powershell_Parsing - Fatal编程技术网

Powershell-解析网页内容

Powershell-解析网页内容,powershell,parsing,Powershell,Parsing,我是powershell/windows脚本新手,需要使用Invoke WebRequest解析网页,以获取以下文本: Version 3.0 在特定div中,使用以下href: <a href="/Downloads/IISCrypto/IISCrypto.exe" class="btn-default btn">Download</a> 下面是该网页的一个示例: <div class="main col-md-12"> <p clas

我是powershell/windows脚本新手,需要使用Invoke WebRequest解析网页,以获取以下文本:

Version 3.0
在特定div中,使用以下href:

<a href="/Downloads/IISCrypto/IISCrypto.exe" class="btn-default btn">Download</a>

下面是该网页的一个示例:

<div class="main col-md-12">
    <p class="lead">
        IIS Crypto requires Windows Server 2008 and the .Net 4.0 framework or greater. Both GUI and command line versions are available.
    </p>
    <div class="row">
        <div class="col-md-12">
            <div class="row">
                <div class="col-sm-3">
                </div>
                <div class="col-sm-3">
                    <div class="box-style-1 gray-bg">
                        <i class="fa fa-desktop"></i>
                        <h2>IIS Crypto GUI</h2>
                        <p>Version 3.0 (339 KB)</p>
                        <a href="/Downloads/IISCrypto/IISCrypto.exe" class="btn-default btn">Download</a>
                    </div>
                </div>
                <div class="col-sm-3">
                    <div class="box-style-1 gray-bg">
                        <i class="fa fa-reorder"></i>
                        <h2>IIS Crypto CLI</h2>
                        <p>Version 3.0 (244 KB)</p>
                        <a href="/Downloads/IISCrypto/IISCryptoCli.exe" class="btn-default btn">Download</a>
                    </div>

IIS加密需要Windows Server 2008和.Net 4.0 framework或更高版本。GUI和命令行版本都可用。

IIS加密GUI 版本3.0(339KB)

IIS加密CLI 版本3.0(244KB)


应该已经有人回答了,但给你

$webRequest = Invoke-WebRequest $URL
(($webRequest.ParsedHtml.getElementsByClassName("box-style-1 gray-bg")[0] | Select-Object innerText) -split ([Environment]::NewLine))[1]