我正在嘗試處理網絡查詢的結果。我做將PowerShell中的HTML片段轉換爲csv
$data = Invoke-WebRequest $uri $data.RawContent
返回此
HTTP/1.1 200 OK Transfer-Encoding: chunked Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: JSESSIONID=19gbg0sejwxXXXXXXpzwlasaaeer;Path=/informer;Secure Server: Jetty(8.1.8.v20121106) <table><tr><td>username</td><td>firstname</td><td>lastname</td><td>idnumber</td><td>auth</td><td>course1</td></tr><tr valign="top"><td style="mso-number-format:'\@';">d_smith</td><td style="mso-number-format:'\@';">Daniel</td><td style="mso-number-format:'\@';">smith</td><td style="mso-number-format:'\@';">2221840</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-101</td></tr><tr valign="top"><td style="mso-number-format:'\@';">d_rutherford</td><td style="mso-number-format:'\@';">Daniel</td><td style="mso-number-format:'\@';">rutherford</td><td style="mso-number-format:'\@';">2223039</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-101</td></tr><tr valign="top"><td style="mso-number-format:'\@';">j_smithe21</td><td style="mso-number-format:'\@';">James</td><td style="mso-number-format:'\@';">smithe</td><td style="mso-number-format:'\@';">2221844</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-101</td></tr><tr valign="top"><td style="mso-number-format:'\@';">h_phillipsiii</td><td style="mso-number-format:'\@';">Harvey</td><td style="mso-number-format:'\@';">phillips III</td><td style="mso-number-format:'\@';">2221845</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-101</td></tr><tr valign="top"><td style="mso-number-format:'\@';">h_phillipsiii</td><td style="mso-number-format:'\@';">Harvey</td><td style="mso-number-format:'\@';">phillips III</td><td style="mso-number-format:'\@';">2221845</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-102</td></tr><tr valign="top"><td style="mso-number-format:'\@';">d_rutherford</td><td style="mso-number-format:'\@';">Daniel</td><td style="mso-number-format:'\@';">rutherford</td><td style="mso-number-format:'\@';">2223039</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-102</td></tr><tr valign="top"><td style="mso-number-format:'\@';">j_smithe21</td><td style="mso-number-format:'\@';">James</td><td style="mso-number-format:'\@';">smithe</td><td style="mso-number-format:'\@';">2221844</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-102</td></tr><tr valign="top"><td style="mso-number-format:'\@';">d_smith</td><td style="mso-number-format:'\@';">Daniel</td><td style="mso-number-format:'\@';">smith</td><td style="mso-number-format:'\@';">2221840</td><td style="mso-number-format:'\@';">ldap</td><td style="mso-number-format:'\@';">2017CE1-CTP-8001-102</td></tr><tr valign="top"><td></td></tr></table>
通知沒有HTML或身體標記。盡我所能,這就是爲什麼我沒有看到ParsedHTML選項。這些是$data
的唯一屬性顯示在以下。
$ data.Content返回組成文本$ data.RawContent產生的字符代碼。 這是當它在Web瀏覽器
呈現我怎麼能這個錶轉換爲CSV或PSCustomObject或類似這樣我可以通過線條和過濾器遍歷和處理數據的東西表?
您可以在[JohnLBevan](https://stackoverflow.com/users/361842/johnlbevan)s [answer](https://stackoverflow.com/a/31949668/6811411)中查看[類似問題](https://stackoverflow.com/questions/25918094/how-to-convert-html-table-to-csv-file-with-same-structure-with-powershell)。 – LotPings