$IE=new-object -com internetexplorer.application $IE.visible=$true $username = "gmail_username" $password = "password" $LinkToGMail = "https://mail.google.com/mail/" $IE.navigate($LinkToGMail) do { Sleep 3 }while ($IE.Busy -eq "True") $IE.Document.getElementByID("Email").value = $username $IE.Document.getElementByID("Passwd").value = $password $IE.Document.getElementByID("gaia_loginform").submit()