@@ -7,42 +7,47 @@ $containers = $SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks
7
7
$password = ConvertTo-SecureString " dbatools.IO" - AsPlainText - Force
8
8
$cred = New-Object - TypeName System.Management.Automation.PSCredential - ArgumentList " sqladmin" , $password
9
9
$show = ' All'
10
+
11
+ $PSDefaultParameterValues = @ {
12
+ " *:SQlInstance" = $SQLInstances
13
+ " *:SqlCredential" = $cred
14
+ }
10
15
# endregion
11
16
12
17
# region What do we have?
13
18
14
- Get-DbaDatabase - SqlInstance $Sqlinstances - SqlCredential $cred - ExcludeSystem | Select-Object Sqlinstance, DatabaseName , Status
19
+ Get-DbaDatabase | Select-Object Sqlinstance, Name , Status
15
20
16
- Get-DbaAgentJob - SqlInstance $Sqlinstances - SqlCredential $cred | Select-Object Sqlinstance, Name, Enabled
21
+ Get-DbaAgentJob | Select-Object Sqlinstance, Name, Enabled
17
22
# end region
18
23
19
- Get-DbaLastBackup - SqlInstance $Sqlinstances - SqlCredential $cred | Select-Object Sqlinstance, Database, LastFullBackup | Format-Table
24
+ Get-DbaLastBackup | Select-Object Sqlinstance, Database, LastFullBackup | Format-Table
20
25
21
26
# lets run a couple of tests
22
27
23
28
# this one shows that the old existing code will work
24
29
# the legacy switch is set to true by default
25
30
26
- Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check InstanceConnection, DatabaseStatus - Show $show
31
+ Invoke-DbcCheck - Check InstanceConnection, DatabaseStatus - Show $show
27
32
28
33
# So lets show the shiny new faster code - legacy switch set to false
29
34
30
- Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false
35
+ Invoke-DbcCheck - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false
31
36
32
37
33
38
# The Authentication check failed but we would like to pass - lets set config
34
39
Set-DbcConfig - Name policy.connection.authscheme - Value SQL
35
40
36
41
# run again
37
42
38
- Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false
43
+ Invoke-DbcCheck - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false
39
44
40
45
# Hmmm, we know that we will never be able to remote onto these containers so let talk about skipping. No Claudio not that sort of skipping!!
41
46
Set-DbcConfig - Name skip.connection.remoting - Value $true
42
47
43
48
# run again
44
49
45
- Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false
50
+ Invoke-DbcCheck - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false
46
51
47
52
# So much quicker !!! OK for one check it will be slower. For two it will probably be about the same but for 3 or more it will be quicker. Much quicket. Exrapolate that to 100 checks and a 1000 instances you can see the difference.
48
53
@@ -57,7 +62,7 @@ Invoke-PerfAndValidateCheck -Checks $Checks
57
62
58
63
# 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
64
60
- $CheckResults = Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false - PassThru
65
+ $CheckResults = Invoke-DbcCheck - Check InstanceConnection, DatabaseStatus - Show $show - legacy $false - PassThru
61
66
62
67
# this is our base results object
63
68
$CheckResults
@@ -68,6 +73,7 @@ $SomethingUseful = $CheckResults | Convert-DbcResult
68
73
69
74
$SomethingUseful
70
75
$SomethingUseful | Format-Table
76
+ # TODO: fix this Checking Instance Connection on on dbachecks3
71
77
72
78
$SomethingUseful | Select-Object - First 1
73
79
@@ -87,23 +93,25 @@ code ./oslo.json
87
93
88
94
# or put them into a database table
89
95
90
- $CheckResults | Convert-DbcResult - Label ' CoffeeFilter ' | Write-DbcTable - SqlInstance dbachecks1 - SqlCredential $cred - Database tempdb - Verbose
96
+ $CheckResults | Convert-DbcResult - Label ' claudiodidthis ' | Write-DbcTable - SqlInstance dbachecks1 - SqlCredential $cred - Database tempdb
91
97
92
- Invoke-DbaQuery - SqlInstance dbachecks1 - SqlCredential $cred - Database tempdb - Query ' SELECT * FROM CheckResults'
98
+ Invoke-DbaQuery - SqlInstance dbachecks1 - SqlCredential $cred - Database tempdb - Query ' SELECT COUNT(*) FROM CheckResults'
93
99
100
+ # AUDIENCE AND OTHER PRESENTERS - WE NEED REMINDERS HERE !!!
94
101
# YOU CANT DO THIS FROM HERE - Open Windows terminal on the host and run
95
102
96
103
Start-DbcPowerBi - FromDatabase
97
104
105
+ # AUDIENCE AND OTHER PRESENTERS - WE NEED REMINDERS HERE !!!
98
106
# then use localhost,7401 tempdb and u:sqladmin p:dbatools.IO
99
107
100
- # question turn off a container adn talk about hte fails?
108
+ # question turn off a container and talk about the fails?
101
109
102
110
103
111
# # made some funky results for the Power Bi
104
112
105
- $CheckResults = Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check Instance, Database - Show $show - legacy $false - PassThru
113
+ $CheckResults = Invoke-DbcCheck - Check Instance, Database - Show $show - legacy $false - PassThru
106
114
107
115
$CheckResults | Convert-DbcResult - Label ' DatabaseInstance' | Write-DbcTable - SqlInstance dbachecks1 - SqlCredential $cred - Database tempdb - Verbose
108
116
109
- $CheckResults = Invoke-DbcCheck - SqlInstance $Sqlinstances - SqlCredential $cred - Check compatibilitylevel - Show $show - legacy $false - PassThru
117
+ $CheckResults = Invoke-DbcCheck - Check compatibilitylevel - Show $show - legacy $false - PassThru
0 commit comments