Office 365 遠程登錄命令

以前管理Office365的時候,需要經常登錄後臺查看用戶郵件信息,配置用戶郵箱屬性等等,下面的腳本可以讓管理員快速登錄後臺。



方法一:

#region Online-Session
function Online-Session(){
    $UserCredential = Get-Credential -Credential [email protected]
    $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 [email protected]
    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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章