Link to home
Start Free TrialLog in
Avatar of member 01
member 01

asked on

Logout from a website e.g. facebook

Hi,

I need to make a script for autologin. I fund it over internet :

# Edit this to be the URL or IP address of the site to launch on login
 
$Url = “www.microsoft.com”
 
# Edit this to be the username
 
$Username=”name@microsoft.com”
 
# Edit this to the corresponding password
 
$Password=”password”
 
# Edit this to be the path to the executable.  Include the executable file name as well.
 
$Executable = "c:\windows\system32\notepad.exe"
 
# Invoke Internet Explorer
 
$IE = New-Object -com internetexplorer.application;
$IE.visible = $true;
$IE.navigate($url);
 
# Wait a few seconds and then launch the executable.
 
while ($IE.Busy -eq $true)
 
{
 
Start-Sleep -Milliseconds 2000;
 
}
 
# The following UsernameElement, PasswordElement, and LoginElement need to be modified first.  See the notes at the top
# of the script for more details.
 
$IE.Document.getElementById(“UsernameElement”).value = $Username
$IE.Document.getElementByID(“PasswordElement”).value=$Password
$IE.Document.getElementById(“SubmitElement”).Click()
 
while ($IE.Busy -eq $true)
 
{
 
Start-Sleep -Milliseconds 2000;
 
}
 
Invoke-Item $Executable




It is working but problem is that, if session is already active for a site it gives error. So for that we need to logout first from that particular site ,and than execute this script. How to write logout script for a website in which session is already active.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial