#Set URL.
$Url = "https://www.plexonline.com";
$Username="xxxx";
$Password="xxxx";
$CompanyCode="xxx";
Create a new COM object for IE.
$IE = New-Object -ComObject internetexplorer.application;
Set IE to FullScreen.
$IE.FullScreen = $true;
Set IE to visible.
$IE.Visible = $true;
Navigate IE to the specified URL.
$IE.navigate($url);
Wait until IE is not longer busy.
while ($IE.Busy -eq $true)
{
Start-Sleep -Milliseconds 500;
}
Insert the specified username, password, and company code in to their respective fields.
$IE.Document.getElementById("txtUserID").value = $Username;
$IE.Document.getElementByID("txtPassword").value = $Password;
$IE.Document.getElementByID("txtCompanyCode").value = $CompanyCode;
Start the login process.
$IE.Document.getElementById("btnLogin_Label").Click();
Continue to wait until IE is no longer busy.
while ($IE.Busy -eq $true)
{
Start-Sleep -Milliseconds 2000;
}