You are browsing the archive for 2013 November.

Avatar of alkin

by alkin

Powershell Deployment Toolkit failed missing port for sql server

8:28 pm in Uncategorized by alkin

During the validation of PDT I received the following errory saying that the port was missing for my new SQL instances:

clip_image002

To fix this just add Port="number" in the SQL instance section like shown below:

image

Thanks for Damian Flynn to point this out to me.

Hope this helps,

Alex

Avatar of alkin

by alkin

Setting SQL permissions with Powershell

12:08 am in SytemCenter by alkin

 

In the next couple of posts I’m going to blog about automating a System Center post-configuration deployment with Powershell. After you have deployed a typical SC environment you still need to do quite a lot of configuration. The following posts will cover how to automate this with Powershell.

 

The first powershell script is to define a specific user account as a sysadmin on a bunch of SQL servers:


<sub>#Variables
$Servers = @("srv01.contoso.com",”srv02.contoso.com”)</sub>

<sub>
#Connect remotely to the server</sub>

<sub>
Foreach($Server in $Servers)
{ </sub>

<sub>Invoke-Command -ComputerName $Server -ScriptBlock { </sub>

<sub>
#Set the system account as sysadmin</sub>

<sub>[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null </sub>

<sub># Create SMO Connections to both SQL Instances
$Svr = New-Object ('Microsoft.SqlServer.Management.Smo.Server') "$server"
$svrole = $svr.Roles | where {$_.Name -eq 'sysadmin'}
$svrole.AddMember("User account”)
}
}</sub>

Thanks,

Alex

Visit Us On TwitterVisit Us On Linkedin