0 votes

I've got the following script as part of a larger piece where param-members is an AD Object picker list seperated by a ' ; ' currently:

New-DistributionGroup -Name 'U_Mailbox - %param-company% %param-mailbox-name%' -Alias '%param-mailbox-name%.group' -DisplayName 'U_Mailbox - $company %param-mailbox-name%' -OrganizationalUnit '%param-company%' -PrimarySMTPAddress '%param-mailbox-name%.group@%param-domain' -members '%param-members%'

The problem is that param-members provides the DN of the User object and I either need that to be in "" or convert that to username but I'm struggling to achieve that with multiple Users selected

by (850 points)
edited by

1 Answer

0 votes
by (169k points)

Hello,

The parameter value is an array of distinguished names (DNs) separated by the value specified in the parameter settings. As a solution, you can iterate through the DNs, form the required list and then pass it to the -Members parameter. For an example on how to use parameter values in such a way, have a look at Script 1: Add temporary membership of the following article in our repository: https://www.adaxes.com/script-repository/temporary-group-membrship-s533.htm.

Also, to execute the New-DistributionGroup cmdlet, you will need to connect to Exchange. For details, see https://www.adaxes.com/script-repository/connect-to-exchange-with-powershell-s506.htm.

Related questions

0 votes
1 answer

Trying to create a new group and getting the following error: "The name reference is invalid. (Server: example.com)" I've created groups before...the problem seems to have just ... a new Group object. It has me puzzled so I'm looking for some direction...

asked Feb 28, 2014 by RickWaukCo (1.6k points)
0 votes
0 answers

I have created a Custom action to create some "standard" sub OUs to a particular type of OU in our AD. I wanted to create a script to look in the OU you are executing ... 'Users') -or ($child.Name -eq 'Computer Systems')) {$Context.ConditionIsMet = $False } }

asked Aug 31, 2016 by ggallaway (1.2k points)
0 votes
1 answer

Hello, Some users we are trying to cross over into Adaxes have e-mail addresses with plus signs. Right now, if they put an e-mail address of, "Eamun+hello@domain.com" it ... plus signs in e-mail addresses? I should be valid. http://tools.ietf.org/html/rfc5233

asked Dec 17, 2013 by Eamun (480 points)
0 votes
1 answer

Hello, I am trying to figure out how to create a scheduled task via PowerShell. I've been referencing the SDK, mostly pulling script examples straight out of it. After following the steps on ... ==================> # Save the Scheduled Task $task.SetInfo()

asked Feb 23, 2015 by DFassett (4k points)
0 votes
0 answers

I'm trying to setup a quick automations to drop a notification into a Micrsoft Teams feed using their Webhook integration. I've managed to make Webhooks work ... -body $body -ContentType 'application/json' Any assistance with this would be gratefully received

asked Jan 20 by richarddewis (850 points)
2,087 questions
1,855 answers
5,220 comments
1,942 users