Advertisement
Guest User

Connect-Office365.ps1

a guest
Apr 22nd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Write-Host "the following credential needs to be entered as <username>@<domain>"
  2. Write-Host "Press any key to continue ..."
  3. $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  4.  
  5. $UserCredential = Get-Credential
  6.  
  7. $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/?proxymethod=rps -Credential $UserCredential -Authentication Basic -AllowRedirection
  8.  
  9. Import-PSSession $session
  10.  
  11. Write-Host
  12. Write-Host .
  13. Write-Host Remember to close session with: Get-PSSession `| Remove-PSSession
  14.  
  15. function prompt {
  16.     Write-Host '[Office365] &'$pwd.ProviderPath `n -NoNewLine
  17.     #Write-Host "Σ" -NoNewLine -ForegroundColor "DarkGray"
  18.     return
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement