zoukankan      html  css  js  c++  java
  • Connect to Office365

    How to connect to office365

    1. Connect to Exchange Online

       

    $UserCredential = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session

    Also  We can use command with username and password

    $CNUser = "admin@consto.partner.onmschina.cn"
    $CNPWord = ConvertTo-SecureString –String "password" –AsPlainText -Force
    $CNCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $CNUser,$CNPWord
    Import-Module MSOnline
    Connect-MsolService -Credential $CNCredential
    $ExchangeShell = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell-LiveID?PSVersion=2.0 -Credential $CNCredential -Authentication Basic -AllowRedirection
    $importresults = Import-PSSession $ExchangeShell -AllowClobber

    2. Connect to Office 365

    Get-ExecutionPolicy
    Set-ExecutionPolicy RemoteSigned    #更改执行策略
    $credential = Get-Credential        /#创建凭据
    $credential                        #验证凭据
     #连接到office365上面(首先要导入模块,安装登录助手,Azure AD模块)
     #注意要是安装好了Azure Adconnect 的时候,先决条件会自动安装成功
    Import-Module MsOnline         #导入office365模块
    Get-Module                     #验证是否导入模块 ,若是返回Manifest   MSOnline                            {Add-MsolAdministrativeUnitMe… 即是导入模块成功
    Connect-MsolService -Credential $credential      #连接到office365上面
    Get-MsolDomain                                    #获取office365中的域

    Also  We can use command with username and password

    $User = "admin@constos.partner.onmschina.cn"
    $PWord = ConvertTo-SecureString –String "password" –AsPlainText -Force
    $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$Pword
    Import-Module MsOnline
    Connect-MsolService -Credential $Credential

    3. connct office 365 sharepoint online

    在你开始使用 Office 365 PowerShell 管理 SharePoint Online 之前,请确保安装了 SharePoint Online Management Shell 及其先决条件并且已连接到 SharePoint Online。

    通过下载并运行 SharePoint Online Management Shell 安装 SharePoint Online Management Shell。只需对每台计算机执行一次此操作。

    若要打开 SharePoint Online Management Shell 的命令提示符,请从开始屏幕中键入 sharepoint,然后单击“SharePoint Online Management Shell”。

    若要连接到 SharePoint Online,请填写 $adminUPN 和 $orgName 变量的值(替换引号中的所有文本,包括 < and > 字符),然后在 SharePoint Online Management Shell 命令提示符中运行以下命令:

    $adminUPN="<the full email address of an Office 365 administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>"
    $orgName="<name of your Office 365 organization, example: contosotoycompany>"
    $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
    Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential

    https://technet.microsoft.com/library/dn568036.aspx

    连接到 SharePoint Online PowerShell

    在你开始使用 PowerShell 管理 SharePoint Online 之前,请确保安装了 SharePoint Online 命令行管理程序并且已连接到 SharePoint Online。

    通过下载并运行 SharePoint Online 命令行管理程序 安装 SharePoint Online 命令行管理程序。只需对你正在从其中运行 SharePoint Online PowerShell 命令的每台计算机执行一次此操作。

    若要打开 SharePoint Online 命令行管理程序的命令提示符,请从开始屏幕中键入 sharepoint,然后单击“SharePoint Online 命令行管理程序”。

    若要连接到 SharePoint Online,请填写 $adminUPN 和 $orgName 变量的值(替换引号中的所有文本,包括 < and > 字符),然后在 SharePoint Online 命令行管理程序命令提示符中运行以下命令:

     
     
    $adminUPN="<the full email address of a SharePoint Online global administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>"
    $orgName="<name of your Office 365 organization, example: contosotoycompany>"
    $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
    Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
    

    系统通过“Windows PowerShell 凭据请求”对话框提示你时,请键入 SharePoint Online 全局管理员帐户的密码。

    你现在就可以开始执行 SharePoint Online 命令。

  • 相关阅读:
    win8 需要管理员权限才能删除此应用程序
    windows 8 解决端口(COM和LPT)问题:Prolific USBtoSerial Comm Port(COM4)驱动异常的问题
    sqlite 获取数据库中的所有表
    ListView simpleAdapter的基本使用
    一根长度为133米的材料需要截成长度为19米和23米的短料,求两种短料各截多少根时剩余的材料最少?
    打印输出九九乘法表
    写一个函数,输入一个十六进制,输出相应的十进制数。
    求3100的素数!
    从键盘输入若干个同学的成绩,统计并输出最高成绩 最低成绩 平均分,当输入负数时结束输入
    编写两个函数,分别求由键盘输入两个整数的最大公约数和最小公倍数。用主函数调用这两个函数,并输出结果
  • 原文地址:https://www.cnblogs.com/junjiany/p/6125168.html
Copyright © 2011-2022 走看看