Skip to content

Commit f5b3d08

Browse files
Merge pull request #1000 from dataplat/instancecheckscontinued
added some more demo [skip ci]
2 parents a51edfd + 3700bf9 commit f5b3d08

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

developing/Oslo Demo.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,48 @@ $Checks = 'ErrorLogCount', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREna
5353

5454
Invoke-PerfAndValidateCheck -Checks $Checks
5555

56+
# I want to use the results in a different way
57+
58+
# ok lets run the checks and save the out put to a variable so that we can show you what happens. Notice we need the -PassThru switch
59+
60+
$CheckResults = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false -PassThru
61+
62+
# this is our base results object
63+
$CheckResults
64+
65+
# lets convert it to something useful
66+
67+
$SomethingUseful = $CheckResults | Convert-DbcResult
68+
69+
$SomethingUseful
70+
$SomethingUseful | Format-Table
71+
72+
$SomethingUseful | Select-Object -First 1
73+
74+
# Label huh - what is that?
75+
# label these results so that they can be filtered later
76+
77+
$Coffee = $CheckResults | Convert-DbcResult -Label 'CoffeeFilter'
78+
79+
$Coffee | Select-Object -First 1
80+
81+
# Now we can set those to a file if we want
82+
83+
$CheckResults | Convert-DbcResult -Label 'CoffeeFilter' | Set-DbcFile -FileType Json -FilePath . -FileName oslo -Verbose
84+
$CheckResults | Convert-DbcResult -Label 'Whiskey' | Set-DbcFile -FileType Json -FilePath . -FileName oslo -Append
85+
86+
code ./oslo.json
87+
88+
# or put them into a database table
89+
90+
$CheckResults | Convert-DbcResult -Label 'CoffeeFilter' | Write-DbcTable -SqlInstance dbachecks1 -SqlCredential $cred -Database tempdb -Verbose
91+
92+
Invoke-DbaQuery -SqlInstance dbachecks1 -SqlCredential $cred -Database tempdb -Query 'SELECT * FROM CheckResults'
93+
94+
# YOU CANT DO THIS FROM HERE - Open Windows terminal on the host and run
95+
96+
Start-DbcPowerBi -FromDatabase
97+
98+
# then use localhost,7401 tempdb and u:sqladmin p:dbatools.IO
99+
56100
# question turn off a container adn talk about hte fails?

0 commit comments

Comments
 (0)