Skip to content

Commit

Permalink
Changes for #288, #292
Browse files Browse the repository at this point in the history
  • Loading branch information
VladDBA committed Dec 25, 2024
1 parent 69aa0f5 commit dd0d4e6
Showing 1 changed file with 8 additions and 55 deletions.
63 changes: 8 additions & 55 deletions PSBlitz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1879,9 +1879,6 @@ try {
$SessOptTbl = $global:PSBlitzSet.Tables[3]

if ($ToHTML -eq "Y") {
if ($DebugInfo) {
Write-Host " ->Converting instance info to HTML" -fore yellow
}

$InstanceInfoTbl.Rows[0]["estimated_response_latency(Sec)"] = $ConnTest

Expand Down Expand Up @@ -2215,9 +2212,6 @@ $JumpToTop

if ($ToHTML -eq "Y") {
$tableName = "Azure SQL Database Info"
if ($DebugInfo) {
Write-Host " ->Converting Azure SQL Database Info results to HTML" -fore yellow
}

$htmlTable = Convert-TableToHtml $RsrcGovTbl -DebugInfo:$DebugInfo -NoCaseChange

Expand Down Expand Up @@ -2384,9 +2378,6 @@ $JumpToTop

if ($ToHTML -eq "Y") {
$tableName = "Database Info"
if ($DebugInfo) {
Write-Host " ->Converting Database Info results to HTML" -fore yellow
}

$htmlTable = Convert-TableToHtml $DBInfoTbl -NoCaseChange -DebugInfo:$DebugInfo

Expand Down Expand Up @@ -2557,16 +2548,8 @@ $JumpToTop
if ($global:StepOutcome -eq "Success") {
$BlitzFirstTbl = $global:PSBlitzSet.Tables[0]

if ($ToHTML -eq "Y") {
if ($DebugInfo) {
Write-Host " ->Converting sp_BlitzFirst output to HTML" -fore yellow
}

#$htmlTable = $BlitzFirstTbl | Select-Object "Priority", "FindingsGroup",
#@{Name = "Finding"; Expression = { $_."Finding" -replace "From Your Community.*", "" } },
#@{Name = "Details"; Expression = { $_."Details".Replace('ClickToSeeDetails', '') -replace ".*in-depth checks with sp_Blitz.*", "Nothing to report" } }, "URL" | Where-Object -FilterScript { ( "0", "255" -NotContains $_."Priority" ) } | ConvertTo-Html -As Table -Fragment
#$htmlTable = $htmlTable -replace $URLRegex, '<a href="$&" target="_blank">$&</a>'
$htmlTable = Convert-TableToHtml $BlitzFirstTbl -NoCaseChange -HasURLs
if ($ToHTML -eq "Y") {
$htmlTable = Convert-TableToHtml $BlitzFirstTbl -NoCaseChange -HasURLs -DebugInfo:$DebugInfo
$HtmlTabName = "What's happening on the instance now?"
$html = $HTMLPre + @"
<title>$HtmlTabName</title>
Expand Down Expand Up @@ -2659,17 +2642,7 @@ $htmlTable
}
$HtmlTabName = "Wait Stats Since Last Startup"

#$htmlTable = $WaitsTbl | Select-Object "Pattern",
#@{Name = "Sample Ended"; Expression = { if ($_."Sample Ended" -ne [System.DBNull]::Value) { ($_."Sample Ended").ToString("yyyy-MM-dd HH:mm:ss") }else { $_."Sample Ended" } } },
#"Hours Sample", "Thread Time (Hours)",
#@{Name = "Wait Type"; Expression = { $_."wait_type" } },
#@{Name = "Wait Category"; Expression = { $_."wait_category" } },
#"Wait Time (Hours)", "Per Core Per Hour",
#"Signal Wait Time (Hours)", "Percent Signal Waits", "Number of Waits",
#"Avg ms Per Wait", "URL" | ConvertTo-Html -As Table -Fragment
#$htmlTable = $htmlTable -replace '<table>', '<table class="WaitStats">'
#$htmlTable = $htmlTable -replace $URLRegex, '<a href="$&" target="_blank">$&</a>'
$htmlTable = Convert-TableToHtml $WaitsTbl -NoCaseChange -HasURLs -CSSClass "WaitStats"
$htmlTable = Convert-TableToHtml $WaitsTbl -NoCaseChange -HasURLs -CSSClass "WaitStats" -DebugInfo:$DebugInfo

$html = $HTMLPre + @"
<title>$HtmlTabName</title>
Expand All @@ -2688,19 +2661,10 @@ $JumpToTop
$html | Out-File -Encoding utf8 -FilePath "$HTMLFilePath"

#Storage
if ($DebugInfo) {
Write-Host " ->Converting storage info to HTML" -fore yellow
}

$HtmlTabName = "Storage Throughput Since Instance Startup"
#$htmlTable = $StorageTbl | Select-Object "Pattern",
#@{Name = "Sample Time"; Expression = { if ($_."Sample Time" -ne [System.DBNull]::Value) { ($_."Sample Time").ToString("yyyy-MM-dd HH:mm:ss") }else { $_."Sample Time" } } },
#"Sample (seconds)",
#"File Name",
#"Drive", "# Reads/Writes", "MB Read/Written", "Avg Stall (ms)",
#@{Name = "Physical File Name"; Expression = { $_."file physical name" } },
#@{Name = "Database Name"; Expression = { $_."DatabaseName" } } | ConvertTo-Html -As Table -Fragment
#$htmlTable = $htmlTable -replace '<table>', '<table id="StorageStatsTable" class="Perfmon sortable">'
$htmlTable = Convert-TableToHtml $StorageTbl -NoCaseChange -TblID "StorageStatsTable" -CSSClass "Storage sortable" -ExclCols "StallRank"

$htmlTable = Convert-TableToHtml $StorageTbl -NoCaseChange -TblID "StorageStatsTable" -CSSClass "Storage sortable" -ExclCols "StallRank" -DebugInfo:$DebugInfo

$html = $HTMLPre + @"
<title>$HtmlTabName</title>
Expand All @@ -2721,20 +2685,9 @@ $JumpToTop
$html | Out-File -Encoding utf8 -FilePath "$HTMLFilePath"

#Perfmon
if ($DebugInfo) {
Write-Host " ->Converting perfmon stats to HTML" -fore yellow
}
$HtmlTabName = "Perfmon Stats Since Instance Startup"
#$htmlTable = $PerfmonTbl | Select-Object "Pattern",
#@{Name = "ObjectName"; Expression = { $_."object_name" } },
#@{Name = "CounterName"; Expression = { $_."counter_name" } },
#@{Name = "InstanceName"; Expression = { $_."instance_name" } },
#@{Name = "FirstSampleTime"; Expression = { if ($_."FirstSampleTime" -ne [System.DBNull]::Value) { [string]$DateTepm = $_."FirstSampleTime"; $DateForExcel = $DateTepm | Get-Date; $DateForExcel.ToString("yyyy-MM-dd HH:mm:ss") }else { $_."FirstSampleTime" } } },
#"FirstSampleValue",
#@{Name = "LastSampleTime"; Expression = { if ($_."LastSampleTime" -ne [System.DBNull]::Value) { [string]$DateTepm = $_."LastSampleTime"; $DateForExcel = $DateTepm | Get-Date; $DateForExcel.ToString("yyyy-MM-dd HH:mm:ss") }else { $_."LastSampleTime" } } },
#"LastSampleValue", "ValueDelta", "ValuePerSecond" | ConvertTo-Html -As Table -Fragment
#$htmlTable = $htmlTable -replace '<table>', '<table id="PerfmonTable" class="Perfmon sortable">'
$htmlTable = Convert-TableToHtml $PerfmonTbl -NoCaseChange -TblID "PerfmonTable" -CSSClass "Perfmon sortable"

$htmlTable = Convert-TableToHtml $PerfmonTbl -NoCaseChange -TblID "PerfmonTable" -CSSClass "Perfmon sortable" -DebugInfo:$DebugInfo

$html = $HTMLPre + @"
<title>$HtmlTabName</title>
Expand Down

0 comments on commit dd0d4e6

Please sign in to comment.