I want to create a distribution list through servicenow to add user & remove user as well.If any idea script can share here to achive this.

praveen50
Tera Contributor

I want to create a distribution list through servicenow ,To add user & remove user as well.If any idea script can share here to achive this.

9 REPLIES 9

HI,

You will only see success or failure if your PS script is not sending any details back.

In ecc queue you can check what you get back.

Thanks,
Ashutosh

Hi @Ashutosh Munot1


We have a similar requirement and our client is on exchange server online. We have installed the OOB spoke of microsoft exchange online and trying to automate it through flow designer. But, we do not see any OOB action available to create Distribution List. We have other options for e.g. Mailbox management, calendar etc.

Could you please help us with your inputs in this matter?

Servicenow lea2
Tera Contributor

Hi @praveen50 we had a similar requirement and we were able to achieve it by the below steps,

 

If you are connecting to exchange server, Please install microsoft exchange server spoke, Create connection for the spoke and in the connections select authentication type as exchange and kerberos

 

Copy the spoke action create shared mailbox and in the try block of the action remove complete code and call the powershell command "new-DistributionGroup" with the required parameters

 

To create a distribution list on exchange server you need to create a powershell remote session.

 

Feel free to reply if you need a screenshots

Hi Servicenow Lea2
I have a similar requirement where we need to create DL from catalog item, We have a custom workflow in which we call create address list activity but we are getting the response as fail. could you please help us here in providing the steps.

Thanks in advance

Hi @HarishY ,  Address lists and distribution lists differ as per the description. If you are trying to create a distribution list through servicenow in on premise instance Please follow below steps :

  • Install Microsoft exchange Server Spoke
  • Copy the Oob action create address list under exchange server spoke in flow designer 
  • Rename the copied action to Create new distribution list
  • In the mid server script files create new script file with name createnewdistributionlist.ps1 under the parent exchange server
  • Copy the code same as from ExchangeSpoke-GetAddressList.ps1 mid server script file
  • in the try block remove all the existing code and replace with below line of code

New-DistributionGroup -Name "Managers" -Type "Security" 

Please change type and name of group as per your requirements

Open the connection credentials and make sure in the authentication type you have set authentication as Kerberos.

 

Please try the steps and let us know if you face any issue, Screenshots of error would help to resolve better

 

Refer below link for powershell commands for creating distribution list

https://learn.microsoft.com/en-us/powershell/module/exchange/new-distributiongroup?view=exchange-ps