Monthly Archives: November 2012

Microsoft SQL Server – Named Pipes Provider

Today I wanted to connect to a Microsoft SQL Server (Express Edition) via a custom powershell script.
I used the sqlcmd command, supplied a username and password and tried to connect.
The script stopped with the following error:

HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].

Turns out that I forgot to enable the “Named Pipes” protocol. Fire up your SQL Server Configuration Manager and enable this protocol. Don’t forget to restart the service afterwards.
Have a look at the following screenshot.

MSSQL Named Pipes

MSSQL Named Pipes

Create users with Puppet

In today’s post I want to show you a simple Puppet recipe for creating Users, setting an initial password and force the user to change it after the first Login.
If you are not familiar with Puppet please check the website of this great project.

init.pp

define users ( $state, $id, $uid, $gid, $pass, $realname, $sgroups) {
	user { $id:
			ensure => $state,
			uid => $uid,
			gid => $gid,
			shell => "/bin/bash",
			home => "/home/$id",
			comment => $realname,
			managehome => true,
			groups => $sgroups,
			password_max_age => '90',
	}

	case $::osfamily {
			RedHat: {$action = "/bin/sed -i -e 's/$id:!!:/$id:$pass:/g' /etc/shadow; chage -d 0 $id"}
			Debian: {$action = "/bin/sed -i -e 's/$id:x:/$id:$pass:/g' /etc/shadow; chage -d 0 $id"}
	}

	exec { "$action":
			path => "/usr/bin:/usr/sbin:/bin",
			onlyif => "egrep -q  -e '$id:!!:' -e '$id:x:' /etc/shadow",
			require => User[$id]
	}
}

nodes.pp

users{ 'xyz': state => 'present', id => 'xyz', uid => '10001', gid => '10001', pass => '$1$qj3Ks0$pNT55P98zsdJE5GeRUdHh0', realname => 'XZY YZX', sgroups => ['audio']}

The user variables should be clear and easy to understand.
Depending on your system (Debian or RedHat) the exec part sets your initial password (provided in nodes.pp) and expires the account/password so the user has to change the password after her/his first login.

Birthday dinner

As every year around this time I celebrate my birthday :)
This year my girlfriend surprised me with a perfect birthday dinner combining all my favourite dishes into one dinner session.

Just to make you a bit envious take a look at the following photos.

All in all: just great! Looking forward to next year ;)
If you have questions regarding the recipe just ask nicely at this site: www.elisabethjoebstl.com

Sorry …

You might have seen some strange behaviour/errors at this page for some time.
This is due to some maintenance I am doing to this blog.

Sorry for inconvenience