[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement")
$wmi = new-object ("Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer") "$env:computername"
$wmi.ServerInstances["SQLEXPRESS"].ServerProtocols["Tcp"].IsEnabled = $true
$wmi.ServerInstances["SQLEXPRESS"].ServerProtocols["Np"].IsEnabled = $true
$wmi.ClientProtocols["tcp"].IsEnabled = $true
$wmi.ClientProtocols["np"].IsEnabled = $true