英文:
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 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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论