# create queue and service
# meant to be used with event notifications
# once I find event notifications in the model

$s = new-object ($smo + 'server') .
$b = $s.databases["pubs"].ServiceBroker

# create queue
$q = new-object ($smo + 'Broker.ServiceQueue') $b, "MyQ"
$q.create()

# create-service, goes by event notification contract
$svc = new-object ($smo + 'Broker.BrokerService') $b, "MyService"
$svc.QueueName = "MyQ"
$map = new-object ($smo + 'Broker.ServiceContractMapping')    $svc,"http://schemas.microsoft.com/SQL/Notifications/PostEventNotification"
$svc.ServiceContractMappings.Add($map)
$svc.create()
