Powershell Get Domain Mailbox的几种方法
一、Disconnected Mailboxes
1、Finding Disconnected Mailboxes
The first function is called Get-DisconnectedMailbox and the name is pretty much self explanitory. This function will give you a list of all disconnected mailboxes on each of your mailbox servers. Take a look at the following code:
function Get-DisconnectedMailbox {
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory=$false)]
[System.String]
$Name = '*'
)
$mailboxes = Get-MailboxServer
$mailboxes | %{
$disconn = Get-Mailboxstatistics -Server $_.name | ?{ $_.DisconnectDate -ne $null }
$disconn | ?{$_.displayname -like $Name} |
Select DisplayName,
@{n="StoreMailboxIdentity";e={$_.MailboxGuid}},
Database
}
}
Note: If you’ve recently deleted a mailbox, but it’s not showing up when running Get-DisconnectedMailbox, you may need to force Exchange to recognize this by running the Clean-MailboxDatabase cmdlet.
2、Purging Disconnected Mailboxes
You purge mailboxes using the Remove-Mailbox cmdlet, specifying the StoreMailboxIdentity and Database for the disconnected mailbox in question. For a good example of this, check out Nitin Gupta’s post on removing disconnected mailboxes.
In an effort to simplify the purging of disconnected mailboxes, I wrote the Remove-DisconnectedMailbox function that is designed to work with Get-DisconnectedMailbox. Here is the code:
function Remove-DisconnectedMailbox {
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[Parameter(Position=0, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]
[System.String]
$StoreMailboxIdentity,
[Parameter(Position=1, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]
[System.String]
$Database
)
process {
Remove-Mailbox @PSBoundParameters
}
}
Get-DisconnectedMailbox “Bill Jones” | Remove-DisconnectedMailbox -Confirm:$false
Get-DisconnectedMailbox “Bradford Boyer” | %{Connect-Mailbox -Identity $_.StoreMailboxIdentity -Database ‘DB1′ -User ‘contoso\bboyer’ -Alias ‘bboyer’}
参考至博文<http://www.mikepfeiffer.net/2010/06/managing-disconnected-exchange-mailboxes-with-powershell/>
二、
Powershell Get Domain Mailbox的几种方法的更多相关文章
- Powershell Get Domain User的几种方法
一.Get-User单用户查询 $User=Get-ADUser -identity wendy -Properties * 二.Get-User多用户循环查询 $export=@() $Users= ...
- Powershell Get Domain Group的几种方法
Group常见属性介绍: 一.Get-ADGroup获取群组(如下例循环获取群组的发送权限) #群组的发送权限info $groups=Get-ADGroup -filter * -SearchSco ...
- ASP.NET Core设置URLs的几种方法
前言 在使用ASP.NET Core 3.1开发时,需要配置服务器监听的端口和协议,官方帮助文档进行简单说明,文档中提到了4种指定URL的方法 设置ASPNETCORE_URLS 环境变量: 使用do ...
- SQL Server启动的几种方法
SQL Server 启动有以下几种方法: (1)在Control Panel——Administrative Tools——Services,找到SQL Server (XXX)进行启动. 其中XX ...
- Ajax跨域的几种方法以及每种方法的原理
js中几种实用的跨域方法原理详解 这里说的js跨域是指通过js在不同的域之间进行数据传输或通信,比如用ajax向一个不同的域请求数据,或者通过js获取页面中不同域的框架中(iframe)的数据.只要协 ...
- 【总结】清除webbrowser cookie/session的6种方法
下面是我测试下来的6种清除webbrowser中cookie的6种方法: //方法一:调用 wininet.dll清除cookie (推荐) SuppressWininetBehavior(); // ...
- GRIDVIEW传值的两种方法
第一种方法:在onselectedindexchanged中写事件 第二种方法:OnRowCommand事件 前端页面: <%@ Page Language="C#" Aut ...
- iOS 本地存储四种方法
在iOS开发过程中,不管是做什么应用,都会碰到数据保存的问题.将数据保存到本地,能够让程序的运行更加流畅,不会出现让人厌恶的菊花形状,使得用户体验更好.下面介绍⼀一下数据保存的方式: 1.NSKeye ...
- HibernateTemplate、HibernateDaoSupport两种方法实现增删改查Good(转)
Spring+Hibernate两种方法实现增删改查 首先,定义一个Customer的bean类,设置好Customer.hbm.xml文件.再定义好一个Dao接口.准备好一个jdbc.propert ...
随机推荐
- Rabbitmq消息队列(五) 路由Routing
1.简介 在以前一章中,我们可以把一个消息广播给多个接收者.在这一章中,我们会增加一个功能:接收者能够只接收订阅消息中的一个子集. 2.绑定 在我们将交换机和队列进行绑定的时候,我们可以添加一个额外的 ...
- Sql學習資源
http://blog.csdn.net/wltica/article/category/1324738/1 SQL Server 整体方案系列: 1. SQL Server 数据归档方案 2. SQ ...
- atitit.nfc 身份证 银行卡 芯片卡 解决方案 attilax总结
atitit.nfc 身份证 银行卡 芯片卡 解决方案 attilax总结 1. nfc(近距离无线通讯技术) 1 2. 工作模式 1 3. NFC 蓝牙 红外具体对比如下表: 2 4. TypeA ...
- Java中的四种引用类型,强引用,软引用,弱引用,虚引用
对于Java中的垃圾回收机制来说,对象是否被回收的标准在于该对象是否被引用.因此,引用也是JVM进行内存管理的一个重要概念. Java中对象的引用一般有以下4种类型: 1强引用 2软引用 3弱引用 ...
- 用Doxygen+Graphviz生成函数调用流程图(转)
源文链接: http://wildpointer.net/2012/04/14/doxygen_graphviz/ 上面这张图是用Doxygen+Graphviz从netcat的源代码生成的函数调用关 ...
- Mac上Nginx-增加对HLS的支持
Mac上Nginx-增加对HLS的支持 我们在Mac上搭建直播服务器Nginx说了如何在Mac搭建视频直播服务器Nginx,对RTMP推流和RTMP拉流的支持.接下来说说如何增加对HLS的支持. 在N ...
- Unity3D 5中增加WebGL 播放插件
http://www.csdn.net/article/2014-03-18/2818822-Unity-5-game-engine 其实我是搞3d的,这篇文章里所有的术语看了都有很强的亲切感. Un ...
- 用e2fsck修复受损的linux文件系统
今天想尝试直接从linux deepin拷贝一些文件到windows 10而不重启电脑,所以就安装Ext2Mgr了并加载了linux的几个磁盘: / /home 再次重启系统想进入linux的时发现系 ...
- EasyUI获取DataGrid中某一列的所有值
function count() { var rows = $('#dg'').datagrid('getRows')//获取当前页的数据行 var total = 0; for (var i = 0 ...
- php yaf框架扩展实践五——数据层
从狭义角度上来理解数据层就是数据库,比较广义的理解来看数据库.远程数据.文件等都可以看做数据层.项目初期的时候一般单一的数据库就可以了,随着流量的增大就要对数据层做很多的改进,例如增加从库分散读压力, ...