How to passthru credentials on o365?

Welcome Forums General PowerShell Q&A How to passthru credentials on o365?

This topic contains 1 reply, has 1 voice, and was last updated by

 
Participant
17 hours, 45 minutes ago.

  • Author
    Posts
  • #151784

    Participant
    Points: -5
    Rank: Member

    I have the following script that maps my OneDrive for Biz and an online Sharepoint library to my Quick Access links in Windows Explorer. The problem is that to get it to work I first have to access those sites using my browser.

    We are setup with on-prem AD using AD Connect with passthru credentials. With this setup I just need to open the URL for OneDrive for Biz and the online Sharepoint library w/o having to provide credentials. How can I get the below script to work by passing the user's credentials?

    $site = "\\OURTENANT.sharepoint.com@SSL\DavWWWRoot\sites\oursite\IT"
    
    $site2 = '\\OURTENANT-my.sharepoint.com@SSL\DavWWWRoot\personal\' + $env:username + '_OURDOMAIN_org\Documents'
    
    $QuickAccess = New-Object -ComObject shell.application
    
    $QuickAccess.Namespace($site).Self.InvokeVerb("pintohome")
    
    $QuickAccess.Namespace($site2).Self.InvokeVerb("pintohome")
    
    
    		
    	
  • #152187

    Participant
    Points: -5
    Rank: Member

    Here is what I did to get credentials to pass through.

    $ie = Start-Process -file iexplore -arg 'https://OURTENANT.sharepoint.com/sites/TEST' -PassThru -WindowStyle Minimized
    sleep 15
    $ie.Kill()
    $ie = Start-Process -file iexplore -arg "https://OURTENANT-my.sharepoint.com/personal/${env:username}_OURDOMAIN_org\Documents" -Passthru -WindowStyle Minimized
    sleep 15
    $ie.Kill()
    $folder = '\\OURTENANT.sharepoint.com@SSL\DavWWWRoot\sites\TEST'
    $folder2 = '\\OURTENANT-my.sharepoint.com@SSL\DavWWWRoot\personal\' + $env:username + '_OURDOMAIN_org\Documents'
    $QuickAccess = New-Object -ComObject shell.application
    $QuickAccess.Namespace($folder).Self.InvokeVerb("pintohome")
    $QuickAccess.Namespace($folder2).Self.InvokeVerb("pintohome")

You must be logged in to reply to this topic.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort