$url = "https://example.sharepoint.com/"
$username="[email protected] "
$password="Password"
$ie = New-Object -com internetexplorer.application;
$ie.visible = $true;
$ie.navigate($url);
while ($ie.Busy -eq $true)
{
Start-Sleep -Milliseconds 1000;
}
$ie.Document.getElementById("login").value = $username
$ie.Document.getElementByID("Passwd").value=$password
$ie.Document.getElementById("cred_sign_in_button").Click();
Currently I have this code which runs in powershell (not sharepoint powershell) it first opens Internet explorer and second enters the login and password.
What I havent been able to do though is to get the code to select the sign in button. Does anyone know what value I should have to get the button to select?
Thanks
It should be this part of the code. $ie.Document.getElementById("cred_sign_in_button").Click();
This is the source code for the sign in button.
<span id="cred_sign_in_button" tabindex="11" onclick="Post.SubmitCreds();return false;"
class="button normaltext cred_sign_in_button refresh_domain_state" role="button">Sign in</span>
<div id="recover_container" class="subtext smalltext">
<span>
To do this you have to download the WASP plugin for PowerShell.
http://wasp.codeplex.com/
After that the following code will do the trick.
$url = "https://example.sharepoint.com/"
$username="[email protected] "
$password="Password"
$ie = New-Object -com internetexplorer.application;
$ie.visible = $true;
$ie.navigate($url);
while ($ie.Busy -eq $true)
{
Start-Sleep -Milliseconds 1000;
}
$ie.Document.getElementById("login").value = $username
$ie.Document.getElementByID("Passwd").value=$password
Import-Module WASP
$ie = Select-Window IEXPLORE | Set-WindowActive
$ie | Send-Keys "{TAB}"
$ie | Send-Keys "{TAB}"
$ie | Send-Keys "{TAB}"
$ie | Send-Keys "{TAB}"
$ie | Send-Keys "{TAB}"
$ie | Send-Keys "{TAB}"
Start-Sleep -Milliseconds 1000
$ie | Send-Keys "{ENTER}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With