码迷,mamicode.com
首页 > 其他好文 > 详细

Office 365 远程登录命令

时间:2016-11-30 04:23:26      阅读:465      评论:0      收藏:0      [点我收藏+]

标签:powershell   office365   

以前管理Office365的时候,需要经常登录后台查看用户邮件信息,配置用户邮箱属性等等,下面的脚本可以让管理员快速登录后台。



方法一:

#region Online-Session
function Online-Session(){
    $UserCredential = Get-Credential -Credential account@xxx.com
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session
}
#endregion


方法二:(包含方法一的功能,并且可以管理License,我一直在使用这个)

#region Online-MsolService
function Online-MsolService{
    Import-Module MsOnline
    $cred=Get-Credential -Credential account@xxx.com
    Connect-MsolService -Credential $cred -errorAction silentlyContinue -errorvariable er
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell-LiveID -Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $Session -AllowClobber
}
#endregion


本文出自 “bxing” 博客,请务必保留此出处http://bxing.blog.51cto.com/1677994/1877922

Office 365 远程登录命令

标签:powershell   office365   

原文地址:http://bxing.blog.51cto.com/1677994/1877922

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!