If you are running (or use) the Sympa Mailing List but also use Windows PowerShell then you may want to be aware of PSSympa which recently went v1.0 on GitHub and the PowerShell Gallery.

In this release we have…

Functions

  • Get-SympaLogin (to login and get a session cookie – the result of which is used with all other functions)
  • Get-SympaMailingListMember (get the members of a list or list(s))
  • Add-SympaMailingListMember (add a member(s) to a list)
  • Remove-SympaMailingListMember (removes a member(s) from a list)
  • Test-SympaMailingListMember (checks to see if someone is a Subscriber, Owner or Editor of a list)
  • Sync-SympaMailingList (based on the contents of a reference CSV makes changes to the membership of a list)

Samples

  • How a CSV storing credentials might look (samplecredsfile.csv)
  • How a CSV that is used to Add/Remove members in bulk to/from a single list (samplememberslist.csv)
  • How a CSV that is used with the Sync- function would look (samplesynclist.csv)

Super Awesome Features

  • Credentials can be stored in a CSV to avoid them being typed in as part of a wider script
  • Pipeline support for members in lists

How to get it

The PowerShell Gallery is the best route to get your hands on the Module, see this link – https://www.powershellgallery.com/packages/PSSympa for the full details in short though you should only need to run the following command at your PowerShell prompt (assuming you are running a recent version of PowerShell) to install the module on your PC.

Install-Module -Name PSSympa

Example usage

#Login
$Sympa = Get-SympaLogin -Username test-user@ox.ac.uk -Password $(“cheesypassword1” | ConvertTo-SecureString -AsPlainText -Force) -WSDL https://web.maillist.ox.ac.uk/ox/wsdl

#Get a list of members
Get-SympaMailingListMember -Sympa $Sympa -MailingList queens-it

#Get a list of members and send the list to a CSV
Get-SympaMailingListMember -Sympa $Sympa -MailingList queens-it | Export-Csv C:\Temp\list.csv –NoTypeInformation

#Add a member to a mailing list
Add-SympaMailingListMember -Sympa $Sympa -MailingList queens-it -Member jim.bob@queens.ox.ac.uk
Or
Add-SympaMailingListMember -Sympa $Sympa -MailingList queens-it -Member @(‘jim.bob@queens.ox.ac.uk’,’jim.kirk@queens.ox.ac.uk’)

#Remove a member from a mailing list
Remove-SympaMailingListMember -Sympa $Sympa -MailingList queens-it -Member jim.bob@queens.ox.ac.uk
Or
Remove-SympaMailingListMember -Sympa $Sympa -MailingList queens-it -Member @(‘jim.bob@queens.ox.ac.uk’,’jim.kirk@queens.ox.ac.uk’)

#Sync up a set of lists in Sympa with a CSV
Sync-SympaMailingList -Sympa $Sympa -Path C:\Sympa\synclist.csv

VN:F [1.9.22_1171]
Thumbs up if this article helped you 🙂
Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published.