I would like to use PowerShell to manage Office 365, like deleting Office Box 365, how to deal with?

I would like to use PowerShell to manage Office 365, for example, to remove the Office 365 mailbox using PowerShell, which is how the job?


2012/03/10 If the problems according to this article execute PowerShell, please refer to the text steps, and then test to see

PowerShell connection, use PowerShell errors [files could not be loaded because the system has been disabled command code execution], how to deal with?

The ins and outs of the problem

I would like to use PowerShell to manage Office 365, for example, to remove the Office 365 mailbox using PowerShell, which is how the job?

The cause of the problem

Management wants to use PowerShell Office 365, you must install some software components, the installation is complete, you'll be able to connect to Office 365 services using PowerShell, to Office 365 to operate.

Solution to the problem

Install the necessary conditions

1. Windows PowerShell 和 .NET Framework 3.5.1。

2. Microsoft Online Services Sign-in Assistant.

Microsoft Online Services Sign-in Assistant --32-bit version

Microsoft Online Services Sign-in Assistant --64-bit version

The installation file to install after downloading.

image

SNAGHTML4b2453

SNAGHTML4df24b

3. If necessary use Cmdlet, install the Microsoft Online Services Module for Windows PowerShell is.

For Windows PowerShell The Microsoft Online Services Module (32-bit version)

For Windows PowerShell The Microsoft Online Services Module (64-bit version)

The installation file to install after downloading

image

SNAGHTML4e7678

SNAGHTML4ef096

SNAGHTML4f3acf

SNAGHTML4f7530

SNAGHTML4ff94d

在本机电脑上将 Windows PowerShell 连线到 Office 365 云端架构服务

1. 开启 PowerShell。

image

2. 输入命令


$LiveCred = Get-Credential

此时出现【Windows PowerShell 认证要求】窗口,输入 Office 365 使用者名称与密码后,按【确定】。

image

2. 输入命令


$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

AllowRedirection 参数可让全世界数据中心的云端架构组织使用相同的 URL,并将 Windows PowerShell 连线到 Office 365 云端架构服务。

image

3. 输入命令


Import-PSSession $Session

将用于 Office 365 云端架构服务的命令导入至本机电脑的用户端工作阶段,完成后您就可以开始在 PowerShell 执行命令操作信箱。

image

检视与删除在 Office 365 信箱

1. 使用【Get-Mailbox】可以检视有关 Office 365 云端架构信箱的资讯。

image

在 Office 365 您也可以检视相同的信箱资讯。

image

2. 使用【Remove-Mailbox】命令可以删除信箱。

image

在 Office 365,您也可以选择信箱,然后按【删除】按钮进行删除信箱的操作。

image

3. 使用【Get-RemovedMailbox】命令可以检视可复原的已删除邮箱。

image

在 Office 365,您可以点选【已删除的信箱】按钮,取得相同的资讯。

image

中断 Windows PowerShell 与云端架构服务的连线

1. 当您完成操作后,请记得中断 PowerShell 的连线,输入命令


Remove-PSSession 
  
  

image

2. If you do not disconnect the server-side session would close the Windows PowerShell window, your connection will remain on for 15 minutes, your account can only have three connections the server-side session.

Other Information

Use Windows PowerShell to manage Office 365

The Windows PowerShell connection to the service

PowerShell Cmdlet available in Exchange Online Reference

Original: Large column  I would like to use PowerShell to manage Office 365, like deleting Office Box 365, how to deal with?


Guess you like

Origin www.cnblogs.com/petewell/p/11445673.html