คำสั่งพื้นฐาน
$req = Invoke-WebRequest -uri "https://example.com" $req.Links
ดึงเฉพาะ URL (href)
$req.Links | Select-Object -ExpandProperty href
ตัวอย่างผลลัพธ์
https://example.com/page1 https://example.com/page2 https://example.com/category/powershell/ ...
คำอธิบาย
Invoke-WebRequestดึงเนื้อหาเว็บเพจ- Property
.Linksมีอ็อบเจกต์ลิงก์ พร้อม InnerHTML, InnerText, href, tagName - ใช้
Select-Object -ExpandProperty hrefเพื่อดึงเฉพาะ URL