Skip to content

Commit 75c6c1b

Browse files
committed
Merge branch 'development' of https://github.com/dataplat/dbatools into pester_cleanup
2 parents 1b097d1 + 0065ab6 commit 75c6c1b

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

public/Find-DbaDbGrowthEvent.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ function Find-DbaDbGrowthEvent {
181181
FROM::fn_trace_gettable( @base_tracefilename, DEFAULT )
182182
WHERE
183183
[EventClass] IN ($eventClassFilter)
184-
AND [ServerName] = @@SERVERNAME
185184
AND [DatabaseName] IN (_DatabaseList_)
186185
ORDER BY [StartTime] DESC;
187186
END

public/Get-DbaClientProtocol.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Get-DbaClientProtocol {
6666
if ( $server.FullComputerName ) {
6767
$computer = $server.FullComputerName
6868
Write-Message -Level Verbose -Message "Getting SQL Server namespace on $computer"
69-
$namespace = Get-DbaCmObject -ComputerName $computer -Namespace root\Microsoft\SQLServer -Query "Select * FROM __NAMESPACE WHERE Name LIke 'ComputerManagement%'" -ErrorAction SilentlyContinue | Where-Object { (Get-DbaCmObject -ComputerName $computer -Namespace $("root\Microsoft\SQLServer\" + $_.Name) -ClassName ClientNetworkProtocol -ErrorAction SilentlyContinue).count -gt 0 } | Sort-Object Name -Descending | Select-Object -First 1
69+
$namespace = Get-DbaCmObject -ComputerName $computer -Namespace root\Microsoft\SQLServer -Query "Select * FROM __NAMESPACE WHERE Name LIke 'ComputerManagement%'" -ErrorAction SilentlyContinue | Sort-Object Name -Descending | Select-Object -First 1
7070

7171
if ( $namespace.Name ) {
7272
Write-Message -Level Verbose -Message "Getting Cim class ClientNetworkProtocol in Namespace $($namespace.Name) on $computer"

public/Install-DbaAgentAdminAlert.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function Install-DbaAgentAdminAlert {
150150

151151
if ($Operator) {
152152
try {
153-
$newop = Get-DbaAgentOperator -SqlInstance $server
153+
$newop = Get-DbaAgentOperator -SqlInstance $server -Operator $Operator
154154
if (-not $newop -and $OperatorEmail) {
155155
if ($PSCmdlet.ShouldProcess($instance, "Creating operator $Operator with email $OperatorEmail")) {
156156
Write-Message -Level Verbose -Message "Creating operator $Operator with email $OperatorEmail on $instance"
@@ -160,13 +160,14 @@ function Install-DbaAgentAdminAlert {
160160
Email = $OperatorEmail
161161
}
162162
$newop = New-DbaAgentOperator @parms
163+
$null = $server.JobServer.Operators.Refresh()
164+
$null = $server.JobServer.Refresh()
163165

164166
if (-not $newop) {
165167
$parms = @{
166-
Message = "Failed to create operator $Operator with email $OperatorEmail on $instance"
167-
Target = $instance
168-
Continue = $true
169-
ErrorRecord = $PSItem
168+
Message = "Failed to create operator $Operator with email $OperatorEmail on $instance"
169+
Target = $instance
170+
Continue = $true
170171
}
171172
Stop-Function @parms
172173
}
@@ -191,10 +192,9 @@ function Install-DbaAgentAdminAlert {
191192

192193
if (-not $newcat) {
193194
$parms = @{
194-
Message = "Failed to create category $Category on $instance"
195-
Target = $instance
196-
Continue = $true
197-
ErrorRecord = $PSItem
195+
Message = "Failed to create category $Category on $instance"
196+
Target = $instance
197+
Continue = $true
198198
}
199199
Stop-Function @parms
200200
}
@@ -288,7 +288,7 @@ function Install-DbaAgentAdminAlert {
288288
if ($PSCmdlet.ShouldProcess($instance, "Adding the alert $name")) {
289289
try {
290290
# Supply either a non-zero message ID, non-zero severity, non-null performance condition, or non-null WMI namespace and query.
291-
$null = New-DbaAgentAlert @parms
291+
$null = New-DbaAgentAlert @parms -EnableException
292292
} catch {
293293
Stop-Function -Message "Something went wrong creating the alert $name on $instance" -Target $name -Continue -ErrorRecord $_
294294
}

public/Remove-DbaDatabaseSafely.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ function Remove-DbaDatabaseSafely {
365365

366366
## Create a Job Category
367367
if (!(Get-DbaAgentJobCategory -SqlInstance $destination -SqlCredential $DestinationSqlCredential -Category $categoryname)) {
368-
New-DbaAgentJobCategory -SqlInstance $destination -SqlCredential $DestinationSqlCredential -Category $categoryname -EnableException
368+
$null = New-DbaAgentJobCategory -SqlInstance $destination -SqlCredential $DestinationSqlCredential -Category $categoryname -EnableException
369369
}
370370

371371
try {

public/Test-DbaDiskAllocation.ps1

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ function Test-DbaDiskAllocation {
8585

8686
try {
8787
Write-Message -Level Verbose -Message "Getting disk information from $computer."
88-
89-
# $query = "Select Label, BlockSize, Name from Win32_Volume WHERE FileSystem='NTFS'"
90-
# $disks = Get-WmiObject -ComputerName $ipaddr -Query $query | Sort-Object -Property Name
9188
$disks = Get-CimInstance -CimSession $CIMsession -ClassName win32_volume -Filter "FileSystem='NTFS'" -ErrorAction Stop | Sort-Object -Property Name
9289
} catch {
9390
Stop-Function -Message "Can't connect to WMI on $computer."
@@ -106,9 +103,9 @@ function Test-DbaDiskAllocation {
106103
Write-Message -Level Verbose -Message "Found instance $instanceName."
107104

108105
if ($instance -eq 'MSSQLSERVER') {
109-
$SqlInstances += $ipaddr
106+
$SqlInstances += $computer
110107
} else {
111-
$SqlInstances += "$ipaddr\$instance"
108+
$SqlInstances += "$computer\$instance"
112109
}
113110
}
114111
$sqlcount = $SqlInstances.Count
@@ -182,7 +179,6 @@ function Test-DbaDiskAllocation {
182179
foreach ($computer in $ComputerName) {
183180

184181
$computer = Resolve-DbaNetworkName -ComputerName $computer -Credential $Credential
185-
$ipaddr = $computer.IpAddress
186182
$Computer = $computer.FullComputerName
187183

188184
if (!$Computer) {

0 commit comments

Comments
 (0)