I am new to PowerShell, and just for practice I got instructions to, "Read in fortune 100 URLs to an array...then using runspaces, connect to each one and write the page you get with Invoke-WebRequest to file." Then I was given this link: https://www.zyxware.com/articles/4344/list-of-fortune-500-companies-and-their-websites
I have been reading all about runspaces. Right now I'm working on getting my links into an array that I can then pull the first 100 URLs out of. Any help/advice would be appreciated.
The issue that I have now is that when I call the link variable, it won't give me the links. It seems like I should be able to just call the $link variable so that I can get all the links and put it into an array. The only way that I can get all the links to come up is by using "$page.Links.href". Can someone please explain to me why calling that variable won't work?
$page = Invoke-WebRequest https://www.zyxware.com/articles/4344/list-of-fortune-500-companies-and-their-websites
foreach($1 in $page.Links){
if($1.href -like '*www*com'){
Write-Host $1.href
$link = $1.Links.href
}
}
$RunspacePool = [RunspaceFactory]::CreateRunspacePool(1, $Throttle)
$RunspacePool.Open()