function pro { notepad $profile }

[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum")
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.WmiEnum")
$smo = 'Microsoft.SqlServer.Management.Smo.'
$server = new-object ($smo + 'server') .
$mc = new-object ($smo + 'WMI.ManagedComputer') .

function executesql {
$server = new-object ('microsoft.sqlserver.management.smo.server');
write-host "executing " $args[0]
write-host "Server:"$server.Name
$rdr = $server.ConnectionContext.executeReader($args[0]);
while($rdr.Read())
{
for($c = 0; $c -lt $rdr.FieldCount; $c++) { ($rdr.GetName($c) + ":" + $rdr.GetValue($c)) }
write-host ""
}
$rdr.close();
}
