LiquidObject

Lyris ListManager & PowerShell

When working with Lyris ListManager this week along with an existing account automation process, I ran into the issue of needing to automatically subscribing people to a list which has restrictions in place to require the use of confirmation messages generally. Well with a programmatic solution in mind, send & replying to e-mail confirmation messages just won’t cut it. Below is a simple sample of how to with PowerShell automatically enroll users into an existing ListManager list.

 

 

function ListEnrollment
{
	param([array]$myuser)
	$myconn = New-Object System.Data.SqlClient.SqlConnection("Data Source=LYRIS-DBServer; Initial Catalog=Lyris; Integrated Security=SSPI")
	$myconn.Open()
	$mycmd = $myconn.CreateCommand()
	
	$mydate = Get-Date -Format "yyyy-mm-dd HH:mm:ss"
	$mydisplay = "$myuser[2] $myuser[3]"
	
	$mycmd.CommandText = "Insert Into members_ (Domain_,UserNameLC_,EmailAddr_,FullName_,List_,DateJoined_) VALUES ('MyDomain','$myuser[0]','$myuser[1]','$mydisplay','MyListName','$mydate')"
	$mylog += $mycmd.CommandText
	Write-Host $mycmd.CommandText
	$mycmd.ExecuteNonQuery()
	$myconn.Close()
}

To call this function just use

ListEnrollment("username","email","FirstName","LastName")

This offers up a fairly simple solution to automate this potentially cumbersome manual process. As written this will use whatever credentials the PowerShell process is running to authenticate against the database.

If wanted, you can ignore the DateJoined_ and FullName_ columns as they are not required though useful. The Lyris database itself has triggers built-in upon insertion to do the heavy lifting for the rest of the required columns.

, ,
May 7, 2012 at 2:59 pm Comment (1)

Office Remodel

A slight digress from the norm for myself is an office remodeling project. While normally I stay out of these kind of issues it reminds me how farsighted organizations can be at times looks at the next 3 or 6 months but never looking years down the road on the effects of what they do. In a large warehouse setting where you have one enormous room it makes sense in a way to use cubicles as it allows for flexibility to change the configuration as years go by. However when trying to use this methodology when you are working with smaller existing rooms which can only really be configured in on or two orientations and where history has shown once installed existing cubicle furniture will be used as is for 10+ years why spend the money on high-wall cubicles  with electrical & data run into them at a cost equal to or more than fixed walls? Often times it is cited it provides a better “community feeling” or aids in “collaboration”. Then why does it often sound like a bar scene where the only way people can concentrate on the task at hand is by using noise-cancelling headphones all day long? Do I really need to hear every conversation of everyone within 5 cubes of myself? No, I think not.

 

Dilbert - Death Eater Gray


May 2, 2012 at 9:12 am Comments (0)