【发布时间】:2020-06-27 16:37:51
【问题描述】:
我创建了一个脚本,用于在混合环境中为本地 DG 添加代表发送权限,但在处理名称列表时遇到了一些问题。如果您添加一个名称,则可以添加另一个名称,然后删除旧名称并添加新名称。就是这样。因此,您通常将名称列表用逗号分隔的命令将其全部添加,并且工作正常。该脚本允许我列出它们,但是找不到条目。任何人都可以建议为什么或进行编辑以使其工作吗?
#Script prompts for the required information needed to perform the required actions.
$Distro = Read-Host 'Insert Distribution Group to check perms.'
$DGroup = Read-Host 'Insert Distribution Group Name e.g. DG-Test@test.com'
$username = Read-Host 'Insert User who needs Send On Behalf. Please include all shown in the last step seperate each name by a comma. Format is First Lastname.'
#Displys the current settings for Send on Behalf rights for the DG.
Get-DistributionGroup $Distro | FL GrantSendOnBehalfTo
Read-Host -Prompt "Press Enter to proceed to next step"
#Now script adds the required permissions input at the beginning.
Set-DistributionGroup -Identity $DGroup -GrantSendOnBehalfTo $username
Read-Host -Prompt "Press Enter to proceed to next step"
#Now the script shows the current permissions after changes
Get-DistributionGroup $Distro | FL GrantSendOnBehalfTo
Read-Host -Prompt "Press Enter to exit"
理想情况下,我会看起来是拆分的,因此它会显示当前的权限,然后询问谁需要添加,这样您就可以在脚本中添加所有名称。我是新手,所以仍在学习并希望完成一部分然后扩展它。
谢谢
【问题讨论】:
标签: powershell exchange-server