I want to make a script to download files from a website protected with a username and password, but since the website asks for username and password first, I am stuck and do not know what do to make the script.
$iIp = Read-Host -Prompt 'eneter your ip'
foreach($line in Get-Content .\urls.txt) {
if($line -match $regex){
$url = "$Ip/$line"
if (!(Test-Path .\descargados)){
mkdir .\downloads | Out-Null
}
$path = ".\downloads\$line"
if(!(Split-Path -parent $path) -or !(Test-Path -pathType Container (Split-Path -parent $path))) {
$path = Join-Path $pwd (Split-Path -leaf $path)
}
"downloading and saving [$line]"
$client = new-object System.Net.WebClient
$client.DownloadFile($url, $path)
$path
}
}