Skip to content

Commit d7a6b28

Browse files
committed
Added two examples for multi-instance Checks.
1 parent 0758049 commit d7a6b28

1 file changed

Lines changed: 52 additions & 1 deletion

File tree

samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPITutorialNotebook.ipynb

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,57 @@
331331
"outputs": [],
332332
"execution_count": 38
333333
},
334+
{
335+
"cell_type": "markdown",
336+
"source": [
337+
"### 7. Scaling up your Checks\r\n",
338+
"Running checks across multiple machines and writng their results back to the same table in SQL Server. You can keep you list of SQL Servers to check anywhere you want, in a text file, in an Excel spreadsheet, in a table you maintain yourself, the options are endless.\r\n",
339+
"\r\n",
340+
"Two options are shown below show features availabile that can be managed from SSMS or Azure Data Studio, and can accessed via the `SQLSERVER:\\` Provider, which is part of the `SqlServer` module.\r\n",
341+
"\r\n",
342+
"1. Registered Servers is feature of SSMS and stores a list of SQL Server instances in a local XML file.\r\n",
343+
"2. Central Management Server relise on a SQL Server to maintain the list of SQL Server instances (instead of a _local XML file_) and is available in both SSMS & Azure Data Studio."
344+
],
345+
"metadata": {
346+
"azdata_cell_guid": "0ad9518f-e770-4819-b4d1-7f5608c793b3"
347+
}
348+
},
349+
{
350+
"cell_type": "code",
351+
"source": [
352+
"# This approach leverages the Registered Servers feature of SSMS to obtain a list of SQL Servers, and run checks against them.\r\n",
353+
"Get-ChildItem 'SQLSERVER:\\SQLRegistration\\Database Engine Server Group' | \r\n",
354+
"Where-Object { $_.mode -ne 'd'} | \r\n",
355+
"foreach \r\n",
356+
" {\r\n",
357+
" Get-SqlInstance -ServerInstance $_.Name |\r\n",
358+
" Invoke-SqlAssessment -FlattenOutput |\r\n",
359+
" Write-SqlTableData -ServerInstance localhost -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force\r\n",
360+
" }"
361+
],
362+
"metadata": {
363+
"azdata_cell_guid": "3a0c510d-07c7-464b-8b0a-2152df24e237"
364+
},
365+
"outputs": [],
366+
"execution_count": null
367+
},
368+
{
369+
"cell_type": "code",
370+
"source": [
371+
"<# This approach leverages the Central Management Server feature to obtain a list of SQL Servers #>\r\n",
372+
"Get-ChildItem 'SQLSERVER:\\SQLRegistration\\Central Management Server Group' -Recurse | \r\n",
373+
"foreach {\r\n",
374+
" Get-SqlInstance -ServerInstance $_.Name | \r\n",
375+
" Invoke-SqlAssessment -FlattenOutput |\r\n",
376+
" Write-SqlTableData -ServerInstance localhost -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force\r\n",
377+
" }"
378+
],
379+
"metadata": {
380+
"azdata_cell_guid": "c6ca3196-b661-46b4-9818-502c779742ab"
381+
},
382+
"outputs": [],
383+
"execution_count": null
384+
},
334385
{
335386
"cell_type": "markdown",
336387
"source": [
@@ -612,4 +663,4 @@
612663
}
613664
}
614665
]
615-
}
666+
}

0 commit comments

Comments
 (0)