Skip to content

Instantly share code, notes, and snippets.

@Pyromaniaxxx
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pyromaniaxxx/db325ef07262a0bc1b20 to your computer and use it in GitHub Desktop.
Save Pyromaniaxxx/db325ef07262a0bc1b20 to your computer and use it in GitHub Desktop.
Connect Office 365
## 接続情報
$user = "hogehoge@hoge.onmicrosoft.com"
$pass = "pasuwa-do"
## Credential 生成
$str = ConvertTo-SecureString $pass -AsPlainText -Force
$psc = New-Object System.Management.Automation.PsCredential($user, $str)
$O365Cred = Get-Credential -Credential $psc
## 接続
Import-Module MSOnline
$O365Session = New-PSSession -Name "o365Connect" -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session
Connect-MsolService -Credential $O365Cred
## セッション切断(引数 Object)
#Remove-PSSession $O365Session
#Get-PSSession
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment