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\notep ad.exe"
# Invoke Internet Explorer
$IE = New-Object -com internetexplorer.applicati on;
$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.getElementByI d(“Usernam eElement”) .value = $Username
$IE.Document.getElementByI D(“Passwor dElement”) .value=$Pa ssword
$IE.Document.getElementByI d(“SubmitE lement”).C lick()
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.
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.
# 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\notep
# Invoke Internet Explorer
$IE = New-Object -com internetexplorer.applicati
$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.getElementByI
$IE.Document.getElementByI
$IE.Document.getElementByI
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.