Powershell – 使用”Set-UnifiedGroup”来更改更多群组

huangapple go评论63阅读模式
英文:

Powershell - Use "Set-UnifiedGroup" to change more Groups

问题

我想将数百个组在GAL中设置为不可见。是否有一种简单快速的方法来做到这一点?我是PowerShell的初学者,所以请小心。
代码如下:

Set-UnifiedGroup -Identity "GroupName" -HiddenFromAddressListsEnabled $true

对于所有组都这样做太多了。有没有人知道另一种方法?

非常感谢!

英文:

)

I wanna set hundred of Groups unvisible in the GAL. Is there a option to do this easy and fast? I am beginner in PowerShell Powershell – 使用”Set-UnifiedGroup”来更改更多群组 so keep care
Code is:

Set-UnifiedGroup -Identity "GroupName" -HiddenFromAddressListsEnabled $true

It is way to much to do this with all groups. Does anybody know another way?

Thank you so much!

答案1

得分: 1

你可以遍历所有群组。首先,你需要获取所有群组。你可以使用管道|将返回值传递给另一个Cmdlet。

这应该是这样的:

Get-UnifiedGroup | Foreach-Object { 
    Set-UnifiedGroup -Identity $_.Name -HiddenFromAddressListsEnabled $true
}

由于我无法测试这个,请确保属性是$_.Name。如果只使用Get-UnifiedGroup,你可以在标题中看到属性的名称。

英文:

You can iterate through all groups. First you need to get all groups. You can pass the return values to another Cmdlet with a pipe |.
There is a foreach-object loop. This means it will do something for every object returned by Get-UnifiedGroup or any other Cmdlet that returns objects

It should be something like that:

Get-UnifiedGroup | Foreach-Object { 
    Set-UnifiedGroup -Identity $_.Name -HiddenFromAddressListsEnabled $true
}

As I'm not able to test this be sure the property is $_.Name.
If you just use Get-UnifiedGroup you can see the properties name in the headline

huangapple
  • 本文由 发表于 2020年1月3日 21:25:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579408.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定