Scripts for moving users "My Files" to Sharefile location.

  • 1
  • Question
  • Updated 4 years ago
I am trying to modify a powershell script for office365 so that I can redirect my users "Documents" back to sharefile. (https://office365drivemap.codeplex.com/).

I have completed the mods for most of it.  Need assistance with the logon portion.  I am not sure what to put in for the logon area of the script.  I have included a snip it of the code I am working with.

Code:
$ie = new-object -com InternetExplorer.Application $ie.navigate("https://login.microsoftonline.com/login.srf")   --this I know.
#$ie.visible = $true #Uncomment this for debugging 
# Wait for the page to finish loading 
do {sleep 1} until (-not ($ie.Busy)) 
#while($ie.ReadyState -ne 4) {start-sleep -m 100} # another way to do this
# We have to click the remember me checkbox before logging in, we also have to have IE be automated for this to work
try { 
$ie.document.GetElementById("_link").click()
do {sleep 1} until (-not ($ie.Busy)) 
} catch {$null} 
try { 
$ie.document.GetElementById("cred_keep_me_signed_in_checkbox").click() 
$ie.document.GetElementById("cred_userid_inputtext").value = $emailusername
$ie.document.GetElementById("cred_sign_in_button").click()
do {sleep 1} until (-not ($ie.Busy)) 
} catch {$null} 
sleep -seconds 15 # give plenty of time to redirect
            $ie.navigate($urlFile) # open o365 to verify we grab the token
do {sleep 1} until (-not ($ie.Busy)) 
sleep -seconds 5 #wait it out for a redirect
$ie.quit() 

The italicized text is where i am having issues - 3 lines.

thanks in advance for any assistance.
Photo of Bill Gerth

Bill Gerth

  • 2 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1

Be the first to post a reply!