Skip to content

Commit

Permalink
1.0.97
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Feb 15, 2020
1 parent 544071b commit c9c74bf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
44 changes: 16 additions & 28 deletions allcommands.ps1
Expand Up @@ -46413,14 +46413,14 @@ function Invoke-DbaDiagnosticQuery {
}

$scriptversions = @()
$scriptfiles = Get-ChildItem -Path "$Path\SQLServerDiagnosticQueries_*_*.sql"
$scriptfiles = Get-ChildItem -Path "$Path\SQLServerDiagnosticQueries_*.sql"

if (!$scriptfiles) {
Write-Message -Level Warning -Message "Diagnostic scripts not found in $Path. Using the ones within the module."

$Path = Join-Path -Path $base -ChildPath "\bin\diagnosticquery"

$scriptfiles = Get-ChildItem "$base\bin\diagnosticquery\SQLServerDiagnosticQueries_*_*.sql"
$scriptfiles = Get-ChildItem "$base\bin\diagnosticquery\SQLServerDiagnosticQueries_*.sql"
if (!$scriptfiles) {
Stop-Function -Message "Unable to download scripts, do you have an internet connection? $_" -ErrorRecord $_
return
Expand Down Expand Up @@ -53588,7 +53588,7 @@ function New-DbaDiagnosticAdsNotebook {
}
}

$diagnosticScriptPath = Get-ChildItem -Path "$($script:PSModuleRoot)\bin\diagnosticquery\" -Filter "SQLServerDiagnosticQueries_$($TargetVersion)_??????.sql" | Select-Object -First 1
$diagnosticScriptPath = Get-ChildItem -Path "$($script:PSModuleRoot)\bin\diagnosticquery\" -Filter "SQLServerDiagnosticQueries_$($TargetVersion).sql" | Select-Object -First 1

if (-not $diagnosticScriptPath) {
Stop-Function -Message "No diagnostic queries available for `$TargetVersion = $TargetVersion"
Expand Down Expand Up @@ -61478,41 +61478,29 @@ function Save-DbaDiagnosticQueryScript {
}

Add-Type -AssemblyName System.Web
$glenberryrss = "http://www.sqlskills.com/blogs/glenn/feed/"
$glenberrysql = @()

Write-Message -Level Verbose -Message "Downloading RSS Feed"
$rss = [xml](get-webdata -uri $glenberryrss)
$Feed = $rss.rss.Channel

$glenberrysql = @()
$RssPostFilter = "SQL Server Diagnostic Information Queries for*"
$glennberryResources = "https://glennsqlperformance.com/resources/"
$DropboxLinkFilter = "*dropbox.com*"
$LinkTitleFilter = "*Diagnostic Information Queries*"
$ExcludeSpreadsheet = "*BlankResutsSpreadsheet*"
$ExcludeSpreadsheet = "*Results Spreadsheet*"

Write-Message -Level Verbose -Message "Downloading Glenn Berry Resources Page"
$page = Get-WebData -uri $glennberryResources

$glenberrysql += ($page.Links | Where-Object { $_.href -like $DropboxLinkFilter -and $_.outerHTML -like $LinkTitleFilter -and $_.outerHTML -notlike $ExcludeSpreadsheet } | ForEach-Object {
[pscustomobject]@{
URL = $_.href
SQLVersion = $_.outerHTML -replace "<.+`">", "" -replace "</a>", "" -replace " Diagnostic Information Queries", "" -replace "SQL Server ", "" -replace ' ', ''
}
})

foreach ($post in $Feed.item) {
if ($post.title -like $RssPostFilter) {
# We found the first post that matches it, lets go visit and scrape.
$page = Get-WebData -uri $post.link
$glenberrysql += ($page.Links | Where-Object { $_.href -like $DropboxLinkFilter -and $_.outerHTML -like $LinkTitleFilter -and $_.outerHTML -notlike $ExcludeSpreadsheet } | ForEach-Object {
[pscustomobject]@{
URL = $_.href
SQLVersion = $_.outerHTML -replace "<.+`">", "" -replace "</a>", "" -replace " Diagnostic Information Queries", "" -replace "SQL Server ", "" -replace ' ', ''
FileYear = ($post.title -split " ")[-1]
FileMonth = "{0:00}" -f [int]([CultureInfo]::InvariantCulture.DateTimeFormat.MonthNames.IndexOf(($post.title -split " ")[-2]))
}
})
break
}
}
Write-Message -Level Verbose -Message "Found $($glenberrysql.Count) documents to download"
foreach ($doc in $glenberrysql) {
try {
$link = $doc.URL.ToString().Replace('dl=0', 'dl=1')
Write-Message -Level Verbose -Message "Downloading $link)"
Write-ProgressHelper -Activity "Downloading Glenn Berry's most recent DMVs" -ExcludePercent -Message "Downloading $link" -StepNumber 1
$filename = Join-Path -Path $Path -ChildPath "SQLServerDiagnosticQueries_$($doc.SQLVersion)_$("$($doc.FileYear)$($doc.FileMonth)").sql"
$filename = Join-Path -Path $Path -ChildPath "SQLServerDiagnosticQueries_$($doc.SQLVersion).sql"
Invoke-TlsWebRequest -Uri $link -OutFile $filename -ErrorAction Stop
Get-ChildItem -Path $filename
} catch {
Expand Down
4 changes: 2 additions & 2 deletions bin/dbatools-index.json
Expand Up @@ -27940,7 +27940,7 @@
],
"Synopsis": "Invoke-DbaDiagnosticQuery runs the scripts provided by Glenn Berry\u0027s DMV scripts on specified servers",
"Alias": "",
"Author": "Andre Kamman (@AndreKamman), http://clouddba.io",
"Author": "Andre Kamman (@AndreKamman), http://andrekamman.com",
"CommandName": "Invoke-DbaDiagnosticQuery",
"Availability": "Windows, Linux, macOS",
"Links": "https://dbatools.io/Invoke-DbaDiagnosticQuery",
Expand Down Expand Up @@ -40186,7 +40186,7 @@
],
"Synopsis": "Save-DbaDiagnosticQueryScript downloads the most recent version of all Glenn Berry DMV scripts",
"Alias": "",
"Author": "Andre Kamman (@AndreKamman), http://clouddba.io",
"Author": "Andre Kamman (@AndreKamman), https://andrekamman.com",
"CommandName": "Save-DbaDiagnosticQueryScript",
"Availability": "Windows, Linux, macOS",
"Links": "https://dbatools.io/Save-DbaDiagnosticQueryScript",
Expand Down
2 changes: 1 addition & 1 deletion dbatools.psd1
Expand Up @@ -11,7 +11,7 @@
RootModule = 'dbatools.psm1'

# Version number of this module.
ModuleVersion = '1.0.95'
ModuleVersion = '1.0.97'

# ID used to uniquely identify this module
GUID = '9d139310-ce45-41ce-8e8b-d76335aa1789'
Expand Down
4 changes: 2 additions & 2 deletions en-us/dbatools-help.xml
Expand Up @@ -8311,7 +8311,7 @@ These sql files will then be created in the OutputDirectory</maml:para></maml:de
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.

For MFA support, please use Connect-DbaInstance.</maml:para></maml:description><command:parameterValue required="false" variableLength="true">Pscredential</command:parameterValue><dev:type><maml:name>Pscredential</maml:name><maml:uri /></dev:type><dev:defaultValue></dev:defaultValue></command:parameter><command:parameter required="false" position="named" pipelineInput="False" aliases="" variableLength="true" globbing="false"><maml:name>SqlInstance</maml:name><maml:description><maml:para>The target SQL Server instance or instances. Can be either a string or SMO server</maml:para></maml:description><command:parameterValue required="false" variableLength="true">Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]</command:parameterValue><dev:type><maml:name>Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]</maml:name><maml:uri /></dev:type><dev:defaultValue></dev:defaultValue></command:parameter><command:parameter required="false" position="named" pipelineInput="False" aliases="" variableLength="true" globbing="false"><maml:name>UseSelectionHelper</maml:name><maml:description><maml:para>Provides a grid view with all the queries to choose from and will run the selection made by the user on the Sql Server instance specified.</maml:para></maml:description><command:parameterValue required="false" variableLength="true">Switch</command:parameterValue><dev:type><maml:name>Switch</maml:name><maml:uri /></dev:type><dev:defaultValue></dev:defaultValue></command:parameter></command:parameters><command:returnValues><command:returnValue><dev:type><maml:name>System.Management.Automation.PSObject[]</maml:name><maml:uri /><maml:description /></dev:type></command:returnValue></command:returnValues><maml:alertSet><maml:title></maml:title><maml:alert><maml:para> Tags: Community, GlennBerry
Author: Andre Kamman (@AndreKamman), http://clouddba.io
Author: Andre Kamman (@AndreKamman), http://andrekamman.com

Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
Expand Down Expand Up @@ -11458,7 +11458,7 @@ This avoids overwhelming you with "sea of red" exceptions, but is inconvenient b
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.</maml:para></maml:description><command:parameterValue required="false" variableLength="true">Switch</command:parameterValue><dev:type><maml:name>Switch</maml:name><maml:uri /></dev:type><dev:defaultValue></dev:defaultValue></command:parameter></command:syntaxItem></command:syntax><command:parameters><command:parameter required="false" position="named" pipelineInput="False" aliases="" variableLength="true" globbing="false"><maml:name>EnableException</maml:name><maml:description><maml:para>By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.</maml:para></maml:description><command:parameterValue required="false" variableLength="true">Switch</command:parameterValue><dev:type><maml:name>Switch</maml:name><maml:uri /></dev:type><dev:defaultValue></dev:defaultValue></command:parameter><command:parameter required="false" position="named" pipelineInput="False" aliases="" variableLength="true" globbing="false"><maml:name>Path</maml:name><maml:description><maml:para>Specifies the path to the output</maml:para></maml:description><command:parameterValue required="false" variableLength="true">System.IO.FileInfo</command:parameterValue><dev:type><maml:name>System.IO.FileInfo</maml:name><maml:uri /></dev:type><dev:defaultValue></dev:defaultValue></command:parameter></command:parameters><maml:alertSet><maml:title></maml:title><maml:alert><maml:para> Tags: Community, GlennBerry
Author: Andre Kamman (@AndreKamman), http://clouddba.io
Author: Andre Kamman (@AndreKamman), https://andrekamman.com

Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
Expand Down

0 comments on commit c9c74bf

Please sign in to comment.