Advertisement
Guest User

2

a guest
Feb 10th, 2014
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Get-PSSession | Remove-PSSession
  2.     $User = 'My-User@My-MSOL-Email-Domain'
  3.     $Pass = ConvertTo-SecureString -String 'DontWorryImNotDumbEnoughtoPutARealPasswordHere' -AsPlainText -Force
  4.     #Encrypt password for transmission to Office365
  5.     $SecureOffice365Password = ConvertTo-SecureString -AsPlainText $Pass -Force    
  6.     #Build credentials object
  7.     $Office365Credentials  = New-Object System.Management.Automation.PSCredential $User, $Pass
  8.     #Create remote Powershell session
  9.     $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $Office365credentials -Authentication Basic –AllowRedirection    
  10.     #Import the session
  11.     Import-PSSession $Session -AllowClobber | Out-Null
  12.     #Connect
  13.     Import-Module MSOnline
  14.     $LiveCred = Get-Credential -Credential $Office365Credentials
  15.     Connect-MsolService -Credential $LiveCred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement