<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Sev17SQL Server | Sev17</title>
	<atom:link href="http://sev17.com/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://sev17.com</link>
	<description>SQL Server, PowerShell and so on</description>
	<lastBuildDate>Fri, 27 Apr 2012 16:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
		<item>
		<title>Table-Valued Parameter Example</title>
		<link>http://sev17.com/2012/04/table-valued-parameter-example/</link>
		<comments>http://sev17.com/2012/04/table-valued-parameter-example/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 19:34:53 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[TVP]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10896</guid>
		<description><![CDATA[I wanted show someone how to use table-valued parameters available in SQL Server 2008 and higher. The main use case of table-valued parameters is for sending a list or array of items as parameter to a SQL Server stored procedure or function. This is more efficient than parsing strings or XML on the SQL Server...]]></description>
			<content:encoded><![CDATA[<p>I wanted show someone how to use table-valued parameters available in SQL Server 2008 and higher. The main use case of table-valued parameters is for sending a list or array of items as parameter to a SQL Server stored procedure or function. This is more efficient than parsing strings or XML on the SQL Server side. I couldn&#8217;t seem to find a complete example of <a href="http://msdn.microsoft.com/en-us/library/bb510489.aspx" target="_blank">table-valued parameters</a> in the SQL Server documentation. The SQL Server docs only shows the T-SQL portion of the code and not the ADO.NET. I think its difficult to see how you would use this feature without having both the T-SQL and .NET code shown together so, here&#8217;s a simple T-SQL and Powershell script demonstrating table-valued parameters:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">&lt;#
/* FROM SSMS */
USE AdventureWorks
GO
/* Create a CustomerList table type */
CREATE TYPE Sales.CustomerList AS TABLE 
( CustomerID INT );
GO
&nbsp;
/* Create a procedure to use new table type */
CREATE PROCEDURE Sales.uspGetCustomer
    @TVP CustomerList READONLY
    AS 
    SET NOCOUNT ON
    SELECT c.*
    FROM Sales.Customer c
    JOIN @TVP t ON
    c.CustomerID = t.CustomerID;
 GO
&nbsp;
/* Test type and procedure in SSMS */
&nbsp;
/* Declare a variable that references the type. */
DECLARE @CustomerTVP AS Sales.CustomerList;
&nbsp;
/* Add data to the table variable. */
INSERT INTO @CustomerTVP (CustomerID)
SELECT * FROM (
	VALUES (1),(2),(3),(4),(5)
) AS v (CustomerID)
&nbsp;
/* Pass the table variable data to a stored procedure. */
EXEC Sales.uspGetCustomer @CustomerTVP;
GO
#&gt;</span>
&nbsp;
<span style="color: #008000;">#FROM Powershell</span>
<span style="color: #008000;">#Create an ADO.NET DataTable matching the CustomerList Table Type:</span>
<span style="color: #800080;">$dt</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> Data.datatable  
<span style="color: #800080;">$col</span> <span style="color: pink;">=</span>  <span style="color: #008080; font-weight: bold;">new-object</span> Data.DataColumn  
<span style="color: #800080;">$col</span>.ColumnName <span style="color: pink;">=</span> <span style="color: #800000;">'CustomerID'</span>  
<span style="color: #800080;">$col</span>.DataType <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Int32<span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$dt</span>.Columns.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$Col</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;">#Add a Row to the DataTable</span>
<span style="color: #800080;">$dr</span> <span style="color: pink;">=</span> <span style="color: #800080;">$dt</span>.NewRow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$dr</span>.Item<span style="color: #000000;">&#40;</span><span style="color: #800000;">'CustomerId'</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">=</span> <span style="color: #804000;">1</span>   
<span style="color: #800080;">$dt</span>.Rows.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$dr</span><span style="color: #000000;">&#41;</span>  
&nbsp;
<span style="color: #008000;">#Add a 2nd Row to the DataTable</span>
<span style="color: #800080;">$dr</span> <span style="color: pink;">=</span> <span style="color: #800080;">$dt</span>.NewRow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$dr</span>.Item<span style="color: #000000;">&#40;</span><span style="color: #800000;">'CustomerId'</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">=</span> <span style="color: #804000;">2</span>   
<span style="color: #800080;">$dt</span>.Rows.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$dr</span><span style="color: #000000;">&#41;</span>  
&nbsp;
<span style="color: #008000;">#Add a 3rd Row to the DataTable</span>
<span style="color: #800080;">$dr</span> <span style="color: pink;">=</span> <span style="color: #800080;">$dt</span>.NewRow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$dr</span>.Item<span style="color: #000000;">&#40;</span><span style="color: #800000;">'CustomerId'</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">=</span> <span style="color: #804000;">3</span>   
<span style="color: #800080;">$dt</span>.Rows.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$dr</span><span style="color: #000000;">&#41;</span>  
&nbsp;
<span style="color: #008000;">#Connection and Query Info</span>
<span style="color: #800080;">$serverName</span><span style="color: pink;">=</span><span style="color: #800000;">&quot;$env:computername\sql1&quot;</span> 
<span style="color: #800080;">$databaseName</span><span style="color: pink;">=</span><span style="color: #800000;">'AdventureWorks'</span> 
<span style="color: #800080;">$query</span><span style="color: pink;">=</span><span style="color: #800000;">'Sales.uspGetCustomer'</span> 
&nbsp;
<span style="color: #008000;">#Connect</span>
<span style="color: #800080;">$connString</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Server=$serverName;Database=$databaseName;Integrated Security=SSPI;&quot;</span> 
<span style="color: #800080;">$conn</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> System.Data.SqlClient.SqlConnection <span style="color: #800080;">$connString</span> 
<span style="color: #800080;">$conn</span>.Open<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;">#Create Sqlcommand type and params</span>
<span style="color: #800080;">$cmd</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> System.Data.SqlClient.SqlCommand
<span style="color: #800080;">$cmd</span>.Connection <span style="color: pink;">=</span> <span style="color: #800080;">$conn</span>
<span style="color: #800080;">$cmd</span>.CommandType <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Data.CommandType<span style="color: #000000;">&#93;</span><span style="color: #800000;">&quot;StoredProcedure&quot;</span>
<span style="color: #800080;">$cmd</span>.CommandText<span style="color: pink;">=</span> <span style="color: #800080;">$query</span>
<span style="color: #800080;">$null</span> <span style="color: pink;">=</span> <span style="color: #800080;">$cmd</span>.Parameters.Add<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;@TVP&quot;</span><span style="color: pink;">,</span> <span style="color: #000000;">&#91;</span>System.Data.SqlDbType<span style="color: #000000;">&#93;</span>::Structured<span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$cmd</span>.Parameters<span style="color: #000000;">&#91;</span><span style="color: #800000;">&quot;@TVP&quot;</span><span style="color: #000000;">&#93;</span>.Value <span style="color: pink;">=</span> <span style="color: #800080;">$dt</span>
&nbsp;
<span style="color: #008000;">#Create and fill dataset</span>
<span style="color: #800080;">$ds</span><span style="color: pink;">=</span><span style="color: #008080; font-weight: bold;">New-Object</span> system.Data.DataSet
<span style="color: #800080;">$da</span><span style="color: pink;">=</span><span style="color: #008080; font-weight: bold;">New-Object</span> system.Data.SqlClient.SqlDataAdapter<span style="color: #000000;">&#40;</span><span style="color: #800080;">$cmd</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$null</span> <span style="color: pink;">=</span> <span style="color: #800080;">$da</span>.fill<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ds</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$conn</span>.Close<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;">#Return results</span>
<span style="color: #800080;">$ds</span>.Tables</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2012/04/table-valued-parameter-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Gaining SQL Server SysAdmin Access</title>
		<link>http://sev17.com/2011/10/gaining-sql-server-sysadmin-access/</link>
		<comments>http://sev17.com/2011/10/gaining-sql-server-sysadmin-access/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 19:51:18 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[schtasks]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10748</guid>
		<description><![CDATA[I’ve seen this come a few times at work and I’m sure most you have experienced something similar. Someone or an application installs SQL Server, doesn’t grant access to the DBA group and asks for DBA support. In SQL Server 2008 and higher the built-in local administrators group is no longer automatically part of the...]]></description>
			<content:encoded><![CDATA[<p>I’ve seen this come a few times at work and I’m sure most you have experienced something similar.</p>
<blockquote><p>Someone or an application installs SQL Server, doesn’t grant access to the DBA group and asks for DBA support.</p></blockquote>
<p>In SQL Server 2008 and higher the built-in local administrators group is no longer automatically part of the SQL Server sysadmin role. You should add necessary logins to the sysadmin role as part of your SQL Server installation. Not automatically granting local administrators access to SQL Server is generally a good thing, however when the SQL Server installation is done by say another application then we see issues were support groups do not have access to SQL Server even though they are local administrators on the box. In the last few months I’ve seen this scenario several times and so has Argenis Fernandez (<a href="http://sqlblog.com/blogs/argenis_fernandez/default.aspx" target="_blank">blog</a>|<a href="http://twitter.com/#!/DBArgenis" target="_blank">twitter</a>) as he has a helpful blog post entitled&#160; “<a href="http://sqlblog.com/blogs/argenis_fernandez/archive/2011/07/10/think-your-windows-administrators-don-t-have-access-to-sql-server-2008-by-default-think-again.aspx" target="_blank">Think Your Windows Administrators Don’t Have Access to SQL Server 2008 by Default? Think Again</a>.”&#160; The post describes a technique of using the Sysinternals tool <a href="http://technet.microsoft.com/en-us/sysinternals/bb897553" target="_blank">PsExec</a> to gain SQL sysadmin access to SQL Server on which you already have local administrator access. The&#160; post also links to a documented way of starting SQL Server in single user mode in order to gain SQL Server sysadmin access (see “<a href="http://msdn.microsoft.com/en-us/library/dd207004.aspx" target="_blank">Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out</a>).” And finally the post mentions, but does not demonstrate a method of using the Windows Task Scheduler. If you’re interested in the how’s and why’s this works and how different versions of SQL Servers are well, different in security settings defaults I encourage you to give the post and comments a read.</p>
<p>Armed with information on how to gain SQL Server administration I looked at the various options. The psexec utility is blacklisted in my environment, blocked from download and listed as an untrusted application. The approach of starting SQL Server in single user mode requires taking SQL Server down and since the application is a quasi-production system restarting SQL Server would have to be coordinated or done after hours. So, I chose to to use the Windows Scheduler trick. This should work on Windows 2003/XP and higher and I’ve tested on Windows 2008 and Windows 7. The typical UAC things apply—you’ll need to run as administrator. The script I came up with is listed below. I figured if I’m getting a server were some other group performed the installation or configuration there’s no guarantee PowerShell will be installed, so I’m going old school Windows batch file on this. It feels wrong to post a Windows batch file&#160; instead of a Powershell script on my blog, but I think using a batch file is the best approach for the problem. To use, save the script as AddDBA.bat and see the example syntax. The script must be run locally.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> off
<span style="color: #33cc33;">@</span><span style="color: #00b100; font-weight: bold;">if</span> &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">1</span>&quot;==&quot;?&quot; <span style="color: #00b100; font-weight: bold;">goto</span> Syntax
<span style="color: #33cc33;">@</span><span style="color: #00b100; font-weight: bold;">if</span> &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">1</span>&quot;==&quot;&quot;  <span style="color: #00b100; font-weight: bold;">goto</span> Syntax
<span style="color: #33cc33;">@</span><span style="color: #00b100; font-weight: bold;">if</span> &quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">2</span>&quot;==&quot;&quot;  <span style="color: #00b100; font-weight: bold;">goto</span> Syntax
<span style="color: #808080; font-style: italic;">rem **********************************</span>
<span style="color: #808080; font-style: italic;">rem Script AddDBA.bat</span>
<span style="color: #808080; font-style: italic;">rem Creation Date: 10/21/2011</span>
<span style="color: #808080; font-style: italic;">rem Last Modified: 10/21/2011</span>
<span style="color: #808080; font-style: italic;">rem Author: Chad Miller</span>
<span style="color: #808080; font-style: italic;">rem ***********************************</span>
<span style="color: #808080; font-style: italic;">rem Description: Adds a Windows Account to SQL Sysadmin Role</span>
<span style="color: #808080; font-style: italic;">rem Use when you have local Windows admin access but lost SQL Sysadmin access</span>
<span style="color: #808080; font-style: italic;">rem ***********************************</span>
&nbsp;
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> ************************
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> *** ServerInstance: <span style="color: #33cc33;">%</span><span style="color: #448888;">1</span>
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> ************************
<span style="color: #b1b100; font-weight: bold;">set</span> TMPFILE=<span style="color: #33cc33;">%</span><span style="color: #448888;">TMP</span><span style="color: #33cc33;">%</span>\AddDBA-<span style="color: #33cc33;">%</span><span style="color: #448888;">RANDOM</span><span style="color: #33cc33;">%</span>-<span style="color: #33cc33;">%</span><span style="color: #448888;">TIME:~6,5</span><span style="color: #33cc33;">%</span>.tmp
schtasks  /Create /TN AddDBA /SC Once /ST 12:00 ^
/TR &quot;sqlcmd -S <span style="color: #33cc33;">%</span><span style="color: #448888;">1</span> -Q \&quot;CREATE LOGIN [<span style="color: #33cc33;">%</span><span style="color: #448888;">2</span>] FROM WINDOWS; EXEC sp_addsrvrolemember [<span style="color: #33cc33;">%</span><span style="color: #448888;">2</span>],[sysadmin];\&quot; -o \&quot;<span style="color: #33cc33;">%</span><span style="color: #448888;">TMPFILE</span><span style="color: #33cc33;">%</span>\&quot; -e&quot; ^
/RU &quot;NT AUTHORITY\SYSTEM&quot; /F
schtasks /Run /TN AddDBA
schtasks /Query /TN AddDBA /V /FO List
<span style="color: #808080; font-style: italic;">rem Wait 5 seconds</span>
PING 127.0.0.1 -n 6  <span style="color: #33cc33;">&gt;</span><span style="color: #0000ff; font-weight: bold;">NUL</span>
<span style="color: #808080; font-style: italic;">rem Display output file</span>
type <span style="color: #33cc33;">%</span><span style="color: #448888;">TMPFILE</span><span style="color: #33cc33;">%</span>
schtasks /Delete /TN AddDBA /F
<span style="color: #00b100; font-weight: bold;">goto</span> :<span style="color: #b100b1; font-weight: bold;"><span style="color: #00b100; font-weight: bold;">EXIT</span></span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;">Syntax</span>
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> Syntax: AddDBA ServerInstance WindowsGroupOrLogin
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> Example: AddDBA Z001\SQL1 Contoso\DBAGroup
<span style="color: #00b100; font-weight: bold;">goto</span> :<span style="color: #b100b1; font-weight: bold;"><span style="color: #00b100; font-weight: bold;">EXIT</span></span>
&nbsp;
:<span style="color: #b100b1; font-weight: bold;"><span style="color: #00b100; font-weight: bold;">EXIT</span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2011/10/gaining-sql-server-sysadmin-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Managing AlwaysOn with Powershell</title>
		<link>http://sev17.com/2011/09/managing-alwayson-with-powershell/</link>
		<comments>http://sev17.com/2011/09/managing-alwayson-with-powershell/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 22:46:32 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[AlwaysOn]]></category>
		<category><![CDATA[sqlps]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10742</guid>
		<description><![CDATA[Although you can use SQL Server Management Studio or T-SQL to manage AlwaysOn, SQL Server Denali CTP 3 includes 25 cmdlet which together provide complete coverage for creating, confiiguring and administering the AlwaysOn database feature. In this post we’ll look at using Powershell to perform various management tasks for AlwayOn. Note: This blog post describes...]]></description>
			<content:encoded><![CDATA[<p>Although you can use SQL Server Management Studio or T-SQL to manage AlwaysOn, SQL Server Denali CTP 3 includes 25 cmdlet which together provide complete coverage for creating, confiiguring and administering the AlwaysOn database feature. In this post we’ll look at using Powershell to perform various management tasks for AlwayOn.</p>
<p><em><font color="#ff0000">Note: This blog post describes features in SQL Server Denali CTP 3 which may change on final product release.</font></em></p>
<h2>Getting Started</h2>
<p>You’ll need&#160; a simple Windows 2008 R2 cluster with two standalone installs of SQL Server. I say simple because you don’t have to worry about shared storage, quorum disks and shared MSTDTC installations like you would in a traditional SQL Server installation on a Windows Server Failover Cluster. All you need are two servers running Windows Server 2008 R2 Enterprise Edition. For test purposes I’ve setup a two-node Windows Server Failover Cluster as follows:</p>
<p>1. Configure a Private virtual machine network for intra-cluster communication. Note this step is optional and not really necessary for a bare minimum cluster, but I setup it up anyways to mimic close to what I’ll have in production. This network uses a separate IP subnet than the Internal only network I had already setup in Hyper-V. </p>
<p>2. Setup the private only network&#160; which allows communication between virtual machines only.</p>
<ol>
<li>Right-click virtual machine </li>
<li>Select Virtual Network Manager &gt; Select Private &gt; Add </li>
</ol>
<p><a href="http://sev17.com/wp-content/uploads/VirtualNetworkManager.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="VirtualNetworkManager" border="0" alt="VirtualNetworkManager" src="http://sev17.com/wp-content/uploads/VirtualNetworkManager_thumb.png" width="244" height="146" /></a></p>
<p>3. Add the private network to each of the virtual machines. </p>
<ol>
<ol>
<li>Shutdown each machine </li>
<li>Select machine in Hyper-V Manager </li>
<li>Select Settings </li>
<li>Select Add Hardware and choose Network Adapter and click Add </li>
<li>Select the private network you created from the Network drop down list and click OK </li>
</ol>
</ol>
<p><a href="http://sev17.com/wp-content/uploads/AddNetwork.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="AddNetwork" border="0" alt="AddNetwork" src="http://sev17.com/wp-content/uploads/AddNetwork_thumb.png" width="244" height="146" /></a></p>
<p>4. On the virtual machines assign IP addresses under Network and Sharing Center. Here’s a table of my setup:</p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="133"><strong>Machine</strong></td>
<td valign="top" width="133"><strong>Internal Network</strong></td>
<td valign="top" width="133"><strong>Private Network</strong></td>
</tr>
<tr>
<td valign="top" width="133">Node1</td>
<td valign="top" width="133">192.168.1.71</td>
<td valign="top" width="133">192.1.1.2</td>
</tr>
<tr>
<td valign="top" width="133">Node2</td>
<td valign="top" width="133">192.168.1.72</td>
<td valign="top" width="133">192.1.13</td>
</tr>
<tr>
<td valign="top" width="133">DC1</td>
<td valign="top" width="133">192.168.1.50</td>
<td valign="top" width="133">N/A</td>
</tr>
<tr>
<td valign="top" width="133">Clusterxm*</td>
<td valign="top" width="133">192.168.1.70</td>
<td valign="top" width="133">N/A</td>
</tr>
<tr>
<td valign="top" width="133">Availability Group* Listener</td>
<td valign="top" width="133">192.168.1.73</td>
<td valign="top" width="133">N/A</td>
</tr>
</tbody>
</table>
<p>DC1= Domain Controller</p>
<p>Cluster1 = cluster management IP (assigned during cluster configuration)</p>
<p>Availability Group Listener (assigned during AlwaysOn&#160; Availability Group Listener configuration)</p>
<p>*Don’t worry about these for now.</p>
<p>5. Since we’re using a two-node cluster without a quorum disk it is suggested to use a Node and File Share Majority so I’ll setup network share which is read/write accessible by the Cluster Service account. For my testing purposes I created share on my DC1 machine called \\DC1\Share1 located on DC1 C:\Share1 folder.</p>
<h2>Setting Up Windows Failover Clustering</h2>
<p>1.&#160; Add the Failover Cluster Manage feature to both modes by running the following&#160; PowerShell commands</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">import<span style="color: pink;">-</span>module ServerManager
Add<span style="color: pink;">-</span>WindowsFeature <span style="color: #008080; font-style: italic;">-Name</span> Failover<span style="color: pink;">-</span>Clustering</pre></div></div>

<p>2. Create the cluster by running the following PowerShell commands on one node:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">import<span style="color: pink;">-</span>module FailoverClusters
new<span style="color: pink;">-</span>cluster clusterxm <span style="color: pink;">-</span>Node node1<span style="color: pink;">,</span>node2 <span style="color: pink;">-</span>StaticAddress 192.168.1.70 <span style="color: pink;">-</span>NoStorage</pre></div></div>

<p>3. Set the quorum mode to Node and File Share Majority by running the following command on one node:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"> Set<span style="color: pink;">-</span>ClusterQuorum <span style="color: pink;">-</span>NodeAndFileShareMajority <span style="color: #800000;">&quot;\\DC1\share1&quot;</span></pre></div></div>

<h2>Install SQL Server on Both Nodes</h2>
<p>Install SQL Server and this important – <strong>As a standalone instance. </strong>Sorry no Powershell commands here just run through the installation screens. Be sure to set the SQL Server service account to a domain account (I had issues when using Local System). </p>
<p><a href="http://sev17.com/wp-content/uploads/DenaliInstall.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="DenaliInstall" border="0" alt="DenaliInstall" src="http://sev17.com/wp-content/uploads/DenaliInstall_thumb.png" width="244" height="184" /></a></p>
<h2>Database Prerequisites</h2>
<p>You need to have a database which is not already part of an AlwaysOn Availability Group in FULL recovery mode and has been backed up. As a test I’ll just use the <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=23654" target="_blank">old school pubs sample database</a>. Run the instpubs.sql file and create a backup using Powershell.</p>
<p>Start SQL Server Management Studio and select “Start PowerShell” from Object Explorer. Run the following command to backup the database to the default backup directory:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\Databases\pubs<span style="color: pink;">&gt;</span> Backup<span style="color: pink;">-</span>SqlDatabase <span style="color: pink;">-</span>Database pubs</pre></div></div>

<p>You’ll need to create a share accessible by both nodes for storing the SQL Server database and transaction log initialization backups. For my example I’ll create a folder called sqlrec under Node1’s C drive C:\sqlrec and share named sqlrec \\node1\sqlrec</p>
<h2>AlwaysOn Powershell Documentation</h2>
<p>The CTP3 version of Books Online contains some documentation and scripts for configuring AlwaysOn however as to be expected with pre-release software some topics are not covered and there are documentation errors in other sections. As I’ve encountered documentation errors I&#160; submitted Connect Items&#160; (see Connect Items below for details).&#160; Relevant helps topics included in CTP3 are listed below:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ff878441(v=sql.110).aspx" target="_blank">Specify the Endpoint URL When Adding or Modifying an Availability Replica</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/ff878259(v=SQL.110).aspx" target="_blank">Enable and Disable AlwaysOn</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/gg492181(v=SQL.110).aspx" target="_blank">Create and Configure an Availability Group</a></p>
<p>Rather than use the scripts includes with Books Online which only handle part of the configuration or write my own script I think its more important to demonstrate the commands to create and configure AlwaysOn. By approaching Powershell as simply running command versus vs. writing a script you’ll learn how to use Powershell commands for new administration functions. Once you’re happy with the results of the commands you then can turn the series of commands into a script. Let’s get started…</p>
<h2>Using Powershell to Create and Configure AlwaysOn</h2>
<p><em>Note: The following examples work within the SQLServer provider while connected to specific SQL Server machines. In my example I’m using machines named node1 and node2&#160; running a default instance. Pay particular attention to the context in which the commands are run on either Node1 (primary) or Node2 (secondary).</em></p>
<h3>Enable HADRService on both nodes:</h3>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> Enable<span style="color: pink;">-</span>SqlHADRService <span style="color: pink;">-</span>ServerInstance NODE1 <span style="color: #008080; font-style: italic;">-force</span>
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> Enable<span style="color: pink;">-</span>SqlHADRService <span style="color: pink;">-</span>ServerInstance NODE2 <span style="color: #008080; font-style: italic;">-force</span></pre></div></div>

<p><em>Note: The force switch. Enabling or disabling HADR requires SQL Server service to be restarted. If you omit the force switch you’ll be prompted to confirm SQL Server restart.</em></p>
<h3>Optionally confirm HADRService enabled on both nodes:</h3>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">get-item</span> . <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> IsHadrEnabled
&nbsp;
IsHadrEnabled
<span style="color: pink;">-------------</span>
True
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">pushd</span>
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> SQLServer:\SQL\NODE2\DEFAULT
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">get-item</span> . <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> IsHadrEnabled
&nbsp;
IsHadrEnabled
<span style="color: pink;">-------------</span>
True
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">popd</span></pre></div></div>

<p><em>Note: In order to retrieve the IsHadrEnabled property I need to to cd to node2&#160; and in order to easily change directories back I’m using the pushd and popd commands to store the current location (pushd) and switch back (popd).</em></p>
<h3>Configure HADR Endpoints</h3>
<p>Configure HADR Endpoints and set state to started:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> .\Endpoints
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\Endpoints<span style="color: pink;">&gt;</span> New<span style="color: pink;">-</span>SqlHADREndpoint <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;hadr_endpoint&quot;</span> <span style="color: pink;">-</span>Port <span style="color: #804000;">5022</span>
&nbsp;
Name
<span style="color: pink;">----</span>
hadr_endpoint
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\Endpoints<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> Set<span style="color: pink;">-</span>SqlHADREndpoint <span style="color: pink;">-</span>State <span style="color: #800000;">&quot;Started&quot;</span>
&nbsp;
Name
<span style="color: pink;">----</span>
hadr_endpoint
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\Endpoints<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> SQLServer:\SQL\NODE2\DEFAULT\Endpoints
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT\Endpoints<span style="color: pink;">&gt;</span> New<span style="color: pink;">-</span>SqlHADREndpoint <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;hadr_endpoint&quot;</span> <span style="color: pink;">-</span>Port <span style="color: #804000;">5022</span>
&nbsp;
Name
<span style="color: pink;">----</span>
hadr_endpoint
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT\Endpoints<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> Set<span style="color: pink;">-</span>SqlHADREndpoint <span style="color: pink;">-</span>State <span style="color: #800000;">&quot;Started&quot;</span>
&nbsp;
Name
<span style="color: pink;">----</span>
hadr_endpoint</pre></td></tr></table></div>

<h3>Backup Database and Transaction Log</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT\Endpoints<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> SQLServer:\SQL\NODE1\DEFAULT
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> Backup<span style="color: pink;">-</span>SqlDatabase pubs \\NODE1\sqlrec\pubs.bak
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> Backup<span style="color: pink;">-</span>SqlDatabase pubs \\NODE1\sqlrec\pubs.trn <span style="color: pink;">-</span>BackupAction Log</pre></td></tr></table></div>

<h3>Create Replicas</h3>
<p>Note: This doesn’t actually create the replicate, rather the –AsTemplate parameter allows you to create a definition of the replica which is stored in the $replica1 and $replica2 variables. These variables will be used when creating the availability group next.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #800080;">$replica1</span> <span style="color: pink;">=</span> New<span style="color: pink;">-</span>SqlAvailabilityReplica <span style="color: #008080; font-style: italic;">-Name</span> NODE1 <span style="color: pink;">-</span>EndpointURL <span style="color: #800000;">&quot;TCP://NODE1:5022&quot;</span> <span style="color: pink;">-</span>AsTemplate <span style="color: pink;">-</span>AvailabilityMode SynchronousCommit <span style="color: pink;">-</span>FailoverMode Automatic  <span style="color: pink;">-</span>ConnectionModeInSecondaryRole AllowAllConnections
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #800080;">$replica2</span> <span style="color: pink;">=</span> New<span style="color: pink;">-</span>SqlAvailabilityReplica <span style="color: #008080; font-style: italic;">-Name</span> NODE2 <span style="color: pink;">-</span>EndpointURL <span style="color: #800000;">&quot;TCP://NODE2:5022&quot;</span> <span style="color: pink;">-</span>AsTemplate <span style="color: pink;">-</span>AvailabilityMode SynchronousCommit <span style="color: pink;">-</span>FailoverMode Automatic <span style="color: pink;">-</span>ConnectionModeInSecondaryRole AllowAllConnections</pre></td></tr></table></div>

<h3>Create Availability Group</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> New<span style="color: pink;">-</span>SqlAvailabilityGroup AVGPubs <span style="color: pink;">-</span>AvailabilityReplica <span style="color: #000000;">&#40;</span><span style="color: #800080;">$replica1</span><span style="color: pink;">,</span><span style="color: #800080;">$replica2</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span>Database pubs
&nbsp;
Name                 PrimaryReplicaServerName
<span style="color: pink;">----</span>                 <span style="color: pink;">------------------------</span>
AVGPubs              NODE1</pre></td></tr></table></div>

<h3>Join Availability Group on Secondary Node</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">pushd</span>
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> SQLServer:\SQL\NODE2\DEFAULT
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> Join<span style="color: pink;">-</span>SqlAvailabilityGroup <span style="color: #008080; font-style: italic;">-Name</span> AVGPubs
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">popd</span></pre></td></tr></table></div>

<h3>Optionally Verify Availability Groups</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> .\AvailabilityGroups
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> <span style="color: #008080; font-style: italic;">-ExpandProperty</span> AvailabilityReplicas <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> name<span style="color: pink;">,</span> ConnectionModeInPrimaryRole<span style="color: pink;">,</span> ConnectionModeInSecondaryRole
&nbsp;
Name                                                ConnectionModeInPrimaryRole           ConnectionModeInSecondaryRole
<span style="color: pink;">----</span>                                                <span style="color: pink;">---------------------------</span>           <span style="color: pink;">-----------------------------</span>
NODE1                                                       AllowAllConnections                     AllowAllConnections
NODE2                                                       AllowAllConnections                     AllowAllConnections</pre></td></tr></table></div>

<h3>Restore Database and Transaction Log On Secondary Node</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> SQLServer:\SQL\NODE2\DEFAULT
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> Restore<span style="color: pink;">-</span>SqlDatabase pubs \\NODE1\sqlrec\pubs.bak  <span style="color: pink;">-</span>NoRecovery
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> Restore<span style="color: pink;">-</span>SqlDatabase pubs \\NODE1\sqlrec\pubs.trn  <span style="color: pink;">-</span>RestoreAction <span style="color: #800000;">&quot;Log&quot;</span> <span style="color: pink;">-</span>NoRecovery</pre></td></tr></table></div>

<h3>Add Database to Availability Group on Secondary Node</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> .\AvailabilityGroups
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> Add<span style="color: pink;">-</span>SqlAvailabilityDatabase <span style="color: pink;">-</span>Database pubs</pre></td></tr></table></div>

<h3>Create Availability Group Listener</h3>
<p><em>Note: This is what you connect to (or a least that’s my impression) from your client machines. The listener provides a network name and IP Address which will failover between nodes.</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">cd</span> SQLSERVER:\
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\<span style="color: pink;">&gt;</span> New<span style="color: pink;">-</span>SqlAvailabilityGroupListener <span style="color: #008080; font-style: italic;">-Name</span> Network1 <span style="color: pink;">-</span>StaticIp 192.168.1.73<span style="color: pink;">/</span>255.255.255.0 <span style="color: #008080; font-style: italic;">-path</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs
Name                 PortNumber      ClusterIPConfiguration
<span style="color: pink;">----</span>                 <span style="color: pink;">----------</span>      <span style="color: pink;">----------------------</span>
Network1             <span style="color: #804000;">1433</span>            <span style="color: #000000;">&#40;</span><span style="color: #800000;">'IP Address: 192.168.1.73'</span><span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

<h3>Optionally Verify Listener Connectivity</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span>cd SQLSERVER:\SQL\NODE1\DEFAULT
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> Invoke<span style="color: pink;">-</span>Sqlcmd <span style="color: pink;">-</span>ServerInstance Network1 <span style="color: pink;">-</span>Database master <span style="color: #008080; font-style: italic;">-Query</span> <span style="color: #800000;">&quot;select @@servername&quot;</span>
WARNING: Using provider context. Server <span style="color: pink;">=</span> NODE1.
&nbsp;
Column1
<span style="color: pink;">-------</span>
NODE1</pre></td></tr></table></div>

<h3>Determine AlwaysOn Health</h3>
<p>SQL Server includes three cmdlets for verifying the health of the various AlwaysOn components:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">get-command</span> <span style="color: pink;">-</span>module sqlps <span style="color: #008080; font-style: italic;">-Name</span> test<span style="color: pink;">-*</span>
&nbsp;
CommandType     Name                                                Definition
<span style="color: pink;">-----------</span>     <span style="color: pink;">----</span>                                                <span style="color: pink;">----------</span>
Cmdlet          Test<span style="color: pink;">-</span>SqlAvailabilityGroup                           Test<span style="color: pink;">-</span>SqlAvailabilityGroup <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span><span style="color: #008080; font-style: italic;">-Path</span><span style="color: #000000;">&#93;</span> <span style="color: pink;">&lt;</span>string   <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: pink;">&gt;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#91;</span>...
Cmdlet          Test<span style="color: pink;">-</span>SqlAvailabilityReplica                         Test<span style="color: pink;">-</span>SqlAvailabilityReplica <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span><span style="color: #008080; font-style: italic;">-Path</span><span style="color: #000000;">&#93;</span> <span style="color: pink;">&lt;</span>string   <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: pink;">&gt;</span><span style="color: #000000;">&#93;</span>...
Cmdlet          Test<span style="color: pink;">-</span>SqlDatabaseReplicaState                        Test<span style="color: pink;">-</span>SqlDatabaseReplicaState <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#91;</span><span style="color: #008080; font-style: italic;">-Path</span><span style="color: #000000;">&#93;</span> <span style="color: pink;">&lt;</span>string   <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: pink;">&gt;</span>...</pre></td></tr></table></div>

<p>The easiest way to run the test cmdlets is within the SQL Server provider context as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> .\AvailabilityGroups
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> Test<span style="color: pink;">-</span>SqlAvailabilityGroup
&nbsp;
HealthState            Name
<span style="color: pink;">-----------</span>            <span style="color: pink;">----</span>
Healthy                AVGPubs
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> .\AVGPubs\AvailabilityReplicas <span style="color: pink;">|</span> Test<span style="color: pink;">-</span>SqlAvailabilityReplica
&nbsp;
HealthState            AvailabilityGroup    Name
<span style="color: pink;">-----------</span>            <span style="color: pink;">-----------------</span>    <span style="color: pink;">----</span>
Healthy                AVGPubs              NODE1
Healthy                AVGPubs              NODE2
&nbsp;
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> .\AVGPubs\DatabaseReplicaStates <span style="color: pink;">|</span> Test<span style="color: pink;">-</span>SqlDatabaseReplicaState
&nbsp;
HealthState            AvailabilityGroup    AvailabilityReplica  Name
<span style="color: pink;">-----------</span>            <span style="color: pink;">-----------------</span>    <span style="color: pink;">-------------------</span>  <span style="color: pink;">----</span>
Healthy                AVGPubs              NODE1                pubs
Healthy                AVGPubs              NODE2                pubs</pre></td></tr></table></div>

<h3>Manually Failing Over an Availability Group</h3>
<p>To manually fail over an Availability Group we use the Switch-SqlAvailabilityGroup cmdlet. Interestingly enough I could not figure out a way to fail over the availability resource using the GUI in CTP3, so Powershell is the only way to I could do this for now which is fine by me <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sev17.com/wp-content/uploads/wlEmoticon-smile1.png" /></p>
<p><em>Note: Be aware the context in which you run the Switch-SqlAvailabilityGroup cmdlet. The cmdlet should be run from whichever node is functioning as the secondary as we will see in a moment:</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups<span style="color: pink;">&gt;</span>cd AVGPubs
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> Switch<span style="color: pink;">-</span>SqlAvailabilityGroup</pre></td></tr></table></div>

<p>Running the switch-sqlavailabilityGroup command on the prmiary produces the following error:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">Switch<span style="color: pink;">-</span>SqlAvailabilityGroup : The local availability replica of availability <span style="color: #008080; font-weight: bold;">group</span> <span style="color: #800000;">'AVGPubs'</span> cannot accept signal <span style="color: #800000;">'FAIL
OVER_PENDING'</span> <span style="color: #0000FF;">in</span> its current role <span style="color: #800000;">'PRIMARY_NORMAL'</span> and state <span style="color: #000000;">&#40;</span>configuration is <span style="color: #0000FF;">in</span> Windows Server Failover Clustering st
ore<span style="color: pink;">,</span> local availability replica has joined<span style="color: #000000;">&#41;</span>.  The availability replica signal is invalid given the current replica role
.  Verify that the signal is permitted based on the current role of the local availability replica<span style="color: pink;">,</span> and retry the opera
tion.
At line:<span style="color: #804000;">1</span> char:<span style="color: #804000;">28</span>
<span style="color: pink;">+</span> Switch<span style="color: pink;">-</span>SqlAvailabilityGroup <span style="color: pink;">&lt;&lt;&lt;&lt;</span>
    <span style="color: pink;">+</span> CategoryInfo          : InvalidOperation: <span style="color: #000000;">&#40;</span>:<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#91;</span>Switch<span style="color: pink;">-</span>SqlAvailabilityGroup<span style="color: #000000;">&#93;</span><span style="color: pink;">,</span> SqlException
    <span style="color: pink;">+</span> FullyQualifiedErrorId : ExecutionFailed<span style="color: pink;">,</span>Microsoft.SqlServer.Management.PowerShell.Hadr.FailoverSqlAvailabilityGr
   oupCommand</pre></td></tr></table></div>

<p>At first I thought I had configured something incorrectly, but then was able to to failover the availability group through Failover Cluster Manager. It was then I realized this needs to be run from the context of the secondary node.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">pushd</span>
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> SQLSERVER:\SQL\NODE2\DEFAULT\AvailabilityGroups\AVGPubs
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> Switch<span style="color: pink;">-</span>SqlAvailabilityGroup
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE2\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">popd</span>
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> Switch<span style="color: pink;">-</span>SqlAvailabilityGroup</pre></td></tr></table></div>

<h3></h3>
<h2>Pausing and Resuming an Availability Group</h2>
<p>You can pause and then resume synchronization of the Always database using the suspend-SqlAvailabilityDatabase and Resume-SqlAvailabilityDatabase cmdlets:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">cd</span> .\AvailabilityDatabases
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs\AvailabilityDatabases<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> Suspend<span style="color: pink;">-</span>SqlAvailabilityDatabase
<span style="color: #008080; font-weight: bold;">PS</span> SQLSERVER:\SQL\NODE1\DEFAULT\AvailabilityGroups\AVGPubs\AvailabilityDatabases<span style="color: pink;">&gt;</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> Resume<span style="color: pink;">-</span>SqlAvailabilityDatabase</pre></td></tr></table></div>

<h2>Summary</h2>
<p>This post has demonstrated the Powershell cmdlets available to help you manage your AlwaysOn configuration. The commands could be used to build a reusable script to provide a consistent configuration of AlwaysOn. </p>
<p>My testing was completed on SQL Server CTP3 as I encountered documentation issues I logged Connect Items. I’ve included a list of Connect Items below. There are other issues with the documentation which I did not log because of missing documentation rather than documentation bugs. I think not having all the documentation complete is to be expected while a product is still in CTP.</p>
<p>I’ll save my commentary on the AlwaysOn cmdlets for a future post, but for now I will say I’m impressed with the coverage and ease of use provided by the AlwaysOn cmdlets and SQL Server provider.</p>
<h2>Connect Items</h2>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687148/determine-whether-alwayson-availability-groups-is-enabled" target="_blank">Determine Whether AlwaysOn Availability Groups is Enabled</a></p>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687149/enable-and-disable-alwayson-sql-server-documentation" target="_blank">Enable and Disable AlwaysOn (SQL Server) Documentation</a></p>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687153/create-and-configure-an-availability-group-sql-server-powershell-doc-error" target="_blank">Create and Configure an Availability Group (SQL Server PowerShell) Doc Error</a></p>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687156/new-sqlavailabilityreplica-cmdlt-allows-incompatible-settings" target="_blank">New-SqlAvailabilityReplica cmdlt Allows Incompatible settings</a></p>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687158/set-sqlavailabilityreplica-cmdlet-does-not-take-pipeline-input" target="_blank">Set-SqlAvailabilityReplica Cmdlet Does Not Take Pipeline input</a></p>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687166/new-sqlavailabilitygrouplistener-help-example-incorrect" target="_blank">New-SqlAvailabilityGroupListener Help Example Incorrect</a></p>
<p><a href="https://connect.microsoft.com/SQLServer/feedback/details/687168/creating-a-network-name-for-alwayson-availability-groups-obsolete" target="_blank">Creating a Network Name for AlwaysOn Availability Groups Obsolete</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2011/09/managing-alwayson-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Counting Licenses for VMs</title>
		<link>http://sev17.com/2011/06/counting-licenses-for-vms/</link>
		<comments>http://sev17.com/2011/06/counting-licenses-for-vms/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 01:12:57 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Licensing]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10682</guid>
		<description><![CDATA[This is old news, but I’ve had to explain SQL Server VM licensing to enough people recently that I thought I’d put together a post. In June 2009, Microsoft released an update to SQL Server licensing which can significantly lower TCO for SQL Server instances running under VMs for  not only Hyper-V, but also VMWare....]]></description>
			<content:encoded><![CDATA[<p>This is old news, but I’ve had to explain SQL Server VM licensing to enough people recently that I thought I’d put together a post.</p>
<p>In June 2009, Microsoft released an update to SQL Server licensing which can significantly lower TCO for SQL Server instances running under VMs for  not only Hyper-V, but also VMWare.</p>
<p><a href="http://download.microsoft.com/download/6/F/8/6F84A9FE-1E5C-44CC-87BB-C236BFCBA4DF/SQLServer2008_LicensingGuide.pdf" target="_blank">http://download.microsoft.com/download/6/F/8/6F84A9FE-1E5C-44CC-87BB-C236BFCBA4DF/SQLServer2008_LicensingGuide.pdf</a> is a good guide for helping here.</p>
<p>Microsoft S/W licensing like all software vendors is complex, so SQL Server virtualization licensing is best illustrated by looking at several examples:</p>
<p>Each scenario was calculated using the formulas in the referenced document ( starting on page 25)</p>
<h3>In scenario #1 &#8212; 1 processor needed.</h3>
<p><strong>A. Number of virtual processors supporting the VM &#8211; <em><span style="text-decoration: underline;">Answer here is 2</span></em></strong></p>
<p><strong>B. Number of cores per physical processor (if hyper-threading is off) OR number of threads per physical processor (if</strong></p>
<p><strong>hyper-threading is on) &#8211; <em><span style="text-decoration: underline;">Answer here is 4 </span></em></strong></p>
<p><strong>C. Number of physical processors – <em><span style="text-decoration: underline;">Answer here is 2</span></em></strong></p>
<p><strong> </strong></p>
<p><strong>So this plugs into the formula </strong></p>
<p><strong> </strong></p>
<p><strong>A / B = Number of licenses ( rounded up to whole number)</strong></p>
<p><strong> </strong></p>
<p><strong>2 / 4 =<span style="text-decoration: underline;"> 1 processor license needed.</span></strong></p>
<h3>Scenario # 2 &#8212; 1 processor license needed</h3>
<p><strong>A. Number of virtual processors supporting the VM &#8211; <em><span style="text-decoration: underline;">Answer here is 4</span></em></strong></p>
<p><strong>B. Number of cores per physical processor (if hyper-threading is off) OR number of threads per physical processor (if</strong></p>
<p><strong>hyper-threading is on) &#8211; <em><span style="text-decoration: underline;">Answer here is 8</span></em></strong></p>
<p><strong>C. Number of physical processors – <em><span style="text-decoration: underline;">Answer here is 4</span></em></strong></p>
<p><strong> </strong></p>
<p><strong>So this plugs into the formula </strong></p>
<p><strong> </strong></p>
<p><strong>A / B = Number of licenses ( rounded up to whole number)</strong></p>
<p><strong> </strong></p>
<p><strong>4 / 8 = <span style="text-decoration: underline;">1 processor license needed</span>.</strong></p>
<p><strong> </strong></p>
<h3>Scenario # 3 &#8211;1 processor license needed</h3>
<p><strong>A. Number of virtual processors supporting the VM &#8211; <em><span style="text-decoration: underline;">Answer here is 8</span></em></strong></p>
<p><strong>B. Number of cores per physical processor (if hyper-threading is off) OR number of threads per physical processor (if</strong></p>
<p><strong>hyper-threading is on) &#8211; <em><span style="text-decoration: underline;">Answer here is 8</span></em></strong></p>
<p><strong>C. Number of physical processors – <em><span style="text-decoration: underline;">Answer here is 4</span></em></strong></p>
<p><strong> </strong></p>
<p><strong>So this plugs into the formula </strong></p>
<p><strong> </strong></p>
<p><strong>A / B = Number of licenses ( rounded up to whole number)</strong></p>
<p><strong> </strong></p>
<p><strong>8 / 8 = <span style="text-decoration: underline;">1 processor license needed</span>.</strong></p>
<p>Microsoft has provided generous virtualization licensing which means a VCPU isn’t equal to a processor and in fact is significantly less. Looking at scenario #3 allocating 8 VCPU ‘s is equal one processor license!</p>
<h2>How Does SQL Server VM licensing compare to Oracle and IBM?</h2>
<p>I think it’s important to point out I am in no way a Microsoft zealot nor I am simply bashing non-Microsoft products. I consider myself a customer of each vendor and virtualization licensing is just one of many factors which should be considered in selecting a vendor along with product capabilities, cost, and skill set of people working on it.</p>
<p>What follows is my summary of  how Oracle and IBM address virtualization licensing provided for comparison purposes to Microsoft. These are my opinions only and you should seek the advice of  licensing experts whenever choosing a licensing strategy with any vendor.</p>
<h2>Oracle</h2>
<p>Oracle does not recognize virtualization—or at least most forms of virtualization not their own. Oracle has taken a tough stance on virtualization when compared to Microsoft and IBM as described in their own licensing documents. Oracle differentiates between what they call soft partitioning and hard partitioning.</p>
<p>Here’s an excerpt from Oracle licensing doc <a href="http://www.oracle.com/us/corporate/pricing/specialty-topics/index.html" target="_blank">http://www.oracle.com/us/corporate/pricing/specialty-topics/index.html</a> in regard to virtualization. Oracle Virtual Machine (OVM) and Solaris Containers are recognized as “hard partitioning” while VMWare is consider “soft partitioning” and is not.</p>
<blockquote><p>Approved hard partitioning technologies include: Dynamic System Domains (DSD) &#8212; enabled by Dynamic Reconfiguration (DR), Solaris 10 Containers (capped Containers only), LPAR (adds DLPAR with AIX 5.2), Micro-Partitions (capped partitions only), vPar, nPar, Integrity Virtual Machine (capped partitions only), Secure Resource Partitions (capped partitions only), Static Hard Partitioning, Fujitsu’s PPAR. Oracle VM can also be used as hard partitioning technology only as described in the following document: <span style="text-decoration: underline;"><a href="http://www.oracle.com/technology/tech/virtualization/pdf/ovm-hardpart.pdf" target="_blank">http://www.oracle.com/technology/tech/virtualization/pdf/ovm-hardpart.pdf</a></span>.</p></blockquote>
<p>This is why you aren’t seeing a lot of virtualization in Oracle. As an example you can use VMWare (there may be some support issues to consider), but because VMWare is a soft partition in Oralce’s view you’d need to license the entire VMWare cluster in order to virtualize a single Oracle server or use one of the hard partitioning technologies described above. One thing I find interesting is that OVM is a Xen based hypervisor which is similar to VMWare yet one’s considered hard partitioning and the other soft partitioning. Needless to say as an Oracle customer I’m not happy with their virtualization licensing stance. As more and more Oracle customers move to virtualization I don’t think this is a sustainable strategy. It  is my belief due to customer demand at some point Oracle will need to change its stance on virtualization.</p>
<h2>IBM</h2>
<p>IBM recognizes virtualization capacity licensing, now IBM licenses on a per core basis instead of a per socket basis like SQL Server. Generally a VCPU is equal to one core, but may not be. See the licensing documentation for specific virtualization technology guidance:</p>
<p><a href="http://www-01.ibm.com/software/lotus/passportadvantage/Counting_Software_licenses_using_specific_virtualization_technologies.html" target="_blank">IBM Virtualization Capacity License Counting Rules</a></p>
<p>Keep in mind IBM uses something called Processor Value Units or PVU’s when calculating licensing. different processor chips may have different PVU multipliers. As an example there’s a higher PVU for Nehalem or higher processors than pre-Nehalem on the Intel platform. The PVU calculations are used in determining virtualization licensing. See <a href="http://www-01.ibm.com/software/lotus/passportadvantage/pvu_licensing_for_customers.html">http://www-01.ibm.com/software/lotus/passportadvantage/pvu_licensing_for_customers.html</a> for further information.</p>
<h2>Summary</h2>
<p>Microsoft provides a generous interpretation on virtualization licensing when compared to their competitors. It should be noted one thing I didn’t discuss is the scenario where you license the entire virtualization hosts (physical cluster). My understanding is that this is an acceptable licensing scenario with Microsoft, IBM or Oracle (again check with the vendor). When licensing an entire cluster you’re able to setup an “all you can eat” scenario where you can deploy as many VM’s you want without having to license at the VM level even if you don’t do this on the database-level it may make sense to do so on the operating system level.</p>
<p>Software licensing is complex subject with any vendor so if there are any clarifications, omissions, or anything I misstated, please post a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2011/06/counting-licenses-for-vms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>What&#8217;s Going on with SQL Server Service Account Changes?</title>
		<link>http://sev17.com/2010/12/whats-going-on-with-sql-server-service-account-changes/</link>
		<comments>http://sev17.com/2010/12/whats-going-on-with-sql-server-service-account-changes/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 03:44:27 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[Account Change]]></category>
		<category><![CDATA[SQL Myth]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10517</guid>
		<description><![CDATA[For years we’ve been told you should use Enterprise Manager in SQL Server 2000 or SQL Server Configuration Manager in SQL 2005 or higher to change the SQL Service account. Why you may ask well, because according to the documentation Configuration Manager does “magic” stuff to re-ACL things for the new account. I decided to...]]></description>
			<content:encoded><![CDATA[<p>For years we’ve been told you should use Enterprise Manager in SQL Server 2000 or SQL Server Configuration Manager in SQL 2005 or higher to change the SQL Service account. Why you may ask well, because according to the <a href="http://msdn.microsoft.com/en-us/library/ms143504.aspx" target="_blank">documentation</a> Configuration Manager does “magic” stuff to re-ACL things for the new account. I decided to put the notation that SQL Server files, folders or Registry keys get Re-ACL’d when Enterprise Manager (SQL 2000) or SQL Server Configuration Manager (SQL Server 2005 or higher) is used to change the SQL Server service account to a few tests…</p>
<h2>Setup</h2>
<ol>
<li>Use a test machine (even your local workstation or laptop will work)</li>
<li>Note: Since I’m using test machines the SQL instances were setup and running under Local System account and then changed to an AD account with no assigned permissions or groups other than the default AD Users group.</li>
<li>Create a test local or AD account, in my case I created an account named “ZZZ”</li>
<li>We’ll need the SID for the account when we dump the ACLs, from a PowerShell host obtain the SID for the account using the following commands:</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$domain</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;CORP&quot;</span>
<span style="color: #800080;">$user</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;ZZZ&quot;</span>
<span style="color: #800080;">$ntAccount</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> System.Security.Principal.NTAccount<span style="color: #000000;">&#40;</span><span style="color: #800080;">$domain</span><span style="color: pink;">,</span> <span style="color: #800080;">$user</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$sid</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ntAccount</span>.Translate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Security.Principal.SecurityIdentifier<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$sid</span>.value</pre></div></div>

<blockquote><p>For my account this returns:</p>
<p><strong>S-1-5-21-3799912004-3082830092-2763560395-1116</strong></p></blockquote>
<h2>The Tests</h2>
<ul>
<li>For SQL Server version 2000, 2005 and 2008 I’ll use the recommended utilities to change the service account.</li>
<li>I’ll then run a the following PowerShell commands to export the ACL&#8217;s for all SQL Server files, folders and registry keys:</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#FileSystem</span>
<span style="color: #008080; font-weight: bold;">cd</span> <span style="color: #800000;">&quot;C:\program files\Microsoft SQL Server&quot;</span>
<span style="color: #008080; font-weight: bold;">dir</span> <span style="color: #008080; font-style: italic;">-recurse</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">get-acl</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> pschildname<span style="color: pink;">,</span> owner<span style="color: pink;">,</span> sddl <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">export-csv</span> <span style="color: #008080; font-style: italic;">-NoTypeInformation</span> <span style="color: #008080; font-style: italic;">-Path</span> <span style="color: #800080;">$home</span>\sqlfile.csv
<span style="color: #008000;">#Registry</span>
<span style="color: #008080; font-weight: bold;">cd</span> <span style="color: #800000;">&quot;HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server&quot;</span>
<span style="color: #008080; font-weight: bold;">dir</span> <span style="color: #008080; font-style: italic;">-recurse</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">get-acl</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> pschildname<span style="color: pink;">,</span> owner<span style="color: pink;">,</span> sddl <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">export-csv</span> <span style="color: #008080; font-style: italic;">-NoTypeInformation</span> <span style="color: #008080; font-style: italic;">-Path</span> <span style="color: #800080;">$home</span>\sqlreg.csv</pre></div></div>

<p>Finally I’ll look for any ACL’s assigned to the SID of my new service account (<em>S-1-5-21-3799912004-3082830092-2763560395-1116).</em></p>
<h3>SQL Server 2000 Enterprise Manager</h3>
<ol>
<li>From SQL Server 2000 Enterprise Manager change the service account to the new account. The GUI will prompt for SQL service restart.</li>
<li>After SQL Server has restarted, run the PowerShell commands to export ACL’s as instructed in “The Tests” section.</li>
</ol>
<p><em>I’ve posted my output files SQL2K_sqlfilefull2.csv and SQL2K_sqlregfull2.csv in the <a href="http://wth5na.blu.livefilestore.com/y1pbemWC1gYhha9uUp8C-iqCeR98rkYTXkiHB9RePvaD8JhCWO_X8ru_7lQCNfDiiac1_9kTvPd_V8nS0lTKFT6VwppLQfOrqru/chgsvcacct.zip?download&amp;psid=1" target="_blank">accompanying download</a>.</em></p>
<p>Looking at the ACL’s in the CSV file we see, yes in fact Enterprise Manager did re-ACL both folders, files and registry keys. A typical entry includes the file/folder name and the following SDDL syntax with the service account’s SID:</p>
<p><strong>…(A;OICI;FA;;;S-1-5-21-3799912004-3082830092-2763560395-1116)…</strong></p>
<p>Checking off Enterprise, we’ll move to SQL 2005 and 2008…</p>
<h3>SQL Server Configuration Manager (2005/2008)</h3>
<p>Since the results of both SQL Server 2005 and 2008 were the same, I’ll summarize the steps and results together.</p>
<ol>
<li>From SQL Server Configuration Manager change the service account to the new account. The utility will prompt for a SQL Server restart.</li>
<li>After SQL Server restarts run the  PowerShell commands to export ACL’s as instructed in “The Tests” section.</li>
</ol>
<p><em>I’ve posted my output files SQL2K5_sqlfilefull2.csv, SQL2K8_sqlfilefull2.csv, and SQL2K5_sqlregfull2.csv and SQL2K8_sqlregfull2.csv in the <a href="http://wth5na.blu.livefilestore.com/y1pbemWC1gYhha9uUp8C-iqCeR98rkYTXkiHB9RePvaD8JhCWO_X8ru_7lQCNfDiiac1_9kTvPd_V8nS0lTKFT6VwppLQfOrqru/chgsvcacct.zip?download&amp;psid=1" target="_blank">accompanying download</a>.</em></p>
<p>This time, when we look at the ACL’s only two files show a change not in the permissions, but in the owner of the file ERRORLOG and log_*.trc (the current default trace file). The change in file ownership isn’t surprising as the new service account will create the files on restart which has nothing to do with re-ACL-ing. Also there aren’t any changes in ACL’s for the registry. <span style="text-decoration: line-through;">As an additional check I verified the service account wasn’t auto-magically added to any of the built-in Windows groups SQL Server 2005 or higher creates on the local machine</span>.<strong> EDIT: </strong><a class="wp-oembed" href="http://blogs.msdn.com/b/dtjones/archive/2010/12/15/changing-service-account-amp-service-account-password.aspx" target="_blank"><strong>Dan Jones posted a blog entry clarifying the behavior</strong></a><strong> which I verified in SQL Server 2005/Windows 2003 the account is added to SQLServer2005MSSQLUser% local group by SQLCM. As noted by Dan this is OS and SQL version specific behavior where if you are running pre-Vista (Windows 2003/XP) or SQL 2005 group membership is modified</strong>. <span style="text-decoration: line-through;">So, where’s the “magic” re-ACL-ing?</span></p>
<h2>Summary</h2>
<p>According to my tests none of the ACL’s were changed in SQL 2005 or higher while in SQL 2000 they were. So is the BOL documentation wrong or am I missing something? Or is the “Only use SQL Server Configuration Manager” directive a “SQL Myth?”</p>
<h1><a href="http://wth5na.blu.livefilestore.com/y1pbemWC1gYhha9uUp8C-iqCeR98rkYTXkiHB9RePvaD8JhCWO_X8ru_7lQCNfDiiac1_9kTvPd_V8nS0lTKFT6VwppLQfOrqru/chgsvcacct.zip?download&amp;psid=1" target="_blank">Download</a></h1>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2010/12/whats-going-on-with-sql-server-service-account-changes/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Scripting Guy Guest Blog Post</title>
		<link>http://sev17.com/2010/11/scripting-guy-guest-blog-post/</link>
		<comments>http://sev17.com/2010/11/scripting-guy-guest-blog-post/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 03:26:42 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[ScriptingGuy]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10457</guid>
		<description><![CDATA[Ed Wilson (Blog&#124;Twitter) aka Scripting Guy is kicking off a SQL Server week (Nov 1st 2010) with my guest blog post. The post, Use PowerShell to Collect Server Data and Write to SQL, demonstrates my number one use case for database related PowerShell activities—loading data into a SQL Server table. I’ve used the techniques described...]]></description>
			<content:encoded><![CDATA[<p>Ed Wilson (<a href="http://technet.microsoft.com/en-us/scriptcenter/default.aspx">Blog</a>|<a href="http://twitter.com/scriptingguys/">Twitter</a>) aka Scripting Guy is kicking off a SQL Server week (Nov 1st 2010) with my guest blog post. The post, <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/01/use-powershell-to-collect-server-data-and-write-to-sql.aspx" target="_blank">Use PowerShell to Collect Server Data and Write to SQL</a>, demonstrates my number one use case for database related PowerShell activities—loading data into a SQL Server table. I’ve used the techniques described in the post to build many solutions including:</p>
<ul>
<li>A <a href="http://sev17.com/2010/08/a-really-simple-data-dictionary/" target="_blank">data dictionary</a></li>
<li><a href="http://sev17.com/2009/10/sqlservercentral-article-on-database-space-capacity-planning/" target="_blank">Disk and database space forecasting</a></li>
<li><a href="http://sev17.com/2009/06/sqlservercentral-article-on-backup-monitoring-and-reporting/" target="_blank">Backup reporting</a></li>
</ul>
<p>Each problem comes down to one thing—get the data into a SQL Server database! Learn the basics and you can easily create your own PowerShell-based solutions.</p>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2010/11/scripting-guy-guest-blog-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Building A Remote Desktop Manager Cluster List</title>
		<link>http://sev17.com/2010/06/building-a-remote-desktop-manager-cluster-list/</link>
		<comments>http://sev17.com/2010/06/building-a-remote-desktop-manager-cluster-list/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 20:37:29 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[RDCMan]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10363</guid>
		<description><![CDATA[The Microsoft Clustering and High Availablity bloggers have taken noticed of the Remote Desktop Connection Manager (RDCMan) utility from a cluster management perspective. I&#8217;ve previously blogged about Building A Remote Desktop Manager Connection List from the SQL Server Central Management Server (CMS) tables. The RDCMan use case for cluster administration is very useful and it...]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://blogs.msdn.com/b/clustering/archive/2010/06/23/10028855.aspx">Microsoft Clustering and High Availablity bloggers</a> have taken noticed of the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=4603c621-6de7-4ccb-9f51-d53dc7e48047&amp;displaylang=en">Remote Desktop Connection Manager (RDCMan)</a> utility from a cluster management perspective. I&#8217;ve previously blogged about <a href="http://sev17.com/2010/06/building-a-remote-desktop-manager-connection-list/">Building A Remote Desktop Manager Connection List</a> from the SQL Server Central Management Server (CMS) tables. The RDCMan use case for cluster administration is very useful and it just so happens that I built a similar solution for cluster servers. So, as a follow up here&#8217;s a way to auto generate an RDCMan file from a list of clusters, nodes and virtuals.</p>
<p>First create and populate a cluster, cluster_node and cluster_virtual tables defined in the following <a href="http://cid-ea42395138308430.office.live.com/self.aspx/Public/Blog/rdcman%5E_cluster%5E_dbobjs.sql">T-SQL script file</a>:<br />
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-ea42395138308430.office.live.com/embedicon.aspx/Public/Blog/rdcman^_cluster^_dbobjs.sql"></iframe><br />
<strong>Note: You&#8217;ll need to insert your cluster information into the three tables.</strong><br />
Next use the <a href="http://cid-ea42395138308430.office.live.com/self.aspx/Public/Blog/rdcman%5E_cluster%5E_query.sql">following T-SQL XQuery to generate the RDCMan</a> XML and save the file as cluster.rdg.<br />
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-ea42395138308430.office.live.com/embedicon.aspx/Public/Blog/rdcman^_cluster^_query.sql"></iframe><br />
Finally open the cluster.rdg file in Remote Desktop Connection Manager. RDCMan allows to you to have multiple rdg files open at one time which means our previous CMS-based list of SQL Server and our cluster-based list can both be used simultaneously.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2010/06/building-a-remote-desktop-manager-cluster-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Building A Remote Desktop Manager Connection List</title>
		<link>http://sev17.com/2010/06/building-a-remote-desktop-manager-connection-list/</link>
		<comments>http://sev17.com/2010/06/building-a-remote-desktop-manager-connection-list/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 19:02:51 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[RDCMan]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10329</guid>
		<description><![CDATA[Remote Desktop Connection Manager or RDCMan is a free download from Microsoft for managing multiple remote desktop connections. The functionality provided by RDCMan is above and beyond what you&#8217;ll find in the built-in Remote Desktop MMC and comparable to other 3rd party Remote Desktop utilities. If you&#8217;re connecting to multiple remote desktop sessions, RDCMan is...]]></description>
			<content:encoded><![CDATA[<p><a class="wp-oembed" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=4603c621-6de7-4ccb-9f51-d53dc7e48047&amp;displaylang=en" target="_blank">Remote Desktop Connection Manager</a> or RDCMan is a free download from Microsoft for managing multiple remote desktop connections. The functionality provided by RDCMan is above and beyond what you&#8217;ll find in the built-in Remote Desktop MMC and comparable to other 3rd party Remote Desktop utilities. If you&#8217;re connecting to multiple remote desktop sessions, RDCMan is a tool worth looking into.</p>
<p>Because my environment has hundreds of servers, one of the things I look for in management tools is a method to import an existing list of servers.  Fortunately the XML file called an RDCMan file used for the connection list in RDCMan is a simple structure you can build yourself. A quick web search turns up a post by <a class="wp-oembed" href="http://blog.powershell.no/" target="_blank">Jan Egil Ring</a> titled <a href="http://blog.powershell.no/2010/06/02/dynamic-remote-desktop-connection-manager-connection-list/">Dynamic Remote Desktop Connection Manager connection list</a>. The approach Jan takes builds an RDCMan file from the computers in Active Directory using PowerShell which isn&#8217;t quite what I want, but it gives me an idea on using T-SQL/XQuery&#8230;</p>
<p>As a SQL Server DBA I maintain a list of SQL Servers and groups in a <a class="wp-oembed" href="http://msdn.microsoft.com/en-us/library/bb895144.aspx" target="_blank">Central Management Server</a> or CMS. A CMS is not only useful for maintaining a central list of SQL Servers, driving <a class="wp-oembed" href="http://msdn.microsoft.com/en-us/library/bb510408.aspx" target="_blank">Policy Based Managment</a>, and executing multi-server queries but can also be used as input for other things including building an RDCMan file. Because the CMS data is already in SQL Server tables it&#8217;s easier to use a T-SQL approach to shape the XML. The following T-SQL query creates an RDCMan XML file from CMS servers and groups. The same servers and groups in your CMS will be represented in the resulting RDCMan file:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">DECLARE</span> @xml XML
&nbsp;
;WITH <span style="color: #66cc66;">&#91;</span>file<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
<span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'RDCMan'</span>
<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2.2</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'version'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'CMS'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'name'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'True'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'expanded'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Generated from CMS'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'comment'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'logonCredentials'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'connectionSettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'gatewaySettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'remoteDesktop'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'localResources'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'securitySettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'displaySettings'</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span>grp <span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
 server_group_id
<span style="color: #66cc66;">,</span>name
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'True'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'expanded'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Generated from CMS'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'comment'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'logonCredentials'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'connectionSettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'gatewaySettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'remoteDesktop'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'localResources'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'securitySettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'displaySettings'</span>
<span style="color: #993333; font-weight: bold;">FROM</span> msdb<span style="color: #66cc66;">.</span>dbo<span style="color: #66cc66;">.</span>sysmanagement_shared_server_groups_internal
<span style="color: #993333; font-weight: bold;">WHERE</span> is_system_object <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span>srv <span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
 <span style="color: #993333; font-weight: bold;">DISTINCT</span> server_group_id
<span style="color: #66cc66;">,</span><span style="color: #993333; font-weight: bold;">CASE</span>
	<span style="color: #993333; font-weight: bold;">WHEN</span> PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%<span style="color: #000099; font-weight: bold;">\%</span>'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">THEN</span>
		<span style="color: #993333; font-weight: bold;">SUBSTRING</span><span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span>PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%<span style="color: #000099; font-weight: bold;">\%</span>'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #993333; font-weight: bold;">WHEN</span> PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%,%'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>  <span style="color: #993333; font-weight: bold;">THEN</span>
		<span style="color: #993333; font-weight: bold;">SUBSTRING</span><span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span>PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%,%'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #993333; font-weight: bold;">ELSE</span>
		name
<span style="color: #993333; font-weight: bold;">END</span> <span style="color: #993333; font-weight: bold;">AS</span> name
<span style="color: #66cc66;">,</span><span style="color: #993333; font-weight: bold;">CASE</span>
	<span style="color: #993333; font-weight: bold;">WHEN</span> PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%<span style="color: #000099; font-weight: bold;">\%</span>'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">THEN</span>
		<span style="color: #993333; font-weight: bold;">SUBSTRING</span><span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span>PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%<span style="color: #000099; font-weight: bold;">\%</span>'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #993333; font-weight: bold;">WHEN</span> PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%,%'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>  <span style="color: #993333; font-weight: bold;">THEN</span>
		<span style="color: #993333; font-weight: bold;">SUBSTRING</span><span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span>PATINDEX<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'%,%'</span><span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #993333; font-weight: bold;">ELSE</span>
		name
<span style="color: #993333; font-weight: bold;">END</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'displayName'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Generated from CMS'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'comment'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'logonCredentials'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'connectionSettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'gatewaySettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'remoteDesktop'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'localResources'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'securitySettings'</span>
<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'FromParent'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'displaySettings'</span>
<span style="color: #993333; font-weight: bold;">FROM</span> msdb<span style="color: #66cc66;">.</span>dbo<span style="color: #66cc66;">.</span>sysmanagement_shared_registered_servers_internal<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> @XML <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
 name
<span style="color: #66cc66;">,</span>expanded
<span style="color: #66cc66;">,</span>comment
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> logonCredentials <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'logonCredentials'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> connectionSettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'connectionSettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> gatewaySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'gatewaySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> remoteDesktop <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'remoteDesktop'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> localResources <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'localResources'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> securitySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'securitySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> displaySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'displaySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>file<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'properties'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> 
&nbsp;
 <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
 g<span style="color: #66cc66;">.</span>name
<span style="color: #66cc66;">,</span>g<span style="color: #66cc66;">.</span>expanded
<span style="color: #66cc66;">,</span>g<span style="color: #66cc66;">.</span>comment
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>logonCredentials <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'logonCredentials'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>connectionSettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'connectionSettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>gatewaySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'gatewaySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>remoteDesktop <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'remoteDesktop'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>localResources <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'localResources'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>securitySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'securitySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> g<span style="color: #66cc66;">.</span>displaySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'displaySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> grp g <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">GROUP</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span>server_group_id <span style="color: #66cc66;">=</span> g<span style="color: #66cc66;">.</span>server_group_id
<span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'properties'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
 s<span style="color: #66cc66;">.</span>name
<span style="color: #66cc66;">,</span>s<span style="color: #66cc66;">.</span>displayName
<span style="color: #66cc66;">,</span>s<span style="color: #66cc66;">.</span>comment
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>logonCredentials <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'connectionSettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>connectionSettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'connectionSettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>gatewaySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'gatewaySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>remoteDesktop <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'remoteDesktop'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>localResources <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'localResources'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>securitySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'securitySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>displaySettings <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;@inherit&quot;</span> <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'displaySettings'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> srv s <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">GROUP</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span>server_group_id <span style="color: #66cc66;">=</span> s<span style="color: #66cc66;">.</span>server_group_id
<span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'server'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> grp <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">GROUP</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">GROUP</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span>name
<span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'group'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>file<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">FOR</span> XML AUTO<span style="color: #66cc66;">,</span> ELEMENTS<span style="color: #66cc66;">,</span> ROOT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'RDCMan'</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">SET @XML.modify('
insert <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
as first
into (/RDCMan)[1]') 
&nbsp;
SET @xml.modify('insert attribute schemaVersion{&quot;1&quot;} as last into (RDCMan)[1]')
&nbsp;
SELECT @XML</pre></div></div>

<p>To use run the query in the msdb database on your CMS and save the output as an <strong>.rdg</strong> file. Next, from Remote Desktop Connection Manager select <em>File-&gt;Open</em> and select the RDCMan file. Once you&#8217;ve imported the list of servers, you&#8217;ll want to take a look at the global settings and features of RDCMan. In particular you&#8217;ll want to set Logon Credentials which will allow you to autologon to various servers.<br />
The code syntax highlighter I&#8217;m using seems to mess up the case of several items, so I&#8217;m including the SQL script for download:<br />
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-ea42395138308430.office.live.com/embedicon.aspx/Public/Blog/rgd^_query.sql"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2010/06/building-a-remote-desktop-manager-connection-list/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>The Truth about SQLPS and PowerShell V2</title>
		<link>http://sev17.com/2010/05/the-truth-about-sqlps-and-powershell-v2/</link>
		<comments>http://sev17.com/2010/05/the-truth-about-sqlps-and-powershell-v2/#comments</comments>
		<pubDate>Fri, 28 May 2010 01:30:38 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[make-shell]]></category>
		<category><![CDATA[sqlps]]></category>

		<guid isPermaLink="false">http://sev17.com/2010/05/the-truth-about-sqlps-and-powershell-v2/</guid>
		<description><![CDATA[With the release of SQL Server 2008 R2 there have been claims that sqlps is really PowerShell V1 under the covers or that sqlps is PowerShell V2 because it returns $psversiontable information. Although, technically, sqlps neither PowerShell V1 nor V2, the answer to this question is a little more complicated and a closer look into...]]></description>
			<content:encoded><![CDATA[<p>With the release of SQL Server 2008 R2 there have been claims that sqlps is really PowerShell V1 under the covers or that sqlps is PowerShell V2 because it returns $psversiontable information. Although, technically, sqlps neither PowerShell V1 nor V2, the answer to this question is a little more complicated and a closer look into the inner workings of sqlps is needed. Before we can look into the implementation details of sqlps let’s review how various Microsoft products implement custom shells.</p>
<h2>Custom Shell Implementation and History</h2>
<p>Microsoft products that provide PowerShell integration excluding the sqlps implementation which will cover next; provide a custom shell/console in one of two ways: (Note: profiles are not mentioned because they are not used in package products)</p>
<ol>
<li>Use a console file</li>
<li>Call a PowerShell script on startup</li>
</ol>
<h3>Console Files</h3>
<p>A console file is a special XML file with a psc1 extension that stores the configuration information for a PowerShell session including all the custom Snapins loaded. Creating a console file is simple and anyone can do it calling the cmdlet <strong>Export-Console. </strong>You can then use the console file when starting PowerShell by specifying the –PSConsolefile parameter:</p>
<p>Powershell.exe –PSConsoleFile <em>path_to_consolefile</em></p>
<p>See <a href="http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!216.entry" target="_blank">Richard Siddaway’s post on console files</a> for more information.</p>
<p>If you look at the shortcut properties of the following Microsoft products you’ll find the use of console files with the following syntax:</p>
<table style="height: 166px;" border="0" cellspacing="0" cellpadding="2" width="514">
<tbody>
<tr>
<td width="200" valign="top"><strong><em>Product</em></strong></td>
<td width="790" valign="top"><strong><em>Syntax</em></strong></td>
</tr>
<tr>
<td width="200" valign="top"><em>Exchange 2007</em></td>
<td width="790" valign="top"><em>C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe -PSConsoleFile &#8220;C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1&#8243; -noexit -command &#8220;. &#8216;C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1&#8242;&#8221;</em></td>
</tr>
<tr>
<td width="200" valign="top"><em>System Center Virtual Machine Manager 2008</em></td>
<td width="790" valign="top"><em>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile &#8220;C:\Program Files\Microsoft System Center Virtual Machine Manager 2008 R2\bin\cli.psc1&#8243; -NoExit</em></td>
</tr>
<tr>
<td width="200" valign="top"><em>Operations Manager</em></td>
<td width="790" valign="top"><em>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1</em></td>
</tr>
</tbody>
</table>
<h3>Startup Scripts</h3>
<p>PowerShell console files have a couple of limitations first they don’t support modules and second they require starting PowerShell with the PSConsolefile parameter. There are also non-technical issues in the use of console files—many PowerShell users simply don’t like custom consoles and console files don’t lend themselves to reuse in a regular PowerShell console. Looking at Exchange 2010 we see the console file used in Exchange 2007 has been replaced with a startup script. The script is nothing more than a plain old PowerShell script with a ps1 extension. The properties of Exchange 2010 console looks like this:</p>
<p><em>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command &#8220;. &#8216;C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1&#8242;; Connect-ExchangeServer -auto&#8221;</em></p>
<p>I’m not sure if other products use startup scripts. There doesn’t seem to be much documentation on best practices for custom console creation, but I suspect because of the limitations of console files we will see more products use startup scripts.</p>
<h3>SQLPS</h3>
<p>This brings us to sqlps, how does SQL Server provide a custom console? Well, sqlps is implemented as something called a minishell. The  sqlps use of a minishell is unique among Microsoft products. In fact sqlps is the only product to develop PowerShell integration in this fashion and will probably be last. The use of a minishell <a href="http://blogs.msdn.com/b/powershell/archive/2008/06/23/sql-minishells.aspx" target="_blank">was not well received upon the initial release of SQL Server 2008</a>. (Note: the intention of this post is not to critique sqlps usage of minishell, but rather to provide historical summary to the reader, so please no flaming sqlps). Unfortunately the release of SQL Server 2008 R2 includes zero changes to sqlps so, we’ll have to look to the next release of SQL Server to get it fixed. In the next section we’ll create our own minishell in order to see demonstrate sqlps is implemented</p>
<h3>Creating A MiniShell</h3>
<p>To really understand how a program works we must delve into the code.</p>
<p><em>Note: The demonstration that follows uses a deprecated tool called make-shell. This tool should not be used for creating PowerShell solutions as part of a product distributed. The purpose of the sample code is illustrate how sqlps minishell is created.</em></p>
<p>According to <a href="http://blogs.msdn.com/b/mwories/" target="_blank">Michiel Wories</a>’ (author of sqlps and creator of SMO) blog post <a href="http://blogs.msdn.com/b/mwories/archive/2008/06/14/sql2008_5f00_powershell.aspx" target="_blank">SQL Server Powershell is here!</a> sqlps was created via a utility called make-shell. Because make-shell has been deprecated the MSDN documentation has been pulled. A Bing search turns up little other an old post from PowerShell V1 pre-release days which seems to indicate that <a href="http://bartdesmet.net/blogs/bart/archive/2006/05/07/3943.aspx" target="_blank">make-shell was used in beta builds of PowerShell to create cmdlets</a>. The approach demonstrated is even more awkward than the installutil plus add-pssnapin approach to adding cmdlets adopted in V1 and much more complex than the simple import-module approach used in PowerShell V2. We should be thankful make-shell didn’t make into mainstream PowerShell V1 development and how truly simple it is to add cmdlets in PowerShell V2.</p>
<p>Although the make-shell tool has largely disappeared from online docs, the utility and documentation are still available as part of the Windows SDK (both 6.0A and <a href="http://blogs.msdn.com/b/windowssdk/archive/2009/08/07/released-windows-sdk-for-windows-7-and-net-framework-3-5-sp1.aspx" target="_blank">7.0</a> versions). Once you install the SDK (any version higher than 6.0A), you can simply copy the standalone make-shell executable to any machine. We’re now ready to build our own SQL Server minishell.</p>
<h4>Setup</h4>
<p>First you’ll need to install SQL Server 2008 or SQL Server 2008 R2. The Express edition will suffice. Next we need to setup our build directory. To keep things simple and because the paths are a little tricky, we’ll create a directory called C:\makeshell and copy the following files from C:\Program Files\Microsoft SQL Server\100\Tools\Binn, C:\Windows\System32\WindowsPowerShell\v1.0 and C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin. The contents of C:\makeshell should contain:</p>
<p>en&lt;DIR&gt;*<br />
Certificate.format.ps1xml<br />
DotNetTypes.format.ps1xml<br />
FileSystem.format.ps1xml<br />
Help.format.ps1xml<br />
make-shell.exe<br />
Microsoft.SqlServer.Management.PSProvider.dll<br />
Microsoft.SqlServer.Management.PSSnapins.dll<br />
PowerShellCore.format.ps1xml<br />
PowerShellTrace.format.ps1xml<br />
Registry.format.ps1xml<br />
SQLProvider.Format.ps1xml<br />
SQLProvider.Types.ps1xml<br />
types.ps1xml</p>
<p>*The en directory contains the MAML help file for the SQL Server provider and cmdlets (Microsoft.SqlServer.Management.PSProvider.dll-Help.xml and Microsoft.SqlServer.Management.PSSnapins.dll-Help.xml)</p>
<p>The make-shell utility needs to reference the System.Management.Automation.dll. If you’re using PowerShell V1 this assembly is available in the C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\ directory. Stating with PowerShell V2 the reference assemblies are no longer included with the PowerShell installation. Instead you’ll need to install Windows SDK 7.0 or higher which provides the reference assemblies in the same location as V1 (C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\\v1.0\ ).</p>
<h5><strong>Test Scenario #1:</strong></h5>
<ul>
<li>Test machine OS: Windows XP with SP3</li>
<li>PowerShell version 1</li>
<li>SQL Server 2008 R2 Express Edition</li>
<li>Makeshell build directory with the files and directory documented in the setup section</li>
</ul>
<p>Steps</p>
<ol>
<li>Launch PowerShell with -noprofile switch</li>
<li>CD to C:\makshell directory</li>
<li>Run the following command to create a minishell called sqlps2:</li>
</ol>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">.\make<span style="color: pink;">-</span>shell.exe <span style="color: pink;">-</span>out sqlps2 <span style="color: pink;">-</span>ns Community <span style="color: pink;">-</span>lib <span style="color: #800000;">&quot;C:\\Program Files\\Microsoft SQL Server\\100\SDK\\Assemblies\\,C:\\Program Files\\Microsoft SQL Server\\100\Tools\Binn\\,C:\\Program Files\\Reference Assemblies\\Microsoft\\WindowsPowerShell\\v1.0\\&quot;</span> <span style="color: pink;">-</span>reference <span style="color: #800000;">&quot;Microsoft.SqlServer.Management.PSSnapins.dll,Microsoft.SqlServer.Management.PSProvider.dll,Microsoft.SqlServer.Smo.dll,Microsoft.SqlServer.Dmf.dll, Microsoft.SqlServer.SqlWmiManagement.dll,Microsoft.SqlServer.ConnectionInfo.dll,Microsoft.SqlServer.SmoExtended.dll,Microsoft.SqlServer.Management.Sdk.Sfc.dll, Microsoft.SqlServer.SqlEnum.dll,Microsoft.SqlServer.RegSvrEnum.dll,Microsoft.SqlServer.WmiEnum.dll,Microsoft.SqlServer.ServiceBrokerEnum.dll,Microsoft.SqlServer.ConnectionInfoExtended.dll, Microsoft.SqlServer.Management.Collector.dll,Microsoft.SqlServer.Management.CollectorEnum.dll&quot;</span> <span style="color: pink;">-</span>formatdata SQLProvider.Format.ps1xml <span style="color: pink;">-</span>typedata SQLProvider.Types.ps1xml</pre></td></tr></table></div>

<p>And voila, you should have a sqlps2.exe minshell ready for use. An interesting side-effect of make-shell is that it also produces a <a class="wp-oembed" title="sqlps2.cs" href="http://poshcode.org/1885" target="_blank">C# source file</a>. I’ve included both the executable and generated source code in the download. I could not find any licensing agreement that will allow me to distribute the SQL Server provider, snapin or PowerShell help files, so you’ll need to copy the files specified in the setup section. The source code is really interesting as  it provides details on why minishell’s behave as they do. Looking at sqlp2.cs source code we see a minishell is really nothing more than a PowerShell host that implements its own RunspaceConfiguration class. As <a href="http://huddledmasses.org/" target="_blank">Joel Bennett</a> noted in his blog post <a href="http://huddledmasses.org/is-powershell-shellid-too-big-a-burden/" target="_blank">Is PowerShell $ShellId too big a burden?</a> using the RunspaceConfiguration class in a custom PowerShell host comes with some expensive side effects:</p>
<ol>
<li>You have to configure the available .net Assemblies, Cmdlets, Format files, Initialization Scripts, Providers, Scripts, and Type files.</li>
<li>You don’t inherit anything from PowerShell.exe (like for instance, the ExecutionPolicy)</li>
<li>Some cmdlets just don’t work like Add-PSSnapin which means you can not load additional cmdlets</li>
</ol>
<p>This explains why a minishell behaves the way it does. It also explains why running sqlps on PowerShell V2 results in the same cmdlets as sqlps on PowerShell V1—you have to explicitly list each cmdlet available to the host when creating the shell. The make-shell utility is generating the executable and source code to create the list of cmdlets automatically for the PowerShell host developer. Since sqlps was created using make-shell and PowerShell V1 assemblies <strong>ONLY PowerShell V1 cmdlets are available in sqlps.</strong></p>
<p>We’re now ready to startup our new minishell and run a few commands:</p>
<p>PS C:\makeshell&gt; $shellid<br />
Community.sqlps2<br />
PS C:\makeshell&gt; get-command | where {$_.commandtype -eq &#8216;Cmdlet&#8217;} | measure-object</p>
<p>Count    : 130<br />
Average  :<br />
Sum      :<br />
Maximum  :<br />
Minimum  :<br />
Property :</p>
<p>PS C:\makeshell&gt;</p>
<p>Our minishell, sqlps2.exe, is functionally equivalent to sqlps.exe and the output above shows the number of cmdlets is 130, the same as sqlps. <em>Note: if you’re using an OS with UAC enabled you’ll need to run the minishell as administrator in order to set the execution policy to remotesigned on first run</em>.</p>
<h5><strong>Test Scenario #2</strong></h5>
<ul>
<li>Test machine OS: Windows 7 x64</li>
<li>PowerShell version 2</li>
<li>SQL Server 2008 R2 Express Edition</li>
<li>Makeshell build directory with the files and directory documented in the setup section</li>
<li>Windows 7 and .NET 3.5 SP1 SDK (provides PowerShell V2 assembly)</li>
</ul>
<p>Before creating a new sqlps2 First let’s take the sqlps2.exe including the entire folder created from a PowerShell V1 assemblies in Test Scenario #1 and run the executable on a system with PowerShell V2.</p>
<p>PS C:\makeshell&gt; $shellid<br />
Community.sqlps2<br />
PS C:\makeshell&gt; get-command | where {$_.commandtype -eq &#8216;Cmdlet&#8217;} | measure-object</p>
<p>Count    : 130<br />
Average  :<br />
Sum      :<br />
Maximum  :<br />
Minimum  :<br />
Property :</p>
<p>PS C:\makeshell&gt;</p>
<p>The number of cmdlets is still 130 and zero V2 cmdlets are available within our sqlps2.exe minishell. This is not surprising considering sqlps2 like sqlps was created by referencing PowerShell V1 assemblies. Next let’s create a new sqlps2 referencing the PowerShell V2 assembly.</p>
<p>Steps</p>
<ol>
<li>Launch PowerShell with -noprofile switch</li>
<li>CD to C:\makshell directory</li>
<li>Run the following command to create a minishell called sqlps2:</li>
</ol>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">.\make<span style="color: pink;">-</span>shell.exe <span style="color: pink;">-</span>out sqlps2 <span style="color: pink;">-</span>ns Community <span style="color: pink;">-</span>lib <span style="color: #800000;">&quot;C:\\makeshell\\,C:\\Program Files\\Microsoft SQL Server\\100\SDK\\Assemblies\\,C:\\Program Files\\Microsoft SQL Server\\100\Tools\Binn\\,C:\\Program Files\\Reference Assemblies\\Microsoft\\WindowsPowerShell\\v1.0\\&quot;</span> <span style="color: pink;">-</span>reference <span style="color: #800000;">&quot;Microsoft.SqlServer.Management.PSSnapins.dll,Microsoft.SqlServer.Management.PSProvider.dll,Microsoft.SqlServer.Smo.dll,Microsoft.SqlServer.Dmf.dll, Microsoft.SqlServer.SqlWmiManagement.dll,Microsoft.SqlServer.ConnectionInfo.dll,Microsoft.SqlServer.SmoExtended.dll,Microsoft.SqlServer.Management.Sdk.Sfc.dll, Microsoft.SqlServer.SqlEnum.dll,Microsoft.SqlServer.RegSvrEnum.dll,Microsoft.SqlServer.WmiEnum.dll,Microsoft.SqlServer.ServiceBrokerEnum.dll,Microsoft.SqlServer.ConnectionInfoExtended.dll, Microsoft.SqlServer.Management.Collector.dll,Microsoft.SqlServer.Management.CollectorEnum.dll&quot;</span> <span style="color: pink;">-</span>formatdata SQLProvider.Format.ps1xml <span style="color: pink;">-</span>typedata SQLProvider.Types.ps1xml</pre></td></tr></table></div>

<p>We’re now ready to startup our new PowerShell V2 based minishell and run a few commands:</p>
<p>PS C:\makeshell&gt; $shellid<br />
Community.sqlps2<br />
PS C:\makeshell&gt; get-command | where {$_.commandtype -eq &#8216;Cmdlet&#8217;} | measure-object</p>
<p>Count    : 220<br />
Average  :<br />
Sum      :<br />
Maximum  :<br />
Minimum  :<br />
Property :</p>
<p>PS C:\makeshell&gt;</p>
<p>The V2 based minshell contains most of the 236 base PowerShell V2 cmdlets minus those that are not implemented in RunspaceConfiguration class. Interestingly enough import-module is included which allows us to add cmdlets to sqlps2.</p>
<h2>Conclusions</h2>
<ul>
<li>sqlps runs on PowerShell V1 or PowerShell V2</li>
<li>sqlps is neither PowerShell V1 nor PowerShell V2, rather sqlps is a minishell.</li>
<li>Minishells implement the RunspaceConfiguration class which forces the shell developer to explicitly define the cmdlets available to the minishell</li>
<li>Because sqlps was created using make-shell referencing the PowerShell V1 assembly, only PowerShell V1 cmdlets are available in sqlps</li>
<li>The SQL Server 2008 R2 installation media includes PowerShell V1 under \1033_ENU_LP\xx\redist (where xx represents platform x86, x64, IA64)</li>
<li>The SQL Server 2008 and 2008 R2 installer checks whether PowerShell is installed (V1 or V2) and passes the check whether PowerShell is installed or not</li>
<li>The SQL Server 2008 and 2008 R2 installer will install PowerShell V1 if PowerShell is not installed on the machine.</li>
<li>There are no changes in sqlps between SQL Server 2008 and SQL Server 2008 R2</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2010/05/the-truth-about-sqlps-and-powershell-v2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>SQL Agent Visual Job Schedule Viewer</title>
		<link>http://sev17.com/2010/05/sql-agent-visual-job-schedule-viewer/</link>
		<comments>http://sev17.com/2010/05/sql-agent-visual-job-schedule-viewer/#comments</comments>
		<pubDate>Sat, 15 May 2010 18:54:18 +0000</pubDate>
		<dc:creator>Chad Miller</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLJobVis]]></category>

		<guid isPermaLink="false">http://sev17.com/?p=10220</guid>
		<description><![CDATA[If you have experience with the SQL Server Agent you quickly realize the difficulty in managing job schedules. On a busy server with many SQL jobs scheduled to run throughout the day at various times finding clashing job schedules and long running jobs is hard to do using the native SQL Server tools. To address...]]></description>
			<content:encoded><![CDATA[<p>If you have experience with the SQL Server Agent you quickly realize the difficulty in managing job schedules. On a busy server with many SQL jobs scheduled to run throughout the day at various times finding clashing job schedules and long running jobs is hard to do using the native SQL Server tools. </p>
<p>To address this issue I’ve been looking for a simple way to visualize the SQL Agent job schedule information and I was just about to write my own tool before finding a very nice product called <a href="http://sqlsoft.co.uk/sqljobvis.php" target="_blank">SQLJobVis</a> from <a href="http://sqlsoft.co.uk/" target="_blank">SQLSoft</a>. Using SQLJobVis I was able to quickly see jobs that were long running and jobs with overleaping schedules:</p>
<p><a href="http://sev17.com/wp-content/uploads/SQLjobvis.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="SQLjobvis" border="0" alt="SQLjobvis" src="http://sev17.com/wp-content/uploads/SQLjobvis_thumb.jpg" width="244" height="183" /></a> </p>
<p>SQLJobVis&#160; is a great example of how data visualization in the right way makes finding information much easier. At this point, the utility is freely available from SQLSoft and they are just&#160; looking feedback and feature requests. So, give SQLJobVis a try and be sure to let them know if you find the tool useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://sev17.com/2010/05/sql-agent-visual-job-schedule-viewer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Object Caching 1214/1323 objects using disk: basic

Served from: sev17.com @ 2012-05-18 04:45:11 -->
