Start-Transcript ".\Set-GroupSendPermisionLog.txt" -Force

 function Get-DLMemberRecurse
{
$group=get-distributiongroupmember $args[0] -ResultSize unlimited
foreach ($varTemp in $group)
{
$varTemp
if ($varTemp.RecipientType -like "Mail*Group")
{
$members += $varTemp.Identity
Get-DLMemberRecurse $varTemp.Identity
}
}
return $members
} $CsvPath = ".\Set-GroupSendPermisionList.csv" $Users = import-csv $CsvPath foreach ($User in $Users)
{
$groupname=$User.Group
$groupname if (!(get-distributiongroup $groupname))
{
echo "Group not found"
} else {
echo "Group found"
Get-DLMemberRecurse $groupname | where-Object {$_.RecipientType -like "Mail*Group"} | select name | export-csv -NoTypeInformation -Encoding utf8 -path .\Set-GroupSendPermision.csv
$content=Get-Content -Encoding utf8 -Path .\Set-GroupSendPermision.csv | Select -Skip 1
$content=$content.Replace("`"","")
#$content
$dup=($content | Measure-Object).count
$dup
echo -----------------------------------------------
$content=$content | sort | get-unique
#$content
$nodup=($content | Measure-Object).count
$nodup
echo ===============================================
for($i=1;$i -le $nodup;$i++)
{
$i
echo 1
if ($nodup -eq 1)
{
$Identity=$content
}
else
{
$Identity=$content[$i-1]
}
echo 2
$Identity
echo 3
(Get-DistributionGroup -identity $Identity).AcceptMessagesOnlyFromSendersOrMembers
echo 4
#Set-DistributionGroup -Identity $Identity -AcceptMessagesOnlyFromSendersOrMembers ((Get-DistributionGroup -identity $Identity).AcceptMessagesOnlyFromSendersOrMembers +"$Gmember") -BypassSecurityGroupManagerCheck
echo *******************************
}
}
echo ///////////////////////////////////////////////////////////////////////////////
} get-pssession | remove-pssession
Stop-Transcript

CSV格式
User,Group
user1,group1
user1,group2
user1,group3
user2,group1
user3,group3

http://www.smallrascal.cn/smallrascal/article.asp?id=2082

【转载】Powershell设置世纪互联Office365嵌套组发送权限的更多相关文章

  1. 【转载】Powershell在世纪互联Office365中批量将用户添加到组

    $NewUserPath = ".\Office365AddUserToGroup.csv" $NewUsers = import-csv $NewUserPath foreach ...

  2. 【转载】Powershell获取世纪互联Office365所有用户最后一次登录时间

    #$Mails=get-mailbox -ResultSize 10 $Mails=get-mailbox -ResultSize Unlimited $Mails | Measure-Object ...

  3. 【转载】Powershell获取世纪互联Office365中所有用户的OWA时区

    get-mailbox -resultsize unlimited | Get-MailboxRegionalConfiguration | select Identity,TimeZone | wh ...

  4. 【转载】Powershell连接世纪互联Office365

    $User = "admin@contoso.com" $PWord = ConvertTo-SecureString –String "password" – ...

  5. O365(世纪互联)SharePoint 之调查列表简单介绍

    前言 SharePoint中为了提供了很多开箱即用的应用程序,比如调查列表就是其中之一,同样,在O365版本里(国际版和世纪互联版本均可),也有这样的调查列表可以供我们使用,而使用起来非常方便和快速, ...

  6. [SharePoint Online]SharePoint Designer无法打开世纪互联版sp online站点得解决方法,报错信息:请安装更新后再重新打开

    现象描述: 装了个x64版SharePoint designer 2013, 没有装SP1,在打开国际版得office 365 online得时候完全没有问题,但是在打开世纪互联版得时候就打不开,让安 ...

  7. 世纪互联运营的Microsoft Azure正式支持FreeBSD虚拟机镜像

    自2012年开始,微软云计算与企业事业部和Citrix思杰,NetApp达成合作,共同开发出第一版针对Hyper-V虚拟设备驱动以及相关的用户态程序,并将此称之为集成服务(Integration Se ...

  8. 微软Azure运营方世纪互联遭做空后强劲反弹

    http://www.cnblogs.com/sennly/p/4135594.html 最近几天微软Azure的运营方世纪互联被Trinity做空,股价震荡巨大,先让我们回顾下整个事件: 9月11日 ...

  9. 由世纪互联运营的 Windows Azure 现已在中国正式发布

     我们非常高兴地公开发布由世纪互联运营的 Windows Azure,这标志着我们成为第一家在中国国内正式提供公共云平台技术的跨国公司.这一伟大成就的实现,得益于 Microsoft 与世纪互联的 ...

随机推荐

  1. iOS部分其他知识

    1.界面切换传值 (1)使用button进行界面切换 //当页面跳转时系统自动调用,segue连线 - (void)prepareForSegue:(UIStoryboardSegue *)segue ...

  2. 重构9-Extract Interface(提取接口)

    我们来介绍一个常常被忽视的重构:提取接口.如果你发现多于一个类使用另外一个类的某些方法,引入接口解除这种依赖往往十分有用.该重构实现起来非常简单,并且能够享受到松耦合带来的好处. public cla ...

  3. Oracle基础 锁

    一.锁 数据库是一个多用户使用的共享资源.当多个用户并发地存储数据时,数据库中就会产生多个事务同时存取同一数据的情况.若对并发操作不加控制就可能会读取和存储不正确的数据,破坏数据库的一致性. 锁是实现 ...

  4. ligerui grid行编辑示例

    <%@ page contentType="text/html; charset=UTF-8" %> <% String path = request.getCo ...

  5. hdu 3938 并查集

    思路:这题的出题人是不是语文不行啊,题目意思说不清楚. 知道是求存在路径的点对数后,用并查集每次记录集合中点的数目,很容易就解决了. #include<set> #include<c ...

  6. latex之设置字体大小

    \tiny\scriptsize\footnotesize\small\normalsize\large\Large\LARGE\huge\Huge

  7. VB.NET 小程序 3

    Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ...

  8. 关于arraylist.remove的一些小问题。

    public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<Integer> ...

  9. Android ListView动态改变Item高度

    在adapter的getView方法中进行设置,代码如下 @Override public View getView(int position, View convertView, ViewGroup ...

  10. Part 48 to 51 Talking about Access Modifiers in C#

    Part 48 Difference between Types and Type Members Part 49 Access Modifiers in C# Part 50 Internal an ...