Hi guys
I've decided to learn Powershell for an ETL workflow but I'm having trouble with the basics.
I receive the below error when attempting to Invoke-WebRequest:
[ERROR] Invoke-WebRequest : The remote name could not be resolved: 'logon'
Below is my script:
$sTarget = "http://www.lcbo.com/webapp/wcs/stores/servlet/en/sod/"
$sLogin = "redacted"
$sPassword = "redacted"
function Main()
{
Write-Host "Logging into $sTarget"
$htmlTargetLogin = Invoke-WebRequest $sTarget -SessionVariable session
$htmlTargetLogin.Forms[0].fields["logonId"] = $sLogin
$htmlTargetLogin.Forms[0].fields["logonPassword"] = $sPassword
$htmlTargetMain = Invoke-WebRequest $htmlTargetLogin.Forms[0].Action -WebSession $session -Body $htmlTargetLogin -Method Post
return
}
Main
Any suggestions?
Thanks!
Simon