我有一個web服務器上顯示的(作爲純文本,沒有html格式)dhcp留下信息的PHP腳本。輸出是在下面的格式,用逗號分隔:powershell invoke-webrequest純文本文件
dnsname,leavetime,macaddress,ipaddress
我希望能夠使用Invoke-WebRequest的PowerShell命令來分析這些信息,並剛剛獲得MAC地址。
我曾嘗試下面的代碼:
invoke-webrequest "http://www.xxx.xxx"
輸出到控制檯:
StatusCode : 200
StatusDescription : OK
Content : *hostname*,in 7 days ,**Mac Address**,*ip address*
RawContent : HTTP/1.1 200 OK
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Length: 50
Content-Type: text/plain; charset=ISO-8859-1
Date: Mon, 25 Feb 2013 12:04:33 GMT
Server: Apache
ega008...
Forms :
Headers : {[Keep-Alive, timeout=2, max=100], [Connection, Keep-Alive], [Content-Length, 50], [Content-Type,
text/plain; charset=ISO-8859-1]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml :
RawContentLength : 50
取而代之的這一切,我要的是MAC地址(高亮粗體)
任何幫助非常感謝。
謝謝。
請發佈您嘗試過的內容,並獲得 – CharlesB 2013-02-25 12:27:13
已更新的內容。 – 2013-02-25 13:44:16