diff --git a/bin/build-project.ps1 b/bin/build-project.ps1 index 356a4823cf..75ae615a57 100644 --- a/bin/build-project.ps1 +++ b/bin/build-project.ps1 @@ -4,26 +4,23 @@ param( [ValidateSet('ps3', 'ps4', 'Release', 'Debug')] [string] $MsbuildConfiguration = "Release", [string] $MsbuildOptions = "", - [Parameter(HelpMessage='Target to run instead of build')] + [Parameter(HelpMessage = 'Target to run instead of build')] [string] $MsbuildTarget = 'Build' ) -if (-not $PSBoundParameters.ContainsKey('MsbuildConfiguration')) -{ - $_MsbuildConfiguration = switch ($PSVersionTable.PSVersion.Major) - { +if (-not $PSBoundParameters.ContainsKey('MsbuildConfiguration')) { + $_MsbuildConfiguration = switch ($PSVersionTable.PSVersion.Major) { 3 { "ps3" } 4 { "ps4" } default { "Release" } } -} -else { $_MsbuildConfiguration = $MsbuildConfiguration } +} else { $_MsbuildConfiguration = $MsbuildConfiguration } function Get-MsBuildPath { [CmdletBinding()] [OutputType([string])] param() - process{ + process { $rawPath = "$(Split-Path ([string].Assembly.Location))\msbuild.exe" (Resolve-Path $rawPath).Path } @@ -60,10 +57,9 @@ if ($MsbuildTarget -eq 'Build') { if ($script:alwaysBuildLibrary) { Move-Item -Path "$PSModuleRoot\bin\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop } else { Copy-Item -Path "$PSModuleRoot\bin\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop } Add-Type -Path "$PSModuleRoot\dbatools.dll" -ErrorAction Stop - } - catch { + } catch { Write-Verbose -Message "Failed to copy & import, attempting to import straight from the module directory" Add-Type -Path "$PSModuleRoot\bin\dbatools.dll" -ErrorAction Stop } Write-Verbose -Message "Total duration: $((Get-Date) - $start)" -} +} \ No newline at end of file diff --git a/bin/build/vsts-build.ps1 b/bin/build/vsts-build.ps1 index 3b270b01cb..01c6a12618 100644 --- a/bin/build/vsts-build.ps1 +++ b/bin/build/vsts-build.ps1 @@ -39,8 +39,7 @@ $previousVersion = Import-Clixml ".\vsts-version.xml" $currentVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo((Get-Item "bin\dbatools.dll").FullName).FileVersion Remove-Item ".\vsts-version.xml" -if ($previousVersion -ne $currentVersion) -{ +if ($previousVersion -ne $currentVersion) { $branch = $env:BUILD_SOURCEBRANCHNAME Write-Host "Previous: $previousVersion | Current: $currentVersion | Library should be updated" @@ -48,8 +47,6 @@ if ($previousVersion -ne $currentVersion) git commit -m "VSTS Library Compile ***NO_CI***" $errorMessage = git push "https://$env:SYSTEM_ACCESSTOKEN@github.com/sqlcollaborative/dbatools.git" head:$branch 2>&1 if ($LASTEXITCODE -gt 0) { throw $errorMessage } -} -else -{ +} else { Write-Host "Version: $currentVersion | Library is up to date" -} +} \ No newline at end of file diff --git a/bin/build/vsts-prebuild.ps1 b/bin/build/vsts-prebuild.ps1 index 965def9b37..f11c14349c 100644 --- a/bin/build/vsts-prebuild.ps1 +++ b/bin/build/vsts-prebuild.ps1 @@ -1,3 +1,3 @@ $item = Get-Item "bin\dbatools.dll" $version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($item.FullName).FileVersion -$version | Export-Clixml ".\vsts-version.xml" +$version | Export-Clixml ".\vsts-version.xml" \ No newline at end of file diff --git a/bin/library.ps1 b/bin/library.ps1 index 71f572dc16..c9222c3622 100644 --- a/bin/library.ps1 +++ b/bin/library.ps1 @@ -39,8 +39,7 @@ if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Configu # No need to load the library again, if the module was once already imported. Write-Verbose -Message "Library already loaded, will not load again" $ImportLibrary = $false -} -else { +} else { Write-Verbose -Message "Library not present already, will import" $ImportLibrary = $true } @@ -54,8 +53,7 @@ if ($ImportLibrary) { if ($script:strictSecurityMode) { if (Test-Path -Path "$libraryBase\dbatools.dll") { Add-Type -Path "$libraryBase\dbatools.dll" -ErrorAction Stop - } - else { + } else { throw "Library not found, terminating!" } } @@ -70,17 +68,14 @@ if ($ImportLibrary) { Write-Verbose -Message "Found library, trying to copy & import" if ($libraryBase -ne $script:DllRoot) { Copy-Item -Path "$libraryBase\dbatools.dll" -Destination $script:DllRoot -Force -ErrorAction Stop } Add-Type -Path "$script:DllRoot\dbatools.dll" -ErrorAction Stop - } - catch { + } catch { Write-Verbose -Message "Failed to copy&import, attempting to import straight from the module directory" Add-Type -Path "$libraryBase\dbatools.dll" -ErrorAction Stop } Write-Verbose -Message "Total duration: $((Get-Date) - $start)" - } - elseif ($hasProject) { + } elseif ($hasProject) { . Import-ModuleFile "$($script:PSModuleRoot)\bin\build-project.ps1" - } - else { + } else { throw "No valid dbatools library found! Check your module integrity" } } @@ -89,8 +84,7 @@ if ($ImportLibrary) { Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsException" -SerializationDepth 2 -ErrorAction Ignore Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsExceptionRecord" -SerializationDepth 2 -ErrorAction Ignore #endregion PowerShell TypeData - } - catch { + } catch { #region Warning Write-Warning @' Dear User, @@ -138,5 +132,4 @@ Please restart the console to apply the library update, or unexpected behavior w If the issues continue to persist, please Remove-Item '$script:PSModuleRoot\bin\dbatools.dll' "@ } -#endregion Version Warning - +#endregion Version Warning \ No newline at end of file diff --git a/bin/type-extensions.ps1 b/bin/type-extensions.ps1 index 41bf4858a0..f0e7d57367 100644 --- a/bin/type-extensions.ps1 +++ b/bin/type-extensions.ps1 @@ -42,4 +42,4 @@ if (-not ([Sqlcollaborative.Dbatools.dbaSystem.SystemHost]::ModuleImported)) { $this.ExecuteNonQuery($Command) } -ErrorAction Ignore -} +} \ No newline at end of file diff --git a/bin/typealiases.ps1 b/bin/typealiases.ps1 index 514fcbbaa6..cc8bdaab1b 100644 --- a/bin/typealiases.ps1 +++ b/bin/typealiases.ps1 @@ -29,8 +29,6 @@ $TypeAliasTable = @{ foreach ($TypeAlias in $TypeAliasTable.Keys) { try { $TAType::Add($TypeAlias, $TypeAliasTable[$TypeAlias]) + } catch { } - catch { - } -} - +} \ No newline at end of file diff --git a/functions/Add-DbaAgDatabase.ps1 b/functions/Add-DbaAgDatabase.ps1 index 1e82226b69..aa8c050839 100644 --- a/functions/Add-DbaAgDatabase.ps1 +++ b/functions/Add-DbaAgDatabase.ps1 @@ -62,7 +62,7 @@ function Add-DbaAgDatabase { PS C:\> Get-DbaDbSharePoint -SqlInstance sqlcluster -ConfigDatabase SharePoint_Config_2019 | Add-DbaAgDatabase -AvailabilityGroup SharePoint Adds SharePoint databases as found in SharePoint_Config_2019 on sqlcluster to ag1 on sqlcluster -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -103,5 +103,4 @@ function Add-DbaAgDatabase { } } } -} - +} \ No newline at end of file diff --git a/functions/Add-DbaAgListener.ps1 b/functions/Add-DbaAgListener.ps1 index e30d1485e2..04a79f6c8a 100644 --- a/functions/Add-DbaAgListener.ps1 +++ b/functions/Add-DbaAgListener.ps1 @@ -65,7 +65,7 @@ function Add-DbaAgListener { Creates a listener on port 1433 with a dynamic IP for the group1 availability group on sql2017. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Add-DbaAgReplica.ps1 b/functions/Add-DbaAgReplica.ps1 index 77ffd208b4..e3db1bae93 100644 --- a/functions/Add-DbaAgReplica.ps1 +++ b/functions/Add-DbaAgReplica.ps1 @@ -92,7 +92,7 @@ function Add-DbaAgReplica { PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql2017a -AvailabilityGroup SharePoint | Add-DbaAgReplica -SqlInstance sql2017b -FailoverMode Manual Adds sql2017b to the SharePoint availability group on sql2017a with a manual failover mode. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -203,4 +203,4 @@ function Add-DbaAgReplica { } } } -} +} \ No newline at end of file diff --git a/functions/Add-DbaCmsRegServer.ps1 b/functions/Add-DbaCmsRegServer.ps1 index e9ffbec6f3..f7e31d6390 100644 --- a/functions/Add-DbaCmsRegServer.ps1 +++ b/functions/Add-DbaCmsRegServer.ps1 @@ -74,7 +74,7 @@ function Add-DbaCmsRegServer { Creates a registered server on sql2008's CMS which points to the SQL Server, sql01. When scrolling in CMS, the name "sql01" will be visible within the Seattle group which is in the hr group. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -142,5 +142,4 @@ function Add-DbaCmsRegServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Add-DbaRegisteredServer } -} - +} \ No newline at end of file diff --git a/functions/Add-DbaCmsRegServerGroup.ps1 b/functions/Add-DbaCmsRegServerGroup.ps1 index 743c53d45d..0a0d94a1e2 100644 --- a/functions/Add-DbaCmsRegServerGroup.ps1 +++ b/functions/Add-DbaCmsRegServerGroup.ps1 @@ -64,7 +64,7 @@ function Add-DbaCmsRegServerGroup { Creates a registered server group on sql2012 and sql2014 called sub-folder within the HR group of each server -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -116,5 +116,4 @@ function Add-DbaCmsRegServerGroup { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Add-DbaRegisteredServerGroup } -} - +} \ No newline at end of file diff --git a/functions/Add-DbaComputerCertificate.ps1 b/functions/Add-DbaComputerCertificate.ps1 index 5c8c1b6931..63810657bf 100644 --- a/functions/Add-DbaComputerCertificate.ps1 +++ b/functions/Add-DbaComputerCertificate.ps1 @@ -57,7 +57,7 @@ function Add-DbaComputerCertificate { Adds the local C:\temp\cert.cer to the local computer's LocalMachine\My (Personal) certificate store. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] param ( [Alias("ServerInstance", "SqlServer", "SqlInstance")] @@ -147,5 +147,4 @@ function Add-DbaComputerCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Add-DbaDbMirrorMonitor.ps1 b/functions/Add-DbaDbMirrorMonitor.ps1 index 649253ed48..21ff9f5a1f 100644 --- a/functions/Add-DbaDbMirrorMonitor.ps1 +++ b/functions/Add-DbaDbMirrorMonitor.ps1 @@ -42,7 +42,7 @@ function Add-DbaDbMirrorMonitor { Creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on sql2008 and sql2012. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -73,5 +73,4 @@ function Add-DbaDbMirrorMonitor { } } } -} - +} \ No newline at end of file diff --git a/functions/Add-DbaPfDataCollectorCounter.ps1 b/functions/Add-DbaPfDataCollectorCounter.ps1 index 0251cee57f..2584733290 100644 --- a/functions/Add-DbaPfDataCollectorCounter.ps1 +++ b/functions/Add-DbaPfDataCollectorCounter.ps1 @@ -59,7 +59,7 @@ function Add-DbaPfDataCollectorCounter { Allows you to select which Data Collector you'd like to add the counter '\LogicalDisk(*)\Avg. Disk Queue Length' on localhost and prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -138,5 +138,4 @@ function Add-DbaPfDataCollectorCounter { } } } -} - +} \ No newline at end of file diff --git a/functions/Backup-DbaDatabase.ps1 b/functions/Backup-DbaDatabase.ps1 index bc305d07a3..ee61016ef3 100644 --- a/functions/Backup-DbaDatabase.ps1 +++ b/functions/Backup-DbaDatabase.ps1 @@ -168,7 +168,7 @@ function Backup-DbaDatabase { PS C:\> Backup-DbaDatabase -SqlInstance Sql2017 -Database master -BackupFileName NUL Performs a backup of master, but sends the output to the NUL device (ie; throws it away) -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")] #For AzureCredential param ( diff --git a/functions/Backup-DbaDbCertificate.ps1 b/functions/Backup-DbaDbCertificate.ps1 index 332053be8c..a62a4f7b08 100644 --- a/functions/Backup-DbaDbCertificate.ps1 +++ b/functions/Backup-DbaDbCertificate.ps1 @@ -109,7 +109,7 @@ function Backup-DbaDbCertificate { Exports all certificates found on sql2016 to the default data directory. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [parameter(Mandatory, ParameterSetName = "instance")] @@ -248,5 +248,4 @@ function Backup-DbaDbCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Backup-DbaDbMasterKey.ps1 b/functions/Backup-DbaDbMasterKey.ps1 index 9671786bf0..b052d32ac2 100644 --- a/functions/Backup-DbaDbMasterKey.ps1 +++ b/functions/Backup-DbaDbMasterKey.ps1 @@ -68,7 +68,7 @@ function Backup-DbaDbMasterKey { Logs into sql2016 with Windows credentials then backs up db1's keys to the \\nas\sqlbackups\keys directory. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -158,5 +158,4 @@ function Backup-DbaDbMasterKey { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Backup-DbaDatabaseMasterKey } -} - +} \ No newline at end of file diff --git a/functions/Clear-DbaConnectionPool.ps1 b/functions/Clear-DbaConnectionPool.ps1 index 91001b6107..64368cd524 100644 --- a/functions/Clear-DbaConnectionPool.ps1 +++ b/functions/Clear-DbaConnectionPool.ps1 @@ -42,7 +42,7 @@ function Clear-DbaConnectionPool { Clears all connection pools on workstation27. -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -81,4 +81,4 @@ function Clear-DbaConnectionPool { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Clear-DbaSqlConnectionPool } -} +} \ No newline at end of file diff --git a/functions/Clear-DbaLatchStatistics.ps1 b/functions/Clear-DbaLatchStatistics.ps1 index a6e695af14..d2e36e1d67 100644 --- a/functions/Clear-DbaLatchStatistics.ps1 +++ b/functions/Clear-DbaLatchStatistics.ps1 @@ -54,7 +54,7 @@ function Clear-DbaLatchStatistics { PS C:\> Clear-DbaLatchStatistics -SqlInstance sql2008 -SqlCredential $cred Connects using sqladmin credential and clears latch statistics on servers sql2008 and sqlserver2012 -#> + #> [CmdletBinding(ConfirmImpact = 'High', SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Singular Noun doesn't make sense")] param ( @@ -92,4 +92,4 @@ function Clear-DbaLatchStatistics { } } } -} +} \ No newline at end of file diff --git a/functions/Clear-DbaPlanCache.ps1 b/functions/Clear-DbaPlanCache.ps1 index 4e11187242..889f311d09 100644 --- a/functions/Clear-DbaPlanCache.ps1 +++ b/functions/Clear-DbaPlanCache.ps1 @@ -59,7 +59,7 @@ function Clear-DbaPlanCache { PS C:\> Find-DbaInstance -ComputerName localhost | Get-DbaPlanCache | Clear-DbaPlanCache -Threshold 200 Scans localhost for instances using the browser service, traverses all instances and gets the plan cache for each, clears them out if they are above 200 MB. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer", "SqlServers")] @@ -107,5 +107,4 @@ function Clear-DbaPlanCache { } } } -} - +} \ No newline at end of file diff --git a/functions/Clear-DbaWaitStatistics.ps1 b/functions/Clear-DbaWaitStatistics.ps1 index d446435fdc..7561666029 100644 --- a/functions/Clear-DbaWaitStatistics.ps1 +++ b/functions/Clear-DbaWaitStatistics.ps1 @@ -44,7 +44,7 @@ function Clear-DbaWaitStatistics { Clears wait stats on servers sql2008 and sqlserver2012, without prompting -#> + #> [CmdletBinding(ConfirmImpact = 'High', SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Singular Noun doesn't make sense")] param ( @@ -81,4 +81,4 @@ function Clear-DbaWaitStatistics { } } } -} +} \ No newline at end of file diff --git a/functions/Connect-DbaInstance.ps1 b/functions/Connect-DbaInstance.ps1 index 296dd9318b..c1c985e0ec 100644 --- a/functions/Connect-DbaInstance.ps1 +++ b/functions/Connect-DbaInstance.ps1 @@ -168,7 +168,7 @@ function Connect-DbaInstance { Connects with ReadOnly ApplicationIntent. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -388,5 +388,4 @@ function Connect-DbaInstance { $server } } -} - +} \ No newline at end of file diff --git a/functions/ConvertTo-DbaDataTable.ps1 b/functions/ConvertTo-DbaDataTable.ps1 index 2f7422e01d..b8dc937b5c 100644 --- a/functions/ConvertTo-DbaDataTable.ps1 +++ b/functions/ConvertTo-DbaDataTable.ps1 @@ -65,7 +65,7 @@ function ConvertTo-DbaDataTable { Creates a DataTable with the running processes and converts any TimeSpan property to TotalSeconds. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] [OutputType([System.Object[]])] @@ -398,5 +398,4 @@ function ConvertTo-DbaDataTable { Write-Message -Level InternalComment -Message "Finished." , $datatable } -} - +} \ No newline at end of file diff --git a/functions/ConvertTo-DbaTimeline.ps1 b/functions/ConvertTo-DbaTimeline.ps1 index d570177e82..9771350b80 100644 --- a/functions/ConvertTo-DbaTimeline.ps1 +++ b/functions/ConvertTo-DbaTimeline.ps1 @@ -55,7 +55,7 @@ function ConvertTo-DbaTimeline { Sends an email to dba@ad.local with the results of Get-DbaBackupHistory. Note that viewing these reports may not be supported in all email clients. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -212,5 +212,4 @@ function ConvertTo-DbaTimeline { "@ $begin, $body, $end } -} - +} \ No newline at end of file diff --git a/functions/ConvertTo-DbaXESession.ps1 b/functions/ConvertTo-DbaXESession.ps1 index eaf4425b4d..a99e979319 100644 --- a/functions/ConvertTo-DbaXESession.ps1 +++ b/functions/ConvertTo-DbaXESession.ps1 @@ -47,7 +47,7 @@ function ConvertTo-DbaXESession { Converts trace ID 1 on sql2014 to an Extended Event and outputs the resulting T-SQL. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -114,5 +114,4 @@ function ConvertTo-DbaXESession { } } } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentAlert.ps1 b/functions/Copy-DbaAgentAlert.ps1 index 7866edf903..20fa7a2f4f 100644 --- a/functions/Copy-DbaAgentAlert.ps1 +++ b/functions/Copy-DbaAgentAlert.ps1 @@ -71,7 +71,7 @@ function Copy-DbaAgentAlert { Shows what would happen if the command were executed using force. -#> + #> [cmdletbinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -306,5 +306,4 @@ function Copy-DbaAgentAlert { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlAlert } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentCategory.ps1 b/functions/Copy-DbaAgentCategory.ps1 index 8d101fe453..edb6722da6 100644 --- a/functions/Copy-DbaAgentCategory.ps1 +++ b/functions/Copy-DbaAgentCategory.ps1 @@ -81,7 +81,7 @@ function Copy-DbaAgentCategory { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldprocess = $true)] param ( [parameter(Mandatory)] @@ -398,5 +398,4 @@ function Copy-DbaAgentCategory { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlAgentCategory } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentJob.ps1 b/functions/Copy-DbaAgentJob.ps1 index b00af1f822..c81019277b 100644 --- a/functions/Copy-DbaAgentJob.ps1 +++ b/functions/Copy-DbaAgentJob.ps1 @@ -72,7 +72,7 @@ function Copy-DbaAgentJob { Shows what would happen if the command were executed using force. -#> + #> [cmdletbinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -278,5 +278,4 @@ function Copy-DbaAgentJob { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlJob } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentOperator.ps1 b/functions/Copy-DbaAgentOperator.ps1 index f0b32c9214..ac559d4e86 100644 --- a/functions/Copy-DbaAgentOperator.ps1 +++ b/functions/Copy-DbaAgentOperator.ps1 @@ -68,7 +68,7 @@ function Copy-DbaAgentOperator { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -173,5 +173,4 @@ function Copy-DbaAgentOperator { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlOperator } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentProxyAccount.ps1 b/functions/Copy-DbaAgentProxyAccount.ps1 index 76e8f0b426..1e85aec27e 100644 --- a/functions/Copy-DbaAgentProxyAccount.ps1 +++ b/functions/Copy-DbaAgentProxyAccount.ps1 @@ -68,7 +68,7 @@ function Copy-DbaAgentProxyAccount { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -200,5 +200,4 @@ function Copy-DbaAgentProxyAccount { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlProxyAccount } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentServer.ps1 b/functions/Copy-DbaAgentServer.ps1 index 1289ac6d7b..e9db4c3a80 100644 --- a/functions/Copy-DbaAgentServer.ps1 +++ b/functions/Copy-DbaAgentServer.ps1 @@ -68,7 +68,7 @@ function Copy-DbaAgentServer { Shows what would happen if the command were executed. -#> + #> [cmdletbinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -171,5 +171,4 @@ function Copy-DbaAgentServer { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlServerAgent Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-DbaSqlServerAgent } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaAgentSharedSchedule.ps1 b/functions/Copy-DbaAgentSharedSchedule.ps1 index 660dbe091d..3306c7ea4d 100644 --- a/functions/Copy-DbaAgentSharedSchedule.ps1 +++ b/functions/Copy-DbaAgentSharedSchedule.ps1 @@ -57,7 +57,7 @@ function Copy-DbaAgentSharedSchedule { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -161,5 +161,4 @@ function Copy-DbaAgentSharedSchedule { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlSharedSchedule } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaBackupDevice.ps1 b/functions/Copy-DbaBackupDevice.ps1 index c5bb186a3e..10b1a0b064 100644 --- a/functions/Copy-DbaBackupDevice.ps1 +++ b/functions/Copy-DbaBackupDevice.ps1 @@ -65,7 +65,7 @@ function Copy-DbaBackupDevice { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -216,5 +216,4 @@ function Copy-DbaBackupDevice { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlBackupDevice } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaCentralManagementServer.ps1 b/functions/Copy-DbaCentralManagementServer.ps1 index e8088bb23e..483b6b73a4 100644 --- a/functions/Copy-DbaCentralManagementServer.ps1 +++ b/functions/Copy-DbaCentralManagementServer.ps1 @@ -72,7 +72,7 @@ function Copy-DbaCentralManagementServer { If SwitchServerName is not specified, "sqlcluster" will be skipped. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -317,5 +317,4 @@ function Copy-DbaCentralManagementServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlCentralManagementServer } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaCredential.ps1 b/functions/Copy-DbaCredential.ps1 index 6ec2ad8c19..2ed75353d3 100644 --- a/functions/Copy-DbaCredential.ps1 +++ b/functions/Copy-DbaCredential.ps1 @@ -78,7 +78,7 @@ function Copy-DbaCredential { Copies over one SQL Server Credential (PowerShell Proxy Account) from sqlserver to sqlcluster. If the Credential already exists on the destination, it will be dropped and recreated. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory)] @@ -216,5 +216,4 @@ function Copy-DbaCredential { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlCredential } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaCustomError.ps1 b/functions/Copy-DbaCustomError.ps1 index 3bc7f1dd1a..39a99f34c9 100644 --- a/functions/Copy-DbaCustomError.ps1 +++ b/functions/Copy-DbaCustomError.ps1 @@ -73,7 +73,7 @@ function Copy-DbaCustomError { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -175,5 +175,4 @@ function Copy-DbaCustomError { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlCustomError } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaDataCollector.ps1 b/functions/Copy-DbaDataCollector.ps1 index 4a4cbc01aa..32deda3412 100644 --- a/functions/Copy-DbaDataCollector.ps1 +++ b/functions/Copy-DbaDataCollector.ps1 @@ -76,7 +76,7 @@ function Copy-DbaDataCollector { Copies two Collection Sets, Server Activity and Table Usage Analysis, from sqlserver2014a to sqlcluster. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -248,5 +248,4 @@ function Copy-DbaDataCollector { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-DbaSqlDataCollector if (Test-FunctionInterrupt) { return } } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaDatabase.ps1 b/functions/Copy-DbaDatabase.ps1 index 6dd189424a..6df81b626e 100644 --- a/functions/Copy-DbaDatabase.ps1 +++ b/functions/Copy-DbaDatabase.ps1 @@ -162,7 +162,7 @@ function Copy-DbaDatabase { It also includes the support databases (ReportServer, ReportServerTempDb, distribution). -#> + #> [CmdletBinding(DefaultParameterSetName = "DbBackup", SupportsShouldProcess = $true)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( diff --git a/functions/Copy-DbaDbAssembly.ps1 b/functions/Copy-DbaDbAssembly.ps1 index 1813b69fec..c46982cd5c 100644 --- a/functions/Copy-DbaDbAssembly.ps1 +++ b/functions/Copy-DbaDbAssembly.ps1 @@ -72,7 +72,7 @@ function Copy-DbaDbAssembly { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -232,5 +232,4 @@ function Copy-DbaDbAssembly { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlDatabaseAssembly Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-DbaDatabaseAssembly } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaDbMail.ps1 b/functions/Copy-DbaDbMail.ps1 index c072c5566b..843820f2c6 100644 --- a/functions/Copy-DbaDbMail.ps1 +++ b/functions/Copy-DbaDbMail.ps1 @@ -68,7 +68,7 @@ function Copy-DbaDbMail { Performs execution of function, and will throw a terminating exception if something breaks -#> + #> [cmdletbinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -418,5 +418,4 @@ function Copy-DbaDbMail { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlDatabaseMail Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-DbaDatabaseMail } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaDbTableData.ps1 b/functions/Copy-DbaDbTableData.ps1 index f48590b7cf..47023f090f 100644 --- a/functions/Copy-DbaDbTableData.ps1 +++ b/functions/Copy-DbaDbTableData.ps1 @@ -150,7 +150,7 @@ function Copy-DbaDbTableData { Copies all the data from table [Schema].[Table] in database dbatools_from on sql1 to table [dbo].[Table.Copy] in database dbatools_dest on sql2 Keeps identity columns and Nulls, truncates the destination and processes in BatchSize of 10000. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [Alias("ServerInstance", "SqlServer", "Source")] @@ -251,7 +251,7 @@ function Copy-DbaDbTableData { continue } } - + } catch { Stop-Function -Message "Unable to determine source table : $Table" return @@ -372,5 +372,4 @@ function Copy-DbaDbTableData { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-DbaTableData } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaEndpoint.ps1 b/functions/Copy-DbaEndpoint.ps1 index 82c7d00fe1..8984e66f82 100644 --- a/functions/Copy-DbaEndpoint.ps1 +++ b/functions/Copy-DbaEndpoint.ps1 @@ -68,7 +68,7 @@ function Copy-DbaEndpoint { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -165,5 +165,4 @@ function Copy-DbaEndpoint { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlEndpoint } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaExtendedEvent.ps1 b/functions/Copy-DbaExtendedEvent.ps1 index 88f3c3af6c..1e42d3a40e 100644 --- a/functions/Copy-DbaExtendedEvent.ps1 +++ b/functions/Copy-DbaExtendedEvent.ps1 @@ -73,7 +73,7 @@ function Copy-DbaExtendedEvent { Copies only the Extended Events named CheckQueries and MonitorUserDefinedException from sqlserver2014a to sqlcluster. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -191,5 +191,4 @@ function Copy-DbaExtendedEvent { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlExtendedEvent } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaLinkedServer.ps1 b/functions/Copy-DbaLinkedServer.ps1 index c6b707623b..ff3ac684b4 100644 --- a/functions/Copy-DbaLinkedServer.ps1 +++ b/functions/Copy-DbaLinkedServer.ps1 @@ -67,7 +67,7 @@ function Copy-DbaLinkedServer { Copies over two SQL Server Linked Servers (SQL2K and SQL2K2) from sqlserver to sqlcluster. If the credential already exists on the destination, it will be dropped. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -272,4 +272,4 @@ function Copy-DbaLinkedServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlLinkedServer } -} +} \ No newline at end of file diff --git a/functions/Copy-DbaLogin.ps1 b/functions/Copy-DbaLogin.ps1 index 42c2d5998a..a0500e8c27 100644 --- a/functions/Copy-DbaLogin.ps1 +++ b/functions/Copy-DbaLogin.ps1 @@ -125,7 +125,7 @@ function Copy-DbaLogin { Displays all available logins on sql2016 in a grid view, then copies all selected logins to sql2017. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess)] param ( [parameter(ParameterSetName = "SqlInstance", Mandatory)] @@ -550,5 +550,4 @@ function Copy-DbaLogin { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlLogin } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaPolicyManagement.ps1 b/functions/Copy-DbaPolicyManagement.ps1 index a299c1cb93..80900b6f0d 100644 --- a/functions/Copy-DbaPolicyManagement.ps1 +++ b/functions/Copy-DbaPolicyManagement.ps1 @@ -79,7 +79,7 @@ function Copy-DbaPolicyManagement { Copies only one policy, 'xp_cmdshell must be disabled' from sqlserver2014a to sqlcluster. No conditions are migrated. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -280,5 +280,4 @@ function Copy-DbaPolicyManagement { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlPolicyManagement Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-DbaSqlPolicyManagement } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaQueryStoreConfig.ps1 b/functions/Copy-DbaQueryStoreConfig.ps1 index 463bbf7289..18853b8847 100644 --- a/functions/Copy-DbaQueryStoreConfig.ps1 +++ b/functions/Copy-DbaQueryStoreConfig.ps1 @@ -62,7 +62,7 @@ function Copy-DbaQueryStoreConfig { Copy the Query Store configuration of the AdventureWorks database in the ServerA\SQL instance and apply it to the WorldWideTraders database in the ServerB\SQL Instance. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -167,5 +167,4 @@ function Copy-DbaQueryStoreConfig { } } } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaResourceGovernor.ps1 b/functions/Copy-DbaResourceGovernor.ps1 index d88e7387d4..58075c8bdf 100644 --- a/functions/Copy-DbaResourceGovernor.ps1 +++ b/functions/Copy-DbaResourceGovernor.ps1 @@ -68,7 +68,7 @@ function Copy-DbaResourceGovernor { Shows what would happen if the command were executed. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -333,5 +333,4 @@ function Copy-DbaResourceGovernor { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlResourceGovernor } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaServerAudit.ps1 b/functions/Copy-DbaServerAudit.ps1 index 0d9a91ae85..8d5ac1fb55 100644 --- a/functions/Copy-DbaServerAudit.ps1 +++ b/functions/Copy-DbaServerAudit.ps1 @@ -68,7 +68,7 @@ function Copy-DbaServerAudit { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -211,5 +211,4 @@ function Copy-DbaServerAudit { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlAudit } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaServerAuditSpecification.ps1 b/functions/Copy-DbaServerAuditSpecification.ps1 index 2a92a2d058..83b6601d86 100644 --- a/functions/Copy-DbaServerAuditSpecification.ps1 +++ b/functions/Copy-DbaServerAuditSpecification.ps1 @@ -68,7 +68,7 @@ function Copy-DbaServerAuditSpecification { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -191,5 +191,4 @@ function Copy-DbaServerAuditSpecification { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlAuditSpecification } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaServerTrigger.ps1 b/functions/Copy-DbaServerTrigger.ps1 index 27ade27a60..9435edeeb3 100644 --- a/functions/Copy-DbaServerTrigger.ps1 +++ b/functions/Copy-DbaServerTrigger.ps1 @@ -68,7 +68,7 @@ function Copy-DbaServerTrigger { Shows what would happen if the command were executed using force. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -178,5 +178,4 @@ function Copy-DbaServerTrigger { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlServerTrigger } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaSpConfigure.ps1 b/functions/Copy-DbaSpConfigure.ps1 index ef455556ba..eb2c4871aa 100644 --- a/functions/Copy-DbaSpConfigure.ps1 +++ b/functions/Copy-DbaSpConfigure.ps1 @@ -68,7 +68,7 @@ function Copy-DbaSpConfigure { Shows what would happen if the command were executed. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -166,5 +166,4 @@ function Copy-DbaSpConfigure { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlSpConfigure } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaSsisCatalog.ps1 b/functions/Copy-DbaSsisCatalog.ps1 index bffa83eb30..0d0fbfcfad 100644 --- a/functions/Copy-DbaSsisCatalog.ps1 +++ b/functions/Copy-DbaSsisCatalog.ps1 @@ -82,7 +82,7 @@ function Copy-DbaSsisCatalog { Deploy entire SSIS catalog to an instance without a destination catalog. User prompts for creating the catalog on Destination will be bypassed. - #> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess)] param ( [parameter(Mandatory)] diff --git a/functions/Copy-DbaSysDbUserObject.ps1 b/functions/Copy-DbaSysDbUserObject.ps1 index db69761a0f..830659a610 100644 --- a/functions/Copy-DbaSysDbUserObject.ps1 +++ b/functions/Copy-DbaSysDbUserObject.ps1 @@ -53,7 +53,7 @@ function Copy-DbaSysDbUserObject { Copies user objects from source to destination -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [Parameter(Mandatory)] @@ -387,5 +387,4 @@ function Copy-DbaSysDbUserObject { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Copy-SqlSysDbUserObjects } -} - +} \ No newline at end of file diff --git a/functions/Copy-DbaXESessionTemplate.ps1 b/functions/Copy-DbaXESessionTemplate.ps1 index dc3e3e47f9..6ec5959aa3 100644 --- a/functions/Copy-DbaXESessionTemplate.ps1 +++ b/functions/Copy-DbaXESessionTemplate.ps1 @@ -41,7 +41,7 @@ function Copy-DbaXESessionTemplate { Copies your templates from C:\temp\xetemplates to $home\Documents\SQL Server Management Studio\Templates\XEventTemplates. -#> + #> [CmdletBinding()] param ( [string[]]$Path = "$script:PSModuleRoot\bin\xetemplates", @@ -69,5 +69,4 @@ function Copy-DbaXESessionTemplate { } } } -} - +} \ No newline at end of file diff --git a/functions/Disable-DbaAgHadr.ps1 b/functions/Disable-DbaAgHadr.ps1 index d6a936560d..1a3ab8999d 100644 --- a/functions/Disable-DbaAgHadr.ps1 +++ b/functions/Disable-DbaAgHadr.ps1 @@ -54,7 +54,7 @@ function Disable-DbaAgHadr { Sets Hadr service to disabled for the instance dev1 on sq2012, and restart the service to apply the change. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -138,5 +138,4 @@ function Disable-DbaAgHadr { } } } -} - +} \ No newline at end of file diff --git a/functions/Disable-DbaFilestream.ps1 b/functions/Disable-DbaFilestream.ps1 index 417156b1af..654c5ee6e3 100644 --- a/functions/Disable-DbaFilestream.ps1 +++ b/functions/Disable-DbaFilestream.ps1 @@ -54,7 +54,7 @@ function Disable-DbaFilestream { Using this pipeline you can scan a range of SQL instances and disable filestream on only those on which it's enabled. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] @@ -118,4 +118,4 @@ function Disable-DbaFilestream { } } } -} +} \ No newline at end of file diff --git a/functions/Disable-DbaForceNetworkEncryption.ps1 b/functions/Disable-DbaForceNetworkEncryption.ps1 index 85be85db28..edcc0753d5 100644 --- a/functions/Disable-DbaForceNetworkEncryption.ps1 +++ b/functions/Disable-DbaForceNetworkEncryption.ps1 @@ -50,7 +50,7 @@ function Disable-DbaForceNetworkEncryption { Shows what would happen if the command were executed. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [Parameter(ValueFromPipeline)] @@ -137,5 +137,4 @@ function Disable-DbaForceNetworkEncryption { } } } -} - +} \ No newline at end of file diff --git a/functions/Disable-DbaTraceFlag.ps1 b/functions/Disable-DbaTraceFlag.ps1 index 060ed63717..d2624d70c9 100644 --- a/functions/Disable-DbaTraceFlag.ps1 +++ b/functions/Disable-DbaTraceFlag.ps1 @@ -36,7 +36,7 @@ function Disable-DbaTraceFlag { Disable the globally running trace flag 3226 on SQL Server instance sql2016 -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -92,5 +92,4 @@ function Disable-DbaTraceFlag { } } } -} - +} \ No newline at end of file diff --git a/functions/Dismount-DbaDatabase.ps1 b/functions/Dismount-DbaDatabase.ps1 index 150697e3d5..ba3907d9aa 100644 --- a/functions/Dismount-DbaDatabase.ps1 +++ b/functions/Dismount-DbaDatabase.ps1 @@ -66,7 +66,7 @@ function Dismount-DbaDatabase { Shows what would happen if the command were to execute (without actually executing the detach/break/remove commands). -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ParameterSetName = 'SqlInstance')] @@ -204,6 +204,4 @@ function Dismount-DbaDatabase { } } } -} - - +} \ No newline at end of file diff --git a/functions/Enable-DbaAgHadr.ps1 b/functions/Enable-DbaAgHadr.ps1 index a875c2ad89..5c53d7caa6 100644 --- a/functions/Enable-DbaAgHadr.ps1 +++ b/functions/Enable-DbaAgHadr.ps1 @@ -54,7 +54,7 @@ function Enable-DbaAgHadr { Sets Hadr service to disabled for the instance dev1 on sq2012, and restart the service to apply the change. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -138,5 +138,4 @@ function Enable-DbaAgHadr { } } } -} - +} \ No newline at end of file diff --git a/functions/Enable-DbaFilestream.ps1 b/functions/Enable-DbaFilestream.ps1 index f24aeeeeb3..0cc71c836a 100644 --- a/functions/Enable-DbaFilestream.ps1 +++ b/functions/Enable-DbaFilestream.ps1 @@ -59,7 +59,7 @@ function Enable-DbaFilestream { Using this pipeline you can scan a range of SQL instances and enable filestream on only those on which it's disabled. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Medium")] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] @@ -146,4 +146,4 @@ function Enable-DbaFilestream { } } } -} +} \ No newline at end of file diff --git a/functions/Enable-DbaForceNetworkEncryption.ps1 b/functions/Enable-DbaForceNetworkEncryption.ps1 index 287e9bb681..9f1a26ac53 100644 --- a/functions/Enable-DbaForceNetworkEncryption.ps1 +++ b/functions/Enable-DbaForceNetworkEncryption.ps1 @@ -49,7 +49,7 @@ function Enable-DbaForceNetworkEncryption { Shows what would happen if the command were executed. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low", DefaultParameterSetName = 'Default')] param ( [Parameter(ValueFromPipeline)] @@ -137,5 +137,4 @@ function Enable-DbaForceNetworkEncryption { } } } -} - +} \ No newline at end of file diff --git a/functions/Enable-DbaTraceFlag.ps1 b/functions/Enable-DbaTraceFlag.ps1 index 4c8dd33d02..8f5d00e1a0 100644 --- a/functions/Enable-DbaTraceFlag.ps1 +++ b/functions/Enable-DbaTraceFlag.ps1 @@ -41,7 +41,7 @@ function Enable-DbaTraceFlag { Enable multiple trace flags on SQL Server instance sql2016 -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -98,5 +98,4 @@ function Enable-DbaTraceFlag { } } } -} - +} \ No newline at end of file diff --git a/functions/Expand-DbaTLogResponsibly.ps1 b/functions/Expand-DbaTLogResponsibly.ps1 index 665c9ded62..2ecc3dcd80 100644 --- a/functions/Expand-DbaTLogResponsibly.ps1 +++ b/functions/Expand-DbaTLogResponsibly.ps1 @@ -133,7 +133,7 @@ function Expand-DbaTLogResponsibly { Grows the transaction logs for databases db1 and db2 on SQL server SQLInstance to 100MB, sets the incremental growth to 10MB, shrinks the transaction log to 10MB and uses the directory R:\MSSQL\Backup for the required backups. -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Default')] param ( [parameter(Position = 1, Mandatory)] @@ -514,4 +514,4 @@ function Expand-DbaTLogResponsibly { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Parameter IncrementSizeMB Test-DbaDeprecation -DeprecatedOn "1.0.0" -Parameter ShrinkSizeMB } -} +} \ No newline at end of file diff --git a/functions/Export-DbaAvailabilityGroup.ps1 b/functions/Export-DbaAvailabilityGroup.ps1 index 2136b5faa3..147b1d81e9 100644 --- a/functions/Export-DbaAvailabilityGroup.ps1 +++ b/functions/Export-DbaAvailabilityGroup.ps1 @@ -67,7 +67,7 @@ function Export-DbaAvailabilityGroup { Exports all Availability Groups from SQL server "sql2014". Output scripts are written to the C:\temp\availability_group_exports directory. If the export file already exists it will not be overwritten. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -169,5 +169,4 @@ function Export-DbaAvailabilityGroup { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaCmsRegServer.ps1 b/functions/Export-DbaCmsRegServer.ps1 index b359093c44..7f10e627a3 100644 --- a/functions/Export-DbaCmsRegServer.ps1 +++ b/functions/Export-DbaCmsRegServer.ps1 @@ -57,7 +57,7 @@ function Export-DbaCmsRegServer { Exports all registered servers on sql2008 and sql2012, organized by group. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Parameter CredentialPersistenceType")] param ( @@ -123,5 +123,4 @@ function Export-DbaCmsRegServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Export-DbaRegisteredServer } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaCredential.ps1 b/functions/Export-DbaCredential.ps1 index 2a45c714bc..b44af94af5 100644 --- a/functions/Export-DbaCredential.ps1 +++ b/functions/Export-DbaCredential.ps1 @@ -53,7 +53,7 @@ function Export-DbaCredential { Exports credentials, including passwords, from sql2017 to the file C:\temp\cred.sql -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -137,5 +137,4 @@ function Export-DbaCredential { Get-ChildItem -Path $path } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaDacPackage.ps1 b/functions/Export-DbaDacPackage.ps1 index 1ea0643e3e..8f30a63a1b 100644 --- a/functions/Export-DbaDacPackage.ps1 +++ b/functions/Export-DbaDacPackage.ps1 @@ -84,7 +84,7 @@ function Export-DbaDacPackage { PS C:\> Export-DbaDacPackage -SqlInstance sql2016 -Database SharePoint_Config -Path C:\temp -ExtendedParameters $moreparams Using extended parameters to over-write the files and performs the extraction in quiet mode. Uses command line instead of SMO behind the scenes. -#> + #> [CmdletBinding(DefaultParameterSetName = 'SMO')] param ( @@ -296,4 +296,4 @@ function Export-DbaDacPackage { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Export-DbaDacpac } -} +} \ No newline at end of file diff --git a/functions/Export-DbaDiagnosticQuery.ps1 b/functions/Export-DbaDiagnosticQuery.ps1 index 747647043f..15050ec8c6 100644 --- a/functions/Export-DbaDiagnosticQuery.ps1 +++ b/functions/Export-DbaDiagnosticQuery.ps1 @@ -53,7 +53,7 @@ function Export-DbaDiagnosticQuery { Converts output from Invoke-DbaDiagnosticQuery to Excel worksheet(s) in the Documents folder -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -175,5 +175,4 @@ function Export-DbaDiagnosticQuery { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaExecutionPlan.ps1 b/functions/Export-DbaExecutionPlan.ps1 index d2ef60f86e..2d2f2f1d9a 100644 --- a/functions/Export-DbaExecutionPlan.ps1 +++ b/functions/Export-DbaExecutionPlan.ps1 @@ -79,7 +79,7 @@ function Export-DbaExecutionPlan { Gets all execution plans for sqlserver2014a. Then shows what would happen if the results where piped to Export-DbaExecutionPlan -#> + #> [cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Default")] param ( [parameter(ParameterSetName = 'NotPiped', Mandatory)] @@ -248,5 +248,4 @@ function Export-DbaExecutionPlan { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaInstance.ps1 b/functions/Export-DbaInstance.ps1 index ffbb4805a7..2f40cc143c 100644 --- a/functions/Export-DbaInstance.ps1 +++ b/functions/Export-DbaInstance.ps1 @@ -116,7 +116,7 @@ function Export-DbaInstance { Exports everything but logins and database restore scripts to C:\dr\sqlcluster -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -437,5 +437,4 @@ function Export-DbaInstance { Write-Message -Level Verbose -Message "Export completed: $(Get-Date)" Write-Message -Level Verbose -Message "Total Elapsed time: $totaltime" } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaLinkedServer.ps1 b/functions/Export-DbaLinkedServer.ps1 index b3321c491a..c34b865820 100644 --- a/functions/Export-DbaLinkedServer.ps1 +++ b/functions/Export-DbaLinkedServer.ps1 @@ -55,7 +55,7 @@ function Export-DbaLinkedServer { Exports the linked servers, without passwords, from sql2017 to the file C:\temp\ls.sql -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -148,5 +148,4 @@ function Export-DbaLinkedServer { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaLogin.ps1 b/functions/Export-DbaLogin.ps1 index 00c295ae7e..1560a9118e 100644 --- a/functions/Export-DbaLogin.ps1 +++ b/functions/Export-DbaLogin.ps1 @@ -94,7 +94,7 @@ function Export-DbaLogin { Exports login realcajun from sqlserver2008 to the file C:\temp\users.sql with syntax to run on SQL Server 2016 -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -404,5 +404,4 @@ function Export-DbaLogin { } Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Export-SqlLogin } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaPfDataCollectorSetTemplate.ps1 b/functions/Export-DbaPfDataCollectorSetTemplate.ps1 index a7e882e4e5..cad372d8dc 100644 --- a/functions/Export-DbaPfDataCollectorSetTemplate.ps1 +++ b/functions/Export-DbaPfDataCollectorSetTemplate.ps1 @@ -50,7 +50,7 @@ function Export-DbaPfDataCollectorSetTemplate { Exports the 'System Correlation' data collector set from sql2017 to C:\temp. -#> + #> [CmdletBinding()] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -94,5 +94,4 @@ function Export-DbaPfDataCollectorSetTemplate { Get-ChildItem -Path $filename } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaRepServerSetting.ps1 b/functions/Export-DbaRepServerSetting.ps1 index 5e7f61a96e..f4ca70fa6e 100644 --- a/functions/Export-DbaRepServerSetting.ps1 +++ b/functions/Export-DbaRepServerSetting.ps1 @@ -67,7 +67,7 @@ function Export-DbaRepServerSetting { Exports the replication settings on sql2017 to the file C:\temp\replication.sql -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -121,5 +121,4 @@ function Export-DbaRepServerSetting { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaScript.ps1 b/functions/Export-DbaScript.ps1 index 301589e5e8..0db6ddc65f 100644 --- a/functions/Export-DbaScript.ps1 +++ b/functions/Export-DbaScript.ps1 @@ -122,7 +122,7 @@ function Export-DbaScript { Uses Scripting options to ensure Batch Terminator is set Will append the output to the file C:\temp\export.sql if it already exists -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -289,5 +289,4 @@ function Export-DbaScript { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaSpConfigure.ps1 b/functions/Export-DbaSpConfigure.ps1 index bbc64b87a9..82ee2bb44c 100644 --- a/functions/Export-DbaSpConfigure.ps1 +++ b/functions/Export-DbaSpConfigure.ps1 @@ -62,7 +62,7 @@ function Export-DbaSpConfigure { Exports the SPConfigure settings for Server1 and Server2 using pipeline. As more than 1 Server adds prefix of Servername and date to the file name and saves to file like C:\temp\Servername-MMDDYYYYhhmmss-configure.sql -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -148,5 +148,4 @@ function Export-DbaSpConfigure { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Export-SqlSpConfigure } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaUser.ps1 b/functions/Export-DbaUser.ps1 index e71d94c12c..e731d8cfd5 100644 --- a/functions/Export-DbaUser.ps1 +++ b/functions/Export-DbaUser.ps1 @@ -106,7 +106,7 @@ function Export-DbaUser { Exports ONLY users from db1 and db2 database on sqlserver2008 server, to the C:\temp\users.sql file without the 'GO' batch separator. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] [OutputType([String])] param ( @@ -458,5 +458,4 @@ function Export-DbaUser { } Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Export-SqlUser } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaXECsv.ps1 b/functions/Export-DbaXECsv.ps1 index 93597053a5..5e23a47dd0 100644 --- a/functions/Export-DbaXECsv.ps1 +++ b/functions/Export-DbaXECsv.ps1 @@ -39,7 +39,7 @@ function Export-DbaXECsv { Writes Extended Events data to the file "C:\temp\events.csv". -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -151,5 +151,4 @@ function Export-DbaXECsv { } } } -} - +} \ No newline at end of file diff --git a/functions/Export-DbaXESessionTemplate.ps1 b/functions/Export-DbaXESessionTemplate.ps1 index 5c39fea45b..113a130917 100644 --- a/functions/Export-DbaXESessionTemplate.ps1 +++ b/functions/Export-DbaXESessionTemplate.ps1 @@ -48,7 +48,7 @@ function Export-DbaXESessionTemplate { Gets the system_health Extended Events Session from sql2017 and then exports as an XESession XML Template to C:\temp\xe -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -86,5 +86,4 @@ function Export-DbaXESessionTemplate { Get-ChildItem -Path $filename } } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaAgentJob.ps1 b/functions/Find-DbaAgentJob.ps1 index 24e0dc080a..15b529d6fd 100644 --- a/functions/Find-DbaAgentJob.ps1 +++ b/functions/Find-DbaAgentJob.ps1 @@ -108,7 +108,7 @@ function Find-DbaAgentJob { Queries CMS server to return all SQL instances in the Production folder and then list out all agent jobs that have either been disabled or have no schedule. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -232,5 +232,4 @@ function Find-DbaAgentJob { } } } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaBackup.ps1 b/functions/Find-DbaBackup.ps1 index eab41fae29..759eca2614 100644 --- a/functions/Find-DbaBackup.ps1 +++ b/functions/Find-DbaBackup.ps1 @@ -97,7 +97,7 @@ function Find-DbaBackup { '7d' = 7 days '4w' = 4 weeks '1m' = 1 month - #> + #> [int]$Length = ($UserFriendlyRetention).Length $Value = ($UserFriendlyRetention).Substring(0, $Length - 1) @@ -168,5 +168,4 @@ function Find-DbaBackup { Write-Message "Errors encountered enumerating files." -Level Warning -ErrorRecord $EnumErrors } } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaCommand.ps1 b/functions/Find-DbaCommand.ps1 index 48fd4507e1..b4b9ad8a2d 100644 --- a/functions/Find-DbaCommand.ps1 +++ b/functions/Find-DbaCommand.ps1 @@ -82,7 +82,7 @@ function Find-DbaCommand { Finds all commands searching the entire help for "snapshot", rebuilding the index (good for developers) -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [String]$Pattern, @@ -222,5 +222,4 @@ function Find-DbaCommand { Select-DefaultView -InputObject $result -Property CommandName, Synopsis } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaDatabase.ps1 b/functions/Find-DbaDatabase.ps1 index 91fb383bf9..1178f17abd 100644 --- a/functions/Find-DbaDatabase.ps1 +++ b/functions/Find-DbaDatabase.ps1 @@ -58,7 +58,7 @@ function Find-DbaDatabase { Returns all database from the SqlInstances that have the same Service Broker GUID with a detailed output -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -129,5 +129,4 @@ function Find-DbaDatabase { } } } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaDbGrowthEvent.ps1 b/functions/Find-DbaDbGrowthEvent.ps1 index 66b7bb14e0..e6a3928aaa 100644 --- a/functions/Find-DbaDbGrowthEvent.ps1 +++ b/functions/Find-DbaDbGrowthEvent.ps1 @@ -86,7 +86,7 @@ function Find-DbaDbGrowthEvent { Returns any database Auto Growth events on data files in the Default Trace for every database on the ServerA\SQL2016 instance. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -259,5 +259,4 @@ function Find-DbaDbGrowthEvent { } } } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaDbUnusedIndex.ps1 b/functions/Find-DbaDbUnusedIndex.ps1 index e6c2e618da..1d698935b3 100644 --- a/functions/Find-DbaDbUnusedIndex.ps1 +++ b/functions/Find-DbaDbUnusedIndex.ps1 @@ -58,7 +58,7 @@ function Find-DbaDbUnusedIndex { Finds unused databases on all databases on sql2016 - #> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] diff --git a/functions/Find-DbaDisabledIndex.ps1 b/functions/Find-DbaDisabledIndex.ps1 index f179443a00..be4014572a 100644 --- a/functions/Find-DbaDisabledIndex.ps1 +++ b/functions/Find-DbaDisabledIndex.ps1 @@ -66,7 +66,7 @@ function Find-DbaDisabledIndex { Generates the SQL statements to drop selected indexes on all user databases. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -149,5 +149,4 @@ function Find-DbaDisabledIndex { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-SqlDisabledIndex } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaDuplicateIndex.ps1 b/functions/Find-DbaDuplicateIndex.ps1 index e7c904725b..48fb06bc10 100644 --- a/functions/Find-DbaDuplicateIndex.ps1 +++ b/functions/Find-DbaDuplicateIndex.ps1 @@ -72,7 +72,7 @@ function Find-DbaDuplicateIndex { Finds both duplicate and overlapping indexes on all user databases. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -483,5 +483,4 @@ function Find-DbaDuplicateIndex { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-SqlDuplicateIndex } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaInstance.ps1 b/functions/Find-DbaInstance.ps1 index 9887c5ffe1..93c85155f4 100644 --- a/functions/Find-DbaInstance.ps1 +++ b/functions/Find-DbaInstance.ps1 @@ -196,7 +196,7 @@ function Find-DbaInstance { Scans localhost for instances using the browser service, traverses all instances for all databases and displays a subset of the important information in a formatted table. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseApprovedVerbs", "", Justification = "Internal functions are ignored")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] @@ -981,4 +981,4 @@ function Find-DbaInstance { } $steppablePipeline.End() } -} +} \ No newline at end of file diff --git a/functions/Find-DbaLoginInGroup.ps1 b/functions/Find-DbaLoginInGroup.ps1 index 0246450b29..77d71f4109 100644 --- a/functions/Find-DbaLoginInGroup.ps1 +++ b/functions/Find-DbaLoginInGroup.ps1 @@ -47,7 +47,7 @@ function Find-DbaLoginInGroup { Returns all active directory users within all windows AD groups that have logins on the instance whose login contains "stephen" -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -149,4 +149,4 @@ function Find-DbaLoginInGroup { Select-DefaultView -InputObject $res -Property SqlInstance, Login, DisplayName, MemberOf, ParentADGroupLogin } } -} +} \ No newline at end of file diff --git a/functions/Find-DbaOrphanedFile.ps1 b/functions/Find-DbaOrphanedFile.ps1 index f5a5466e40..71cbfda6c8 100644 --- a/functions/Find-DbaOrphanedFile.ps1 +++ b/functions/Find-DbaOrphanedFile.ps1 @@ -79,7 +79,7 @@ function Find-DbaOrphanedFile { Finds the orphaned ending with ".fsf" and ".mld" in addition to the default filetypes ".mdf", ".ldf", ".ndf" for both the servers sql2014 and sql2016. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -271,6 +271,4 @@ function Find-DbaOrphanedFile { Write-Message -Level Verbose -Message "No orphaned files found" } } -} - - +} \ No newline at end of file diff --git a/functions/Find-DbaSimilarTable.ps1 b/functions/Find-DbaSimilarTable.ps1 index 79b5e9950e..e78d4ad1ef 100644 --- a/functions/Find-DbaSimilarTable.ps1 +++ b/functions/Find-DbaSimilarTable.ps1 @@ -83,7 +83,7 @@ function Find-DbaSimilarTable { Searches AdventureWorks database and lists all tables/views with its corresponding matching tables/views with match percent greater than or equal to 60 -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -279,5 +279,4 @@ function Find-DbaSimilarTable { end { Write-Message -Level Verbose -Message "Found $everyServerVwCount total tables/views" } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaStoredProcedure.ps1 b/functions/Find-DbaStoredProcedure.ps1 index 602563a0df..675a018536 100644 --- a/functions/Find-DbaStoredProcedure.ps1 +++ b/functions/Find-DbaStoredProcedure.ps1 @@ -65,7 +65,7 @@ function Find-DbaStoredProcedure { Searches in "mydb" database stored procedures for "runtime" in the text body -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -198,5 +198,4 @@ function Find-DbaStoredProcedure { end { Write-Message -Level Verbose -Message "Evaluated $everyserverspcount total stored procedures" } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaTrigger.ps1 b/functions/Find-DbaTrigger.ps1 index 0acee51291..001c20170b 100644 --- a/functions/Find-DbaTrigger.ps1 +++ b/functions/Find-DbaTrigger.ps1 @@ -69,7 +69,7 @@ function Find-DbaTrigger { Searches in "mydb" database triggers for "runtime" in the text body -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -318,5 +318,4 @@ function Find-DbaTrigger { end { Write-Message -Level Verbose -Message "Evaluated $everyserverstcount total triggers" } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaUserObject.ps1 b/functions/Find-DbaUserObject.ps1 index 6d4839f7a7..1f4af07e15 100644 --- a/functions/Find-DbaUserObject.ps1 +++ b/functions/Find-DbaUserObject.ps1 @@ -53,7 +53,7 @@ function Find-DbaUserObject { Shows all user owned (non-sa, non-dbo) objects and verbose output -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -324,5 +324,4 @@ function Find-DbaUserObject { } } } -} - +} \ No newline at end of file diff --git a/functions/Find-DbaView.ps1 b/functions/Find-DbaView.ps1 index 357aa5b720..cccb64d1e5 100644 --- a/functions/Find-DbaView.ps1 +++ b/functions/Find-DbaView.ps1 @@ -65,7 +65,7 @@ function Find-DbaView { Searches in "mydb" database views for "runtime" in the text body -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -198,5 +198,4 @@ function Find-DbaView { end { Write-Message -Level Verbose -Message "Evaluated $everyservervwcount total views" } -} - +} \ No newline at end of file diff --git a/functions/Format-DbaBackupInformation.ps1 b/functions/Format-DbaBackupInformation.ps1 index c6fa8c84f1..d6da7887a3 100644 --- a/functions/Format-DbaBackupInformation.ps1 +++ b/functions/Format-DbaBackupInformation.ps1 @@ -94,7 +94,7 @@ function Format-DbaBackupInformation { This example changes the location that SQL Server will look for the backups. This is useful if you've moved the backups to a different location - #> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -224,5 +224,4 @@ function Format-DbaBackupInformation { $History } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgDatabase.ps1 b/functions/Get-DbaAgDatabase.ps1 index e861fee31b..343dd09c72 100644 --- a/functions/Get-DbaAgDatabase.ps1 +++ b/functions/Get-DbaAgDatabase.ps1 @@ -57,7 +57,7 @@ function Get-DbaAgDatabase { Returns the database Sharepoint_Config found in the availability group SharePoint on server sqlcluster -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -89,5 +89,4 @@ function Get-DbaAgDatabase { Select-DefaultView -InputObject $db -Property $defaults } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgHadr.ps1 b/functions/Get-DbaAgHadr.ps1 index cffa00c5f5..bd867bba48 100644 --- a/functions/Get-DbaAgHadr.ps1 +++ b/functions/Get-DbaAgHadr.ps1 @@ -34,7 +34,7 @@ function Get-DbaAgHadr { Returns a status of the Hadr setting for sql2016 SQL Server instance. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -57,5 +57,4 @@ function Get-DbaAgHadr { Select-DefaultView -InputObject $server -Property 'ComputerName', 'InstanceName', 'SqlInstance', 'IsHadrEnabled' } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgListener.ps1 b/functions/Get-DbaAgListener.ps1 index b894537c4b..797994001e 100644 --- a/functions/Get-DbaAgListener.ps1 +++ b/functions/Get-DbaAgListener.ps1 @@ -54,7 +54,7 @@ function Get-DbaAgListener { Returns all listeners found on sql2017a on sql2017a for the availability group OPP -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -85,5 +85,4 @@ function Get-DbaAgListener { Select-DefaultView -InputObject $aglistener -Property $defaults } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgReplica.ps1 b/functions/Get-DbaAgReplica.ps1 index d04fed1473..3524e167d1 100644 --- a/functions/Get-DbaAgReplica.ps1 +++ b/functions/Get-DbaAgReplica.ps1 @@ -53,7 +53,7 @@ function Get-DbaAgReplica { Returns full object properties on all availability group replicas found on sql2017a -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Get-DbaAgentAlert.ps1 b/functions/Get-DbaAgentAlert.ps1 index ee7abe0d78..28496e79bf 100644 --- a/functions/Get-DbaAgentAlert.ps1 +++ b/functions/Get-DbaAgentAlert.ps1 @@ -38,7 +38,7 @@ function Get-DbaAgentAlert { Returns all SQL Agent alerts on serverA and serverB\instanceB -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -82,5 +82,4 @@ function Get-DbaAgentAlert { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentJob.ps1 b/functions/Get-DbaAgentJob.ps1 index 3e10e1d52f..186784b954 100644 --- a/functions/Get-DbaAgentJob.ps1 +++ b/functions/Get-DbaAgentJob.ps1 @@ -68,7 +68,7 @@ function Get-DbaAgentJob { Find all of your Jobs from SQL Server instances in the $servers collection, select the jobs you want to start then see jobs would start if you ran Start-DbaAgentJob -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -112,5 +112,4 @@ function Get-DbaAgentJob { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentJobCategory.ps1 b/functions/Get-DbaAgentJobCategory.ps1 index ed7edbd028..07b1af3618 100644 --- a/functions/Get-DbaAgentJobCategory.ps1 +++ b/functions/Get-DbaAgentJobCategory.ps1 @@ -53,7 +53,7 @@ function Get-DbaAgentJobCategory { Return all the job categories that have a type MultiServerJob. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -118,5 +118,4 @@ function Get-DbaAgentJobCategory { Write-Message -Message "Finished retrieving job category." -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentJobHistory.ps1 b/functions/Get-DbaAgentJobHistory.ps1 index cc042765ab..64180807ce 100644 --- a/functions/Get-DbaAgentJobHistory.ps1 +++ b/functions/Get-DbaAgentJobHistory.ps1 @@ -101,7 +101,7 @@ function Get-DbaAgentJobHistory { Gets all jobs with the name that match the regex pattern "backup" and then gets the job history from those. You can also use -Like *backup* in this example. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline, ParameterSetName = "Server")] @@ -303,5 +303,4 @@ function Get-DbaAgentJobHistory { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentJobOutputFile.ps1 b/functions/Get-DbaAgentJobOutputFile.ps1 index 0abe9ba805..bac4334e17 100644 --- a/functions/Get-DbaAgentJobOutputFile.ps1 +++ b/functions/Get-DbaAgentJobOutputFile.ps1 @@ -77,7 +77,7 @@ function Get-DbaAgentJobOutputFile { This will return the configured paths to the output files for each of the job step of all the Agent Jobs on the SERVERNAME instance and also show the job steps without an output file -#> + #> [CmdletBinding()] param ( @@ -136,5 +136,4 @@ function Get-DbaAgentJobOutputFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentJobStep.ps1 b/functions/Get-DbaAgentJobStep.ps1 index 8400282f52..cb6401a30d 100644 --- a/functions/Get-DbaAgentJobStep.ps1 +++ b/functions/Get-DbaAgentJobStep.ps1 @@ -67,7 +67,7 @@ function Get-DbaAgentJobStep { Find all of your Job Steps from SQL Server instances in the $servers collection -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -113,5 +113,4 @@ function Get-DbaAgentJobStep { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentLog.ps1 b/functions/Get-DbaAgentLog.ps1 index afc1fd214b..4ea1e0a186 100644 --- a/functions/Get-DbaAgentLog.ps1 +++ b/functions/Get-DbaAgentLog.ps1 @@ -47,7 +47,7 @@ function Get-DbaAgentLog { Returns the most recent SQL Agent error logs for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -103,5 +103,4 @@ function Get-DbaAgentLog { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentOperator.ps1 b/functions/Get-DbaAgentOperator.ps1 index ccfa7ac8d3..cf6358cc36 100644 --- a/functions/Get-DbaAgentOperator.ps1 +++ b/functions/Get-DbaAgentOperator.ps1 @@ -54,7 +54,7 @@ function Get-DbaAgentOperator { Returns all the SQL Agent operators on ServerA and ServerB, except the Dba3 operator. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -119,5 +119,4 @@ function Get-DbaAgentOperator { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentProxy.ps1 b/functions/Get-DbaAgentProxy.ps1 index e480d3c221..05723076c6 100644 --- a/functions/Get-DbaAgentProxy.ps1 +++ b/functions/Get-DbaAgentProxy.ps1 @@ -41,7 +41,7 @@ function Get-DbaAgentProxy { Returns all SQL Agent proxies on serverA and serverB\instanceB -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -82,5 +82,4 @@ function Get-DbaAgentProxy { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAgentSchedule.ps1 b/functions/Get-DbaAgentSchedule.ps1 index 228b2422e8..127968173e 100644 --- a/functions/Get-DbaAgentSchedule.ps1 +++ b/functions/Get-DbaAgentSchedule.ps1 @@ -45,7 +45,7 @@ function Get-DbaAgentSchedule { PS C:\> Get-DbaAgentSchedule -SqlInstance sql2016 -Schedule "Maintenance10min","Maintenance60min" Returns the "Maintenance10min" & "Maintenance60min" schedules from the sql2016 SQL Server instance -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -261,5 +261,4 @@ function Get-DbaAgentSchedule { } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaAvailabilityGroup.ps1 b/functions/Get-DbaAvailabilityGroup.ps1 index dd81f4ee3f..d3427c8f2b 100644 --- a/functions/Get-DbaAvailabilityGroup.ps1 +++ b/functions/Get-DbaAvailabilityGroup.ps1 @@ -62,7 +62,7 @@ function Get-DbaAvailabilityGroup { Returns true/false if the server, sqlserver2014a, is the primary replica for AG-a Availability Group. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -107,6 +107,4 @@ function Get-DbaAvailabilityGroup { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaAvailableCollation.ps1 b/functions/Get-DbaAvailableCollation.ps1 index c4758e906f..c299ccac3d 100644 --- a/functions/Get-DbaAvailableCollation.ps1 +++ b/functions/Get-DbaAvailableCollation.ps1 @@ -34,7 +34,7 @@ function Get-DbaAvailableCollation { Gets all the collations from server sql2016 using NT authentication -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -104,5 +104,4 @@ function Get-DbaAvailableCollation { Select-DefaultView -InputObject $availableCollations -Property ComputerName, InstanceName, SqlInstance, Name, CodePage, CodePageName, LocaleID, LocaleName, Description } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaBackupDevice.ps1 b/functions/Get-DbaBackupDevice.ps1 index 4ec91b7ee4..0f3e06c92f 100644 --- a/functions/Get-DbaBackupDevice.ps1 +++ b/functions/Get-DbaBackupDevice.ps1 @@ -40,7 +40,7 @@ function Get-DbaBackupDevice { Returns all Backup Devices for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -67,6 +67,4 @@ function Get-DbaBackupDevice { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaBackupHistory.ps1 b/functions/Get-DbaBackupHistory.ps1 index 320e43d9f1..777c79d407 100644 --- a/functions/Get-DbaBackupHistory.ps1 +++ b/functions/Get-DbaBackupHistory.ps1 @@ -138,7 +138,7 @@ function Get-DbaBackupHistory { If db1 has multiple recovery forks, specifying the RecoveryFork GUID will restrict the search to that fork. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -666,4 +666,4 @@ function Get-DbaBackupHistory { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaBackupInformation.ps1 b/functions/Get-DbaBackupInformation.ps1 index 099ae74ff8..f525b03f41 100644 --- a/functions/Get-DbaBackupInformation.ps1 +++ b/functions/Get-DbaBackupInformation.ps1 @@ -122,7 +122,7 @@ function Get-DbaBackupInformation { As we know we are dealing with an Ola Hallengren style backup folder from the MaintenanceSolution switch, when IgnoreLogBackup is also included we can ignore the LOG folder to skip any scanning of log backups. Note this also means they WON'T be restored -#> + #> [CmdletBinding( DefaultParameterSetName = "Create")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Parameter AzureCredential")] param ( @@ -347,5 +347,4 @@ function Get-DbaBackupInformation { } $groupResults | Sort-Object -Property End -Descending } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaBuildReference.ps1 b/functions/Get-DbaBuildReference.ps1 index 11453c442f..cef6dec436 100644 --- a/functions/Get-DbaBuildReference.ps1 +++ b/functions/Get-DbaBuildReference.ps1 @@ -56,7 +56,7 @@ function Get-DbaBuildReference { Integrate with other cmdlets to have builds checked for all your registered servers on sqlserver2014a -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( @@ -295,5 +295,4 @@ function Get-DbaBuildReference { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlBuildReference } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaClientAlias.ps1 b/functions/Get-DbaClientAlias.ps1 index b041a1c0de..f37719a2b4 100644 --- a/functions/Get-DbaClientAlias.ps1 +++ b/functions/Get-DbaClientAlias.ps1 @@ -48,7 +48,7 @@ function Get-DbaClientAlias { Gets all SQL Server client aliases on Server1 and Server2 -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -127,6 +127,4 @@ function Get-DbaClientAlias { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaClientProtocol.ps1 b/functions/Get-DbaClientProtocol.ps1 index abc7e66026..f996f92d20 100644 --- a/functions/Get-DbaClientProtocol.ps1 +++ b/functions/Get-DbaClientProtocol.ps1 @@ -52,7 +52,7 @@ function Get-DbaClientProtocol { Disables the VIA ClientNetworkProtocol on computer sql2. If successful, return code 0 is shown. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -98,5 +98,4 @@ function Get-DbaClientProtocol { } } #foreach computer } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCmConnection.ps1 b/functions/Get-DbaCmConnection.ps1 index d4e7c411a4..0fe1158498 100644 --- a/functions/Get-DbaCmConnection.ps1 +++ b/functions/Get-DbaCmConnection.ps1 @@ -43,7 +43,7 @@ function Get-DbaCmConnection { List all cached connection that use a username containing "charles" as default or override credentials. -#> + #> [CmdletBinding()] param ( @@ -72,5 +72,4 @@ function Get-DbaCmConnection { end { Write-Message -Level InternalComment -Message "Ending" } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCmObject.ps1 b/functions/Get-DbaCmObject.ps1 index 113f3c4957..ccf58cc4d3 100644 --- a/functions/Get-DbaCmObject.ps1 +++ b/functions/Get-DbaCmObject.ps1 @@ -67,7 +67,7 @@ function Get-DbaCmObject { Retrieves the common operating system information from the server sql2014. It will use the Credentials stored in $cred to connect, unless they are known to not work, in which case they will default to windows credentials (unless another default has been set). -#> + #> [CmdletBinding(DefaultParameterSetName = "Class")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWMICmdlet", "", Justification = "Using Get-WmiObject is used as a fallback for gathering information")] param ( @@ -370,5 +370,4 @@ function Get-DbaCmObject { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCmsRegServer.ps1 b/functions/Get-DbaCmsRegServer.ps1 index ea79758196..8a7b0b71fb 100644 --- a/functions/Get-DbaCmsRegServer.ps1 +++ b/functions/Get-DbaCmsRegServer.ps1 @@ -80,7 +80,7 @@ function Get-DbaCmsRegServer { Returns a list of servers in the HR and sub-group Development from the CMS on sqlserver2014a. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -201,5 +201,4 @@ function Get-DbaCmsRegServer { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-SqlRegisteredServerName Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaRegisteredServer } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCmsRegServerGroup.ps1 b/functions/Get-DbaCmsRegServerGroup.ps1 index 3810992be6..7481961835 100644 --- a/functions/Get-DbaCmsRegServerGroup.ps1 +++ b/functions/Get-DbaCmsRegServerGroup.ps1 @@ -60,7 +60,7 @@ function Get-DbaCmsRegServerGroup { Returns the sub-group Development of the HR group from the CMS on sqlserver2014a. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -157,5 +157,4 @@ function Get-DbaCmsRegServerGroup { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaRegisteredServerGroup } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCmsRegServerStore.ps1 b/functions/Get-DbaCmsRegServerStore.ps1 index 3ba00fe6f3..59e31c15fc 100644 --- a/functions/Get-DbaCmsRegServerStore.ps1 +++ b/functions/Get-DbaCmsRegServerStore.ps1 @@ -40,7 +40,7 @@ function Get-DbaCmsRegServerStore { Returns a SQL Server Registered Server Store Object from sqlserver2014a by logging in with the sqladmin login -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -74,5 +74,4 @@ function Get-DbaCmsRegServerStore { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaRegisteredServerStore } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaComputerCertificate.ps1 b/functions/Get-DbaComputerCertificate.ps1 index 3184c1167c..95d1e620ae 100644 --- a/functions/Get-DbaComputerCertificate.ps1 +++ b/functions/Get-DbaComputerCertificate.ps1 @@ -53,7 +53,7 @@ function Get-DbaComputerCertificate { Gets computer certificates on sql2016 that match thumbprints 8123472E32AB412ED4288888B83811DB8F504DED or 04BFF8B3679BB01A986E097868D8D494D70A46D6 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -119,5 +119,4 @@ function Get-DbaComputerCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaComputerSystem.ps1 b/functions/Get-DbaComputerSystem.ps1 index 0fff5267bf..4e1ec74204 100644 --- a/functions/Get-DbaComputerSystem.ps1 +++ b/functions/Get-DbaComputerSystem.ps1 @@ -47,7 +47,7 @@ function Get-DbaComputerSystem { Returns information about the sql2016's computer system and includes additional properties around the EC2 instance. -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -152,5 +152,4 @@ function Get-DbaComputerSystem { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaConnection.ps1 b/functions/Get-DbaConnection.ps1 index 0aa6630f1f..f004eda3d1 100644 --- a/functions/Get-DbaConnection.ps1 +++ b/functions/Get-DbaConnection.ps1 @@ -35,7 +35,7 @@ function Get-DbaConnection { Returns client connection information from sql2016 and sql2017 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -77,5 +77,4 @@ function Get-DbaConnection { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCpuRingBuffer.ps1 b/functions/Get-DbaCpuRingBuffer.ps1 index 6db2620bef..ad9d072a56 100644 --- a/functions/Get-DbaCpuRingBuffer.ps1 +++ b/functions/Get-DbaCpuRingBuffer.ps1 @@ -66,7 +66,7 @@ function Get-DbaCpuRingBuffer { PS C:\> Get-DbaCpuRingBuffer -SqlInstance sql2008 -SqlCredential $cred Connects using sqladmin credential and returns CPU Statistics from sys.dm_os_ring_buffers from sql2008 -#> + #> [CmdletBinding()] Param ( [parameter(Mandatory, ValueFromPipeline)] @@ -139,5 +139,4 @@ function Get-DbaCpuRingBuffer { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCpuUsage.ps1 b/functions/Get-DbaCpuUsage.ps1 index 57804a2ba0..2b7d4c016b 100644 --- a/functions/Get-DbaCpuUsage.ps1 +++ b/functions/Get-DbaCpuUsage.ps1 @@ -60,7 +60,7 @@ function Get-DbaCpuUsage { Logs into the SQL instance using the SQL Login 'sqladmin' and then Windows instance as 'ad\sqldba' -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -151,5 +151,4 @@ function Get-DbaCpuUsage { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCredential.ps1 b/functions/Get-DbaCredential.ps1 index 36c85a6f1a..a04958f83a 100644 --- a/functions/Get-DbaCredential.ps1 +++ b/functions/Get-DbaCredential.ps1 @@ -59,7 +59,7 @@ function Get-DbaCredential { Returns the SQL Credentials for the account 'ad\powershell' on the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")] param ( @@ -111,5 +111,4 @@ function Get-DbaCredential { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaCustomError.ps1 b/functions/Get-DbaCustomError.ps1 index e1ab3b00e0..305cb41b7b 100644 --- a/functions/Get-DbaCustomError.ps1 +++ b/functions/Get-DbaCustomError.ps1 @@ -40,7 +40,7 @@ function Get-DbaCustomError { Returns all Custom Error Message(s) for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -67,6 +67,4 @@ function Get-DbaCustomError { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaDatabase.ps1 b/functions/Get-DbaDatabase.ps1 index 013fb95dab..e40e993088 100644 --- a/functions/Get-DbaDatabase.ps1 +++ b/functions/Get-DbaDatabase.ps1 @@ -141,7 +141,7 @@ function Get-DbaDatabase { Returns databases 'OneDb' and 'OtherDB' from SQL Server instances SQL2 and SQL3 if databases by those names exist on those instances. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -351,4 +351,4 @@ function Get-DbaDatabase { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaDbAssembly.ps1 b/functions/Get-DbaDbAssembly.ps1 index 0be6361d04..b220cfa2be 100644 --- a/functions/Get-DbaDbAssembly.ps1 +++ b/functions/Get-DbaDbAssembly.ps1 @@ -40,7 +40,7 @@ function Get-DbaDbAssembly { Returns all Database Assembly for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -77,6 +77,4 @@ function Get-DbaDbAssembly { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseAssembly } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaDbCertificate.ps1 b/functions/Get-DbaDbCertificate.ps1 index a2522f358d..fb3bdd753b 100644 --- a/functions/Get-DbaDbCertificate.ps1 +++ b/functions/Get-DbaDbCertificate.ps1 @@ -61,7 +61,7 @@ function Get-DbaDbCertificate { Gets the cert1 certificate within the db1 database -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -116,5 +116,4 @@ function Get-DbaDbCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbCheckConstraint.ps1 b/functions/Get-DbaDbCheckConstraint.ps1 index a9a43b8272..76f490dcc2 100644 --- a/functions/Get-DbaDbCheckConstraint.ps1 +++ b/functions/Get-DbaDbCheckConstraint.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbCheckConstraint { Gets the check constraints for the databases on Sql1 and Sql2/sqlexpress. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -120,5 +120,4 @@ function Get-DbaDbCheckConstraint { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbCompatibility.ps1 b/functions/Get-DbaDbCompatibility.ps1 index 8f6352939d..f7f5653be1 100644 --- a/functions/Get-DbaDbCompatibility.ps1 +++ b/functions/Get-DbaDbCompatibility.ps1 @@ -54,7 +54,7 @@ function Get-DbaDbCompatibility { Displays database compatibility level for database Test on server localhost\sql2017 -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -88,5 +88,4 @@ function Get-DbaDbCompatibility { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbCompression.ps1 b/functions/Get-DbaDbCompression.ps1 index 0976e2873e..8160245853 100644 --- a/functions/Get-DbaDbCompression.ps1 +++ b/functions/Get-DbaDbCompression.ps1 @@ -46,7 +46,7 @@ function Get-DbaDbCompression { Returns objects size and current compression level for objects in all databases except the TestDatabase database. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -131,5 +131,4 @@ function Get-DbaDbCompression { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbEncryption.ps1 b/functions/Get-DbaDbEncryption.ps1 index 24ee9b3ae3..d6222f6d04 100644 --- a/functions/Get-DbaDbEncryption.ps1 +++ b/functions/Get-DbaDbEncryption.ps1 @@ -57,7 +57,7 @@ function Get-DbaDbEncryption { List all encryption found for all databases including the system databases. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline, Mandatory)] @@ -181,5 +181,4 @@ function Get-DbaDbEncryption { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseEncryption } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbExtentDiff.ps1 b/functions/Get-DbaDbExtentDiff.ps1 index 5858ee920f..2d28a31ba4 100644 --- a/functions/Get-DbaDbExtentDiff.ps1 +++ b/functions/Get-DbaDbExtentDiff.ps1 @@ -52,7 +52,7 @@ function Get-DbaDbExtentDiff { Get the changes for the DB01 database on multiple servers. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -167,5 +167,4 @@ function Get-DbaDbExtentDiff { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbFeatureUsage.ps1 b/functions/Get-DbaDbFeatureUsage.ps1 index c8f80c5e24..3d5d185f47 100644 --- a/functions/Get-DbaDbFeatureUsage.ps1 +++ b/functions/Get-DbaDbFeatureUsage.ps1 @@ -47,7 +47,7 @@ function Get-DbaDbFeatureUsage { Shows features that are enabled in the testdb and db2 databases but not supported on the all the editions of SQL Server. -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer", "SqlServers")] @@ -85,5 +85,4 @@ function Get-DbaDbFeatureUsage { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbFile.ps1 b/functions/Get-DbaDbFile.ps1 index 1e5ffdb06e..f5153ff299 100644 --- a/functions/Get-DbaDbFile.ps1 +++ b/functions/Get-DbaDbFile.ps1 @@ -50,7 +50,7 @@ function Get-DbaDbFile { Will return an object containing all file groups and their contained files for the Impromptu and Trading databases on the sql2016 SQL Server instance -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(ParameterSetName = "Pipe", Mandatory, ValueFromPipeline)] @@ -208,7 +208,7 @@ ON fd.Drive = LEFT(df.physical_name, 1); $free = $disks | Where-Object { $_.drive -eq $result.PhysicalName.Substring(0, 1) } | Select-Object $MbFreeColName - + $VolumeFreeSpace = [dbasize](($free.MB_Free) * 1024 * 1024) } } @@ -260,5 +260,4 @@ ON fd.Drive = LEFT(df.physical_name, 1); end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseFIle } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbForeignKey.ps1 b/functions/Get-DbaDbForeignKey.ps1 index fcfa57f99d..8b9a35ee53 100644 --- a/functions/Get-DbaDbForeignKey.ps1 +++ b/functions/Get-DbaDbForeignKey.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbForeignKey { Gets the Foreign Keys for the databases on Sql1 and Sql2/sqlexpress. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -120,5 +120,4 @@ function Get-DbaDbForeignKey { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbLogShipError.ps1 b/functions/Get-DbaDbLogShipError.ps1 index f554f5bd16..fdb12775b1 100644 --- a/functions/Get-DbaDbLogShipError.ps1 +++ b/functions/Get-DbaDbLogShipError.ps1 @@ -80,7 +80,7 @@ function Get-DbaDbLogShipError { Get the errors that have occurred between "01/05/2018" and "01/07/2018". See that is doesn't matter how the date is represented. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -223,5 +223,4 @@ DROP TABLE #DatabaseID;" end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaLogShippingError } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMail.ps1 b/functions/Get-DbaDbMail.ps1 index da70abf94c..962d441ff6 100644 --- a/functions/Get-DbaDbMail.ps1 +++ b/functions/Get-DbaDbMail.ps1 @@ -44,7 +44,7 @@ function Get-DbaDbMail { Returns the db mail server object for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline, Mandatory)] @@ -74,5 +74,4 @@ function Get-DbaDbMail { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMailAccount.ps1 b/functions/Get-DbaDbMailAccount.ps1 index 578b37ead9..480833a385 100644 --- a/functions/Get-DbaDbMailAccount.ps1 +++ b/functions/Get-DbaDbMailAccount.ps1 @@ -58,7 +58,7 @@ function Get-DbaDbMailAccount { Returns the Database Mail accounts for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -102,4 +102,4 @@ function Get-DbaDbMailAccount { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaDbMailConfig.ps1 b/functions/Get-DbaDbMailConfig.ps1 index 333dffdf5f..a502dd3d27 100644 --- a/functions/Get-DbaDbMailConfig.ps1 +++ b/functions/Get-DbaDbMailConfig.ps1 @@ -55,7 +55,7 @@ function Get-DbaDbMailConfig { Returns the DBMail configs for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -95,5 +95,4 @@ function Get-DbaDbMailConfig { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMailHistory.ps1 b/functions/Get-DbaDbMailHistory.ps1 index cfc2b99e5b..3e125e76ba 100644 --- a/functions/Get-DbaDbMailHistory.ps1 +++ b/functions/Get-DbaDbMailHistory.ps1 @@ -50,7 +50,7 @@ function Get-DbaDbMailHistory { Returns the all DBMail history for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -140,5 +140,4 @@ function Get-DbaDbMailHistory { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMailLog.ps1 b/functions/Get-DbaDbMailLog.ps1 index 6be8e402d8..fbbcb82ba1 100644 --- a/functions/Get-DbaDbMailLog.ps1 +++ b/functions/Get-DbaDbMailLog.ps1 @@ -50,7 +50,7 @@ function Get-DbaDbMailLog { Returns only the Error and Information DBMail log for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -122,5 +122,4 @@ function Get-DbaDbMailLog { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMailProfile.ps1 b/functions/Get-DbaDbMailProfile.ps1 index 78fd3b8c86..9d35b16fc2 100644 --- a/functions/Get-DbaDbMailProfile.ps1 +++ b/functions/Get-DbaDbMailProfile.ps1 @@ -58,7 +58,7 @@ function Get-DbaDbMailProfile { Returns the DBMail profiles for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -104,5 +104,4 @@ function Get-DbaDbMailProfile { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMailServer.ps1 b/functions/Get-DbaDbMailServer.ps1 index 10f1da3fc5..cf7828cb26 100644 --- a/functions/Get-DbaDbMailServer.ps1 +++ b/functions/Get-DbaDbMailServer.ps1 @@ -58,7 +58,7 @@ function Get-DbaDbMailServer { Returns the DBMail servers for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -103,5 +103,4 @@ function Get-DbaDbMailServer { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMasterKey.ps1 b/functions/Get-DbaDbMasterKey.ps1 index 2482e2bf0b..c60396a54c 100644 --- a/functions/Get-DbaDbMasterKey.ps1 +++ b/functions/Get-DbaDbMasterKey.ps1 @@ -51,7 +51,7 @@ function Get-DbaDbMasterKey { Gets the master key for the db1 database -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -93,5 +93,4 @@ function Get-DbaDbMasterKey { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseMasterKey } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMemoryUsage.ps1 b/functions/Get-DbaDbMemoryUsage.ps1 index e9e4c90d27..8ebb2f4405 100644 --- a/functions/Get-DbaDbMemoryUsage.ps1 +++ b/functions/Get-DbaDbMemoryUsage.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbMemoryUsage { PS C:\> Get-DbaMemoryUsage -SqlInstance sql2 -IncludeSystemDb -Exclude 'master','model','msdb','ResourceDb' Returns the buffer pool consumption for all user databases and tempdb database -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -136,5 +136,4 @@ function Get-DbaDbMemoryUsage { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMirror.ps1 b/functions/Get-DbaDbMirror.ps1 index da5652a4ee..3f7c4a7f45 100644 --- a/functions/Get-DbaDbMirror.ps1 +++ b/functions/Get-DbaDbMirror.ps1 @@ -40,7 +40,7 @@ function Get-DbaDbMirror { Gets properties of database mirrors and mirror witnesses on localhost and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -79,5 +79,4 @@ function Get-DbaDbMirror { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbMirrorMonitor.ps1 b/functions/Get-DbaDbMirrorMonitor.ps1 index a254de05c5..c8867c666d 100644 --- a/functions/Get-DbaDbMirrorMonitor.ps1 +++ b/functions/Get-DbaDbMirrorMonitor.ps1 @@ -69,7 +69,7 @@ function Get-DbaDbMirrorMonitor { Updates monitor stats then returns the last 24 hours worth of status rows for a monitored database from the status table on sql2008 and sql2012. -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -139,5 +139,4 @@ function Get-DbaDbMirrorMonitor { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbPageInfo.ps1 b/functions/Get-DbaDbPageInfo.ps1 index 574e3b3980..616240afc0 100644 --- a/functions/Get-DbaDbPageInfo.ps1 +++ b/functions/Get-DbaDbPageInfo.ps1 @@ -57,7 +57,7 @@ function Get-DbaDbPageInfo { Returns page information for the testdb on all $servers -#> + #> [CmdLetBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -134,5 +134,4 @@ function Get-DbaDbPageInfo { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbPartitionFunction.ps1 b/functions/Get-DbaDbPartitionFunction.ps1 index 9aea0c1249..caef6a2d91 100644 --- a/functions/Get-DbaDbPartitionFunction.ps1 +++ b/functions/Get-DbaDbPartitionFunction.ps1 @@ -51,7 +51,7 @@ function Get-DbaDbPartitionFunction { Gets the Partition Functions for the databases on Sql1 and Sql2/sqlexpress -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -109,5 +109,4 @@ function Get-DbaDbPartitionFunction { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabasePartitionFunction } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbPartitionScheme.ps1 b/functions/Get-DbaDbPartitionScheme.ps1 index 106e829cbd..7ce81a7d8c 100644 --- a/functions/Get-DbaDbPartitionScheme.ps1 +++ b/functions/Get-DbaDbPartitionScheme.ps1 @@ -51,7 +51,7 @@ function Get-DbaDbPartitionScheme { Gets the Partition Schemes for the databases on Sql1 and Sql2/sqlexpress -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -109,5 +109,4 @@ function Get-DbaDbPartitionScheme { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabasePartitionScheme } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbQueryStoreOption.ps1 b/functions/Get-DbaDbQueryStoreOption.ps1 index ffea8c2d9e..6b2f1d7c64 100644 --- a/functions/Get-DbaDbQueryStoreOption.ps1 +++ b/functions/Get-DbaDbQueryStoreOption.ps1 @@ -53,7 +53,7 @@ function Get-DbaDbQueryStoreOption { Returns Query Store configuration settings for every database on the ServerA\sql instance inside a table format. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -98,5 +98,4 @@ function Get-DbaDbQueryStoreOption { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDbQueryStoreOptions } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbRecoveryModel.ps1 b/functions/Get-DbaDbRecoveryModel.ps1 index cd7721c3d7..13a24d34a1 100644 --- a/functions/Get-DbaDbRecoveryModel.ps1 +++ b/functions/Get-DbaDbRecoveryModel.ps1 @@ -50,7 +50,7 @@ function Get-DbaDbRecoveryModel { Gets recovery model information for TestDB. If TestDB does not exist on the instance nothing is returned. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -83,5 +83,4 @@ function Get-DbaDbRecoveryModel { Get-DbaDatabase @params | Select-DefaultView -Property $defaults } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbRestoreHistory.ps1 b/functions/Get-DbaDbRestoreHistory.ps1 index cc6adfbae2..5e5213b71c 100644 --- a/functions/Get-DbaDbRestoreHistory.ps1 +++ b/functions/Get-DbaDbRestoreHistory.ps1 @@ -72,7 +72,7 @@ function Get-DbaDbRestoreHistory { Returns database restore information for every database on every server listed in the Central Management Server on sql2016. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -201,5 +201,4 @@ function Get-DbaDbRestoreHistory { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbRoleMember.ps1 b/functions/Get-DbaDbRoleMember.ps1 index a3061d4bcc..fe534d8b31 100644 --- a/functions/Get-DbaDbRoleMember.ps1 +++ b/functions/Get-DbaDbRoleMember.ps1 @@ -78,7 +78,7 @@ function Get-DbaDbRoleMember { Returns all members of the db_owner role in the msdb database on localhost. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -163,5 +163,4 @@ function Get-DbaDbRoleMember { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaRoleMember } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbSharePoint.ps1 b/functions/Get-DbaDbSharePoint.ps1 index c529be0d11..b138ff026d 100644 --- a/functions/Get-DbaDbSharePoint.ps1 +++ b/functions/Get-DbaDbSharePoint.ps1 @@ -47,7 +47,7 @@ function Get-DbaDbSharePoint { Returns databases that are part of a SharePoint Farm, as found in SharePoint_Config_2016 on sqlcluster -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -73,5 +73,4 @@ function Get-DbaDbSharePoint { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbSnapshot.ps1 b/functions/Get-DbaDbSnapshot.ps1 index 6abf44990e..fc5c953348 100644 --- a/functions/Get-DbaDbSnapshot.ps1 +++ b/functions/Get-DbaDbSnapshot.ps1 @@ -56,7 +56,7 @@ function Get-DbaDbSnapshot { Returns information for database snapshots HR_snapshot and Accounting_snapshot -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -112,5 +112,4 @@ function Get-DbaDbSnapshot { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaDatabaseSnapshot } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbSpace.ps1 b/functions/Get-DbaDbSpace.ps1 index 2c9960c3bb..6fe4fa2d63 100644 --- a/functions/Get-DbaDbSpace.ps1 +++ b/functions/Get-DbaDbSpace.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbSpace { Returns database files and free space information for the db1 and db2 on localhost. -#> + #> [CmdletBinding()] param ([parameter(ValueFromPipeline, Mandatory)] [Alias("ServerInstance", "SqlServer")] @@ -224,5 +224,4 @@ function Get-DbaDbSpace { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaDatabaseFreeSpace Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Get-DbaDatabaseSpace } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbState.ps1 b/functions/Get-DbaDbState.ps1 index 04bd90afca..2bb37248fc 100644 --- a/functions/Get-DbaDbState.ps1 +++ b/functions/Get-DbaDbState.ps1 @@ -60,7 +60,7 @@ function Get-DbaDbState { Gets options for all databases of sqlserver2014a and sqlserver2014b instances -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseLiteralInitializerForHashtable", "")] [CmdletBinding()] param ( @@ -131,5 +131,4 @@ FROM sys.databases end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseState } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbStoredProcedure.ps1 b/functions/Get-DbaDbStoredProcedure.ps1 index 90b1c8d3ad..d42d9cef55 100644 --- a/functions/Get-DbaDbStoredProcedure.ps1 +++ b/functions/Get-DbaDbStoredProcedure.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbStoredProcedure { Gets the Stored Procedures for the databases on Sql1 and Sql2/sqlexpress -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -117,5 +117,4 @@ function Get-DbaDbStoredProcedure { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbTable.ps1 b/functions/Get-DbaDbTable.ps1 index 471d91de8c..7c54072132 100644 --- a/functions/Get-DbaDbTable.ps1 +++ b/functions/Get-DbaDbTable.ps1 @@ -78,7 +78,7 @@ function Get-DbaDbTable { The Table name, Schema name and Database name must be wrapped in square brackets [ ] Special charcters like " must be escaped by a ` charcter. In addition any actual instance of the ] character must be escaped by being duplicated. -#> + #> [CmdletBinding()] param ([parameter(ValueFromPipeline, Mandatory)] [Alias("ServerInstance", "SqlServer")] @@ -187,5 +187,4 @@ function Get-DbaDbTable { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaTable } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbTrigger.ps1 b/functions/Get-DbaDbTrigger.ps1 index e8ec728b80..5faf1f27eb 100644 --- a/functions/Get-DbaDbTrigger.ps1 +++ b/functions/Get-DbaDbTrigger.ps1 @@ -52,7 +52,7 @@ function Get-DbaDbTrigger { Returns all triggers for database supa on sql2017 -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -83,5 +83,4 @@ function Get-DbaDbTrigger { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbUdf.ps1 b/functions/Get-DbaDbUdf.ps1 index 801d392c98..628d4904e2 100644 --- a/functions/Get-DbaDbUdf.ps1 +++ b/functions/Get-DbaDbUdf.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbUdf { Gets the User Defined Functions for the databases on Sql1 and Sql2/sqlexpress -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -118,5 +118,4 @@ function Get-DbaDbUdf { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseUdf } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbUser.ps1 b/functions/Get-DbaDbUser.ps1 index 08e8081515..ebae3f1b62 100644 --- a/functions/Get-DbaDbUser.ps1 +++ b/functions/Get-DbaDbUser.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbUser { Gets the users for the databases on Sql1 and Sql2/sqlexpress -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -118,5 +118,4 @@ function Get-DbaDbUser { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseUser } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbView.ps1 b/functions/Get-DbaDbView.ps1 index 0244884e58..0e9ed4e35d 100644 --- a/functions/Get-DbaDbView.ps1 +++ b/functions/Get-DbaDbView.ps1 @@ -59,7 +59,7 @@ function Get-DbaDbView { Gets the views for the databases on Sql1 and Sql2/sqlexpress -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -116,5 +116,4 @@ function Get-DbaDbView { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDatabaseView } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDbVirtualLogFile.ps1 b/functions/Get-DbaDbVirtualLogFile.ps1 index a5dfaf5f27..804adac0d4 100644 --- a/functions/Get-DbaDbVirtualLogFile.ps1 +++ b/functions/Get-DbaDbVirtualLogFile.ps1 @@ -66,7 +66,7 @@ function Get-DbaDbVirtualLogFile { Returns the VLF counts for the db1 and db2 databases on sqlcluster. -#> + #> [CmdletBinding()] [OutputType([System.Collections.ArrayList])] param ([parameter(ValueFromPipeline, Mandatory)] @@ -128,5 +128,4 @@ function Get-DbaDbVirtualLogFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDefaultPath.ps1 b/functions/Get-DbaDefaultPath.ps1 index 11b1e3ca67..1b54b798d3 100644 --- a/functions/Get-DbaDefaultPath.ps1 +++ b/functions/Get-DbaDefaultPath.ps1 @@ -39,7 +39,7 @@ function Get-DbaDefaultPath { Returns the default file paths for "sql2014","sql2016" and "sqlcluster\sharepoint" -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -101,5 +101,4 @@ function Get-DbaDefaultPath { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDependency.ps1 b/functions/Get-DbaDependency.ps1 index c6fee88993..46f814a01c 100644 --- a/functions/Get-DbaDependency.ps1 +++ b/functions/Get-DbaDependency.ps1 @@ -51,7 +51,7 @@ function Get-DbaDependency { Returns everything that depends on the "Customers" table -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -249,5 +249,4 @@ function Get-DbaDependency { $resolved | Get-DependencyTreeNodeDetail -Server $server -OriginalResource $Item -AllowSystemObjects $AllowSystemObjects | Select-DependencyPrecedence } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDeprecatedFeature.ps1 b/functions/Get-DbaDeprecatedFeature.ps1 index df1f249a96..8570718ba4 100644 --- a/functions/Get-DbaDeprecatedFeature.ps1 +++ b/functions/Get-DbaDeprecatedFeature.ps1 @@ -38,7 +38,7 @@ function Get-DbaDeprecatedFeature { Check deprecated features on server sql2008. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -74,5 +74,4 @@ function Get-DbaDeprecatedFeature { } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDetachedDatabaseInfo.ps1 b/functions/Get-DbaDetachedDatabaseInfo.ps1 index dd21fd4507..ed319a0111 100644 --- a/functions/Get-DbaDetachedDatabaseInfo.ps1 +++ b/functions/Get-DbaDetachedDatabaseInfo.ps1 @@ -37,7 +37,7 @@ function Get-DbaDetachedDatabaseInfo { Returns information about the detached database file M:\Archive\mydb.mdf using the SQL Server instance sql2016. The M drive is relative to the SQL Server instance. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( @@ -137,5 +137,4 @@ function Get-DbaDetachedDatabaseInfo { $server.ConnectionContext.Disconnect() return $mdfinfo } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDiskSpace.ps1 b/functions/Get-DbaDiskSpace.ps1 index 95847140b6..f0dc6d5014 100644 --- a/functions/Get-DbaDiskSpace.ps1 +++ b/functions/Get-DbaDiskSpace.ps1 @@ -89,7 +89,7 @@ function Get-DbaDiskSpace { Get all disk and volume space information. -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -212,5 +212,4 @@ function Get-DbaDiskSpace { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaDump.ps1 b/functions/Get-DbaDump.ps1 index 976e8c4a85..e69ef0cf3b 100644 --- a/functions/Get-DbaDump.ps1 +++ b/functions/Get-DbaDump.ps1 @@ -38,7 +38,7 @@ function Get-DbaDump { Shows the detailed information for memory dump(s) located on sql2016 instance. Logs into the SQL Server using the SQL login 'sqladmin' -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -75,5 +75,4 @@ function Get-DbaDump { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaEndpoint.ps1 b/functions/Get-DbaEndpoint.ps1 index fba5c97032..f0d1d09b8d 100644 --- a/functions/Get-DbaEndpoint.ps1 +++ b/functions/Get-DbaEndpoint.ps1 @@ -45,7 +45,7 @@ function Get-DbaEndpoint { Returns all endpoints for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -113,5 +113,4 @@ function Get-DbaEndpoint { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaErrorLog.ps1 b/functions/Get-DbaErrorLog.ps1 index cffb74a5bd..da7542ee28 100644 --- a/functions/Get-DbaErrorLog.ps1 +++ b/functions/Get-DbaErrorLog.ps1 @@ -82,7 +82,7 @@ function Get-DbaErrorLog { Returns every log entry found before the date 16 August 2016 from sql101\sharepoint SQL Server instance. -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -142,5 +142,4 @@ function Get-DbaErrorLog { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaErrorLogConfig.ps1 b/functions/Get-DbaErrorLogConfig.ps1 index 69f53440ea..07157a9ae7 100644 --- a/functions/Get-DbaErrorLogConfig.ps1 +++ b/functions/Get-DbaErrorLogConfig.ps1 @@ -35,7 +35,7 @@ function Get-DbaErrorLogConfig { Returns error log configuration for server2017 and server2014 -#> + #> [cmdletbinding()] param ( [Parameter(ValueFromPipeline, Mandatory)] @@ -69,5 +69,4 @@ function Get-DbaErrorLogConfig { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaEstimatedCompletionTime.ps1 b/functions/Get-DbaEstimatedCompletionTime.ps1 index 7aa8b1b453..72cb90f8c8 100644 --- a/functions/Get-DbaEstimatedCompletionTime.ps1 +++ b/functions/Get-DbaEstimatedCompletionTime.ps1 @@ -72,7 +72,7 @@ function Get-DbaEstimatedCompletionTime { Gets estimated completion times for queries performed against the Northwind, pubs, and Adventureworks2014 databases -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -153,5 +153,4 @@ function Get-DbaEstimatedCompletionTime { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaExecutionPlan.ps1 b/functions/Get-DbaExecutionPlan.ps1 index 2524872f23..72be9a9f5d 100644 --- a/functions/Get-DbaExecutionPlan.ps1 +++ b/functions/Get-DbaExecutionPlan.ps1 @@ -77,7 +77,7 @@ function Get-DbaExecutionPlan { Gets super detailed information for execution plans on sqlserver2014a and sql2016 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -213,5 +213,4 @@ function Get-DbaExecutionPlan { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaFeature.ps1 b/functions/Get-DbaFeature.ps1 index 66386fd14e..76ec9a272a 100644 --- a/functions/Get-DbaFeature.ps1 +++ b/functions/Get-DbaFeature.ps1 @@ -59,7 +59,7 @@ function Get-DbaFeature { Gets all SQL Server features for all instances on sql2017 using the ad\sqladmin credential (which has access to the Windows Server). -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -117,5 +117,4 @@ function Get-DbaFeature { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlFeature } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaFile.ps1 b/functions/Get-DbaFile.ps1 index 7e4805e75a..ef97906022 100644 --- a/functions/Get-DbaFile.ps1 +++ b/functions/Get-DbaFile.ps1 @@ -67,7 +67,7 @@ function Get-DbaFile { Finds files in E:\Dir1 ending with ".fsf" and ".mld" for both the servers sql2014 and sql2016. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -211,5 +211,4 @@ function Get-DbaFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaFilestream.ps1 b/functions/Get-DbaFilestream.ps1 index a7fe01f633..3f24a35c4b 100644 --- a/functions/Get-DbaFilestream.ps1 +++ b/functions/Get-DbaFilestream.ps1 @@ -43,7 +43,7 @@ function Get-DbaFilestream { PS C:\> Get-DbaFilestream -SqlInstance server1\instance2 -SqlCredential sqladmin Prompts for the password to the SQL Login "sqladmin" then returns the status of Filestream configuration for the service and instance server1\instance2 - #> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -138,4 +138,4 @@ function Get-DbaFilestream { } | Select-DefaultView -Property ComputerName, InstanceName, SqlInstance, InstanceAccess, ServiceAccess, ServiceShareName } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaForceNetworkEncryption.ps1 b/functions/Get-DbaForceNetworkEncryption.ps1 index c93c9bbab5..2fe90d51e2 100644 --- a/functions/Get-DbaForceNetworkEncryption.ps1 +++ b/functions/Get-DbaForceNetworkEncryption.ps1 @@ -41,7 +41,7 @@ function Get-DbaForceNetworkEncryption { Gets Force Network Encryption for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both login and view the registry. - #> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] diff --git a/functions/Get-DbaHelpIndex.ps1 b/functions/Get-DbaHelpIndex.ps1 index 97e4a8c5fa..d95d9ff8cd 100644 --- a/functions/Get-DbaHelpIndex.ps1 +++ b/functions/Get-DbaHelpIndex.ps1 @@ -118,7 +118,7 @@ function Get-DbaHelpIndex { Returns the index information for all indexes in the MyDB database -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -1100,5 +1100,4 @@ function Get-DbaHelpIndex { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaInstanceProperty.ps1 b/functions/Get-DbaInstanceProperty.ps1 index c2850dd8e5..498c6388d0 100644 --- a/functions/Get-DbaInstanceProperty.ps1 +++ b/functions/Get-DbaInstanceProperty.ps1 @@ -66,7 +66,7 @@ function Get-DbaInstanceProperty { Connects using sqladmin credential and returns SQL Server instance properties from sql2 -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -151,5 +151,4 @@ function Get-DbaInstanceProperty { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlInstanceProperty } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaInstanceUserOption.ps1 b/functions/Get-DbaInstanceUserOption.ps1 index a18af24458..b6c6d82d69 100644 --- a/functions/Get-DbaInstanceUserOption.ps1 +++ b/functions/Get-DbaInstanceUserOption.ps1 @@ -44,7 +44,7 @@ function Get-DbaInstanceUserOption { Returns SQL Instance user options on sql2 and sql4 -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -74,5 +74,4 @@ function Get-DbaInstanceUserOption { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlInstanceUserOption } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaIoLatency.ps1 b/functions/Get-DbaIoLatency.ps1 index 5d0ed0b37c..214b68b00d 100644 --- a/functions/Get-DbaIoLatency.ps1 +++ b/functions/Get-DbaIoLatency.ps1 @@ -53,7 +53,7 @@ function Get-DbaIoLatency { PS C:\> Get-DbaIoLatency -SqlInstance sql2008 -SqlCredential $cred Connects using sqladmin credential and returns IO subsystem latency statistics from sql2008 -#> + #> [CmdletBinding()] Param ( [parameter(Mandatory, ValueFromPipeline)] @@ -164,5 +164,4 @@ function Get-DbaIoLatency { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaLastBackup.ps1 b/functions/Get-DbaLastBackup.ps1 index e918e60cf6..bb4f6151f0 100644 --- a/functions/Get-DbaLastBackup.ps1 +++ b/functions/Get-DbaLastBackup.ps1 @@ -55,7 +55,7 @@ function Get-DbaLastBackup { Returns a gridview displaying Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, SinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -160,5 +160,4 @@ function Get-DbaLastBackup { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaLastGoodCheckDb.ps1 b/functions/Get-DbaLastGoodCheckDb.ps1 index 4593879f7f..54ddda73af 100644 --- a/functions/Get-DbaLastGoodCheckDb.ps1 +++ b/functions/Get-DbaLastGoodCheckDb.ps1 @@ -71,7 +71,7 @@ function Get-DbaLastGoodCheckDb { Returns a formatted table displaying Server, Database, DatabaseCreated, LastGoodCheckDb, DaysSinceDbCreated, DaysSinceLastGoodCheckDb, Status and DataPurityEnabled. All databases except for "TempDB" will be displayed in the output. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -167,5 +167,4 @@ function Get-DbaLastGoodCheckDb { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaLatchStatistic.ps1 b/functions/Get-DbaLatchStatistic.ps1 index 52ea7d58b7..6988a2cb73 100644 --- a/functions/Get-DbaLatchStatistic.ps1 +++ b/functions/Get-DbaLatchStatistic.ps1 @@ -74,7 +74,7 @@ function Get-DbaLatchStatistic { PS C:\> foreach ($row in ($output | Sort-Object -Unique Url)) { Start-Process ($row).Url } Displays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -140,5 +140,4 @@ function Get-DbaLatchStatistic { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaLinkedServer.ps1 b/functions/Get-DbaLinkedServer.ps1 index b3ffb0f413..74524d2d72 100644 --- a/functions/Get-DbaLinkedServer.ps1 +++ b/functions/Get-DbaLinkedServer.ps1 @@ -44,7 +44,7 @@ function Get-DbaLinkedServer { PS C:\> Get-DbaCmsRegServer -SqlInstance DEV01 -Group SQLDEV | Get-DbaLinkedServer | Out-GridView Returns all linked servers for a group of servers from SQL Server Central Management Server (CMS). Send output to GridView. -#> + #> [CmdletBinding(DefaultParameterSetName = 'Default')] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -84,4 +84,4 @@ function Get-DbaLinkedServer { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaLocaleSetting.ps1 b/functions/Get-DbaLocaleSetting.ps1 index 32c4afc5f2..008aef4e96 100644 --- a/functions/Get-DbaLocaleSetting.ps1 +++ b/functions/Get-DbaLocaleSetting.ps1 @@ -45,7 +45,7 @@ function Get-DbaLocaleSetting { Gets the Locale settings on computers sql1 and sql2 using SQL Authentication to authenticate to the servers, and shows them in a grid view. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -97,5 +97,4 @@ function Get-DbaLocaleSetting { } } #foreach computer } #PROCESS -} #function - +} #function \ No newline at end of file diff --git a/functions/Get-DbaLogin.ps1 b/functions/Get-DbaLogin.ps1 index 570c5c6ba1..9b9ffc8fc7 100644 --- a/functions/Get-DbaLogin.ps1 +++ b/functions/Get-DbaLogin.ps1 @@ -228,5 +228,4 @@ function Get-DbaLogin { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaMaintenanceSolutionLog.ps1 b/functions/Get-DbaMaintenanceSolutionLog.ps1 index 5658d56938..1eab54d681 100644 --- a/functions/Get-DbaMaintenanceSolutionLog.ps1 +++ b/functions/Get-DbaMaintenanceSolutionLog.ps1 @@ -67,7 +67,7 @@ function Get-DbaMaintenanceSolutionLog { Gets the outcome of the IndexOptimize job on sqlserver2014a, the other options are not yet available! sorry -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseApprovedVerbs", "", Justification = "Internal functions are ignored")] param ( @@ -250,4 +250,4 @@ function Get-DbaMaintenanceSolutionLog { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaManagementObject.ps1 b/functions/Get-DbaManagementObject.ps1 index fc983881b1..2b8efeaccf 100644 --- a/functions/Get-DbaManagementObject.ps1 +++ b/functions/Get-DbaManagementObject.ps1 @@ -43,7 +43,7 @@ function Get-DbaManagementObject { Returns just the version specified. If the version does not exist then it will return nothing. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -151,5 +151,4 @@ function Get-DbaManagementObject { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlManagementObject } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaMaxMemory.ps1 b/functions/Get-DbaMaxMemory.ps1 index 66460541e7..c707575b8b 100644 --- a/functions/Get-DbaMaxMemory.ps1 +++ b/functions/Get-DbaMaxMemory.ps1 @@ -6,7 +6,7 @@ function Get-DbaMaxMemory { .DESCRIPTION This command retrieves the SQL Server 'Max Server Memory' configuration setting as well as the total physical installed on the server. - + Results are turned in megabytes (MB). .PARAMETER SqlInstance @@ -45,7 +45,7 @@ function Get-DbaMaxMemory { PS C:\> Find-DbaInstance -ComputerName localhost | Get-DbaMaxMemory | Format-Table -AutoSize Scans localhost for instances using the browser service, traverses all instances and displays memory settings in a formatted table. - #> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] diff --git a/functions/Get-DbaMemoryCondition.ps1 b/functions/Get-DbaMemoryCondition.ps1 index cab554def7..092b6661c9 100644 --- a/functions/Get-DbaMemoryCondition.ps1 +++ b/functions/Get-DbaMemoryCondition.ps1 @@ -40,7 +40,7 @@ function Get-DbaMemoryCondition { PS C:\> Get-DbaCmsRegServer -SqlInstance sqlserver2014a -Group GroupName | Get-DbaMemoryCondition | Out-GridView Returns the memory conditions for a group of servers from SQL Server Central Management Server (CMS). Send output to GridView. - #> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] diff --git a/functions/Get-DbaMemoryUsage.ps1 b/functions/Get-DbaMemoryUsage.ps1 index 909d6d49fc..fc7d3c50c3 100644 --- a/functions/Get-DbaMemoryUsage.ps1 +++ b/functions/Get-DbaMemoryUsage.ps1 @@ -54,7 +54,7 @@ function Get-DbaMemoryUsage { Returns a gridview displaying Server, counter instance, counter, number of pages, memory in KB, memory in MB -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -221,4 +221,4 @@ function Get-DbaMemoryUsage { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaModule.ps1 b/functions/Get-DbaModule.ps1 index 80c358565e..2ad20ceccb 100644 --- a/functions/Get-DbaModule.ps1 +++ b/functions/Get-DbaModule.ps1 @@ -67,7 +67,7 @@ function Get-DbaModule { Return all modules on server sql2008 for all databases that are triggers, views or scalar functions. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -177,5 +177,4 @@ function Get-DbaModule { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlModule } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaMsdtc.ps1 b/functions/Get-DbaMsdtc.ps1 index a2b2ee370a..718c015732 100644 --- a/functions/Get-DbaMsdtc.ps1 +++ b/functions/Get-DbaMsdtc.ps1 @@ -44,7 +44,7 @@ function Get-DbaMsdtc { Get DTC status for the computer srv0042 and show in a grid view -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -131,5 +131,4 @@ function Get-DbaMsdtc { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaNetworkActivity.ps1 b/functions/Get-DbaNetworkActivity.ps1 index e150ee1b38..020b2bbece 100644 --- a/functions/Get-DbaNetworkActivity.ps1 +++ b/functions/Get-DbaNetworkActivity.ps1 @@ -46,7 +46,7 @@ function Get-DbaNetworkActivity { Gets the Current traffic on every Network Interface on computers sql1 and sql2, and shows them in a grid view. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -88,5 +88,4 @@ function Get-DbaNetworkActivity { } } #foreach computer } #PROCESS -} #function - +} #function \ No newline at end of file diff --git a/functions/Get-DbaNetworkCertificate.ps1 b/functions/Get-DbaNetworkCertificate.ps1 index 3254c89812..c259f6b4e3 100644 --- a/functions/Get-DbaNetworkCertificate.ps1 +++ b/functions/Get-DbaNetworkCertificate.ps1 @@ -35,7 +35,7 @@ function Get-DbaNetworkCertificate { Gets computer certificates on sql2016 that are being used for SQL Server network encryption -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -127,5 +127,4 @@ function Get-DbaNetworkCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaOpenTransaction.ps1 b/functions/Get-DbaOpenTransaction.ps1 index 84e0ca56c1..3eedd78a7c 100644 --- a/functions/Get-DbaOpenTransaction.ps1 +++ b/functions/Get-DbaOpenTransaction.ps1 @@ -39,7 +39,7 @@ function Get-DbaOpenTransaction { Logs into sqlserver2014a using the login "sqladmin" -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -98,5 +98,4 @@ function Get-DbaOpenTransaction { $server.Query($sql) } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaOperatingSystem.ps1 b/functions/Get-DbaOperatingSystem.ps1 index 05575247cd..b86d465f78 100644 --- a/functions/Get-DbaOperatingSystem.ps1 +++ b/functions/Get-DbaOperatingSystem.ps1 @@ -49,7 +49,7 @@ function Get-DbaOperatingSystem { PS C:\> Get-Content .\servers.txt | Get-DbaOperatingSystem Returns information about all the servers operating system that are stored in the file. Every line in the file can only contain one hostname for a server. -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -181,6 +181,4 @@ function Get-DbaOperatingSystem { } | Select-DefaultView -Property ComputerName, Manufacturer, Organization, Architecture, Version, Caption, LastBootTime, LocalDateTime, PowerShellVersion, TimeZone, TotalVisibleMemory, ActivePowerPlan, LanguageNative } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaOrphanUser.ps1 b/functions/Get-DbaOrphanUser.ps1 index c9064ac0c4..9c60cd1fff 100644 --- a/functions/Get-DbaOrphanUser.ps1 +++ b/functions/Get-DbaOrphanUser.ps1 @@ -56,7 +56,7 @@ function Get-DbaOrphanUser { Finds orphan users without matching Logins in the db1 database present on server 'localhost\sql2016'. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -125,5 +125,4 @@ function Get-DbaOrphanUser { } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPageFileSetting.ps1 b/functions/Get-DbaPageFileSetting.ps1 index 7c88346c73..7c397de545 100644 --- a/functions/Get-DbaPageFileSetting.ps1 +++ b/functions/Get-DbaPageFileSetting.ps1 @@ -43,7 +43,7 @@ function Get-DbaPageFileSetting { Returns a custom object displaying ComputerName, AutoPageFile, FileName, Status, LastModified, LastAccessed, AllocatedBaseSize, InitialSize, MaximumSize, PeakUsage, CurrentUsage for ServerA -#> + #> [CmdletBinding()] param ( [Parameter(Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName = $true)] @@ -112,6 +112,4 @@ function Get-DbaPageFileSetting { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaPbmCategory.ps1 b/functions/Get-DbaPbmCategory.ps1 index 30cb972d3c..1316e5d0aa 100644 --- a/functions/Get-DbaPbmCategory.ps1 +++ b/functions/Get-DbaPbmCategory.ps1 @@ -47,7 +47,7 @@ function Get-DbaPbmCategory { Uses a credential $cred to connect and return all policy categories from the sql2016 PBM server -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -84,5 +84,4 @@ function Get-DbaPbmCategory { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPbmCategorySubscription.ps1 b/functions/Get-DbaPbmCategorySubscription.ps1 index 2741f07f7f..9ced816ac0 100644 --- a/functions/Get-DbaPbmCategorySubscription.ps1 +++ b/functions/Get-DbaPbmCategorySubscription.ps1 @@ -41,7 +41,7 @@ function Get-DbaPbmCategorySubscription { Uses a credential $cred to connect and return all policy category subscriptions from the sql2016 PBM server -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -68,5 +68,4 @@ function Get-DbaPbmCategorySubscription { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPbmCondition.ps1 b/functions/Get-DbaPbmCondition.ps1 index 392459b668..d7f5f9da32 100644 --- a/functions/Get-DbaPbmCondition.ps1 +++ b/functions/Get-DbaPbmCondition.ps1 @@ -47,7 +47,7 @@ function Get-DbaPbmCondition { Uses a credential $cred to connect and return all conditions from the sql2016 PBM server -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -84,5 +84,4 @@ function Get-DbaPbmCondition { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPbmObjectSet.ps1 b/functions/Get-DbaPbmObjectSet.ps1 index 63fd4093e0..37e47f41d8 100644 --- a/functions/Get-DbaPbmObjectSet.ps1 +++ b/functions/Get-DbaPbmObjectSet.ps1 @@ -47,7 +47,7 @@ function Get-DbaPbmObjectSet { Uses a credential $cred to connect and return all object sets from the sql2016 PBM instance -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -84,5 +84,4 @@ function Get-DbaPbmObjectSet { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPbmPolicy.ps1 b/functions/Get-DbaPbmPolicy.ps1 index 4e27188a01..46d8cf82d7 100644 --- a/functions/Get-DbaPbmPolicy.ps1 +++ b/functions/Get-DbaPbmPolicy.ps1 @@ -55,7 +55,7 @@ function Get-DbaPbmPolicy { Returns all policies from sql2016 server that part of the PolicyCategory MorningCheck -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer")] @@ -101,6 +101,4 @@ function Get-DbaPbmPolicy { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaPolicy } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaPbmStore.ps1 b/functions/Get-DbaPbmStore.ps1 index 1e66047fbc..0d68cf17f8 100644 --- a/functions/Get-DbaPbmStore.ps1 +++ b/functions/Get-DbaPbmStore.ps1 @@ -47,7 +47,7 @@ function Get-DbaPbmStore { Uses a credential $cred to connect and return the policy store from the sql2016 instance -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -77,5 +77,4 @@ function Get-DbaPbmStore { Select-DefaultView -InputObject $store -ExcludeProperty SqlStoreConnection, ConnectionContext, Properties, Urn, Parent, DomainInstanceName, Metadata, IdentityKey, Name } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPermission.ps1 b/functions/Get-DbaPermission.ps1 index b4d207d64a..2e1e9becc4 100644 --- a/functions/Get-DbaPermission.ps1 +++ b/functions/Get-DbaPermission.ps1 @@ -67,7 +67,7 @@ function Get-DbaPermission { Returns a custom object with permissions for the master database. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -248,5 +248,4 @@ function Get-DbaPermission { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPfAvailableCounter.ps1 b/functions/Get-DbaPfAvailableCounter.ps1 index 7c16f58b13..83290f6567 100644 --- a/functions/Get-DbaPfAvailableCounter.ps1 +++ b/functions/Get-DbaPfAvailableCounter.ps1 @@ -62,7 +62,7 @@ function Get-DbaPfAvailableCounter { Adds all counters matching "sql" to the DataCollector01 within the 'Test Collector Set' CollectorSet. -#> + #> [CmdletBinding()] param ( [DbaInstance[]]$ComputerName = $env:ComputerName, @@ -103,5 +103,4 @@ function Get-DbaPfAvailableCounter { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPfDataCollector.ps1 b/functions/Get-DbaPfDataCollector.ps1 index 73c606859d..d653988abb 100644 --- a/functions/Get-DbaPfDataCollector.ps1 +++ b/functions/Get-DbaPfDataCollector.ps1 @@ -60,7 +60,7 @@ function Get-DbaPfDataCollector { Gets all Collectors for the 'System Correlation' CollectorSet. -#> + #> [CmdletBinding()] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -136,5 +136,4 @@ function Get-DbaPfDataCollector { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPfDataCollectorCounter.ps1 b/functions/Get-DbaPfDataCollectorCounter.ps1 index 1e55dff110..95e94d2a27 100644 --- a/functions/Get-DbaPfDataCollectorCounter.ps1 +++ b/functions/Get-DbaPfDataCollectorCounter.ps1 @@ -68,7 +68,7 @@ function Get-DbaPfDataCollectorCounter { Gets all counters for the 'System Correlation' CollectorSet. -#> + #> [CmdletBinding()] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -120,5 +120,4 @@ function Get-DbaPfDataCollectorCounter { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPfDataCollectorCounterSample.ps1 b/functions/Get-DbaPfDataCollectorCounterSample.ps1 index 104a82d178..55f27820e5 100644 --- a/functions/Get-DbaPfDataCollectorCounterSample.ps1 +++ b/functions/Get-DbaPfDataCollectorCounterSample.ps1 @@ -87,7 +87,7 @@ function Get-DbaPfDataCollectorCounterSample { Gets a single sample for all counters for the 'System Correlation' CollectorSet. -#> + #> [CmdletBinding()] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -195,5 +195,4 @@ function Get-DbaPfDataCollectorCounterSample { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPfDataCollectorSet.ps1 b/functions/Get-DbaPfDataCollectorSet.ps1 index 7a3556995f..895e6e1ae0 100644 --- a/functions/Get-DbaPfDataCollectorSet.ps1 +++ b/functions/Get-DbaPfDataCollectorSet.ps1 @@ -54,7 +54,7 @@ function Get-DbaPfDataCollectorSet { Displays extra columns and also exposes the original COM object in DataCollectorSetObject. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -185,5 +185,4 @@ function Get-DbaPfDataCollectorSet { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPfDataCollectorSetTemplate.ps1 b/functions/Get-DbaPfDataCollectorSetTemplate.ps1 index 58709cdb64..cfa90beaed 100644 --- a/functions/Get-DbaPfDataCollectorSetTemplate.ps1 +++ b/functions/Get-DbaPfDataCollectorSetTemplate.ps1 @@ -47,7 +47,7 @@ function Get-DbaPfDataCollectorSetTemplate { Returns more information about the template, including the full path/filename. -#> + #> [CmdletBinding()] param ( [string[]]$Path = "$script:PSModuleRoot\bin\perfmontemplates\collectorsets", @@ -105,5 +105,4 @@ function Get-DbaPfDataCollectorSetTemplate { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaPlanCache.ps1 b/functions/Get-DbaPlanCache.ps1 index 4d114dafd7..0f248ef945 100644 --- a/functions/Get-DbaPlanCache.ps1 +++ b/functions/Get-DbaPlanCache.ps1 @@ -42,7 +42,7 @@ function Get-DbaPlanCache { Returns the single use plan cache usage information for SQL Server instance 2017 using login 'sqladmin' -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -74,6 +74,4 @@ function Get-DbaPlanCache { Select-DefaultView -InputObject $results -Property ComputerName, InstanceName, SqlInstance, Size, UseCount } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaPrivilege.ps1 b/functions/Get-DbaPrivilege.ps1 index 23a5f71f9c..b0d0154674 100644 --- a/functions/Get-DbaPrivilege.ps1 +++ b/functions/Get-DbaPrivilege.ps1 @@ -45,7 +45,7 @@ function Get-DbaPrivilege { Gets the local privileges on computers sql1 and sql2, and shows them in a grid view. - #> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] diff --git a/functions/Get-DbaProcess.ps1 b/functions/Get-DbaProcess.ps1 index ad2c1f7b4f..1a00937e35 100644 --- a/functions/Get-DbaProcess.ps1 +++ b/functions/Get-DbaProcess.ps1 @@ -73,7 +73,7 @@ function Get-DbaProcess { Shows information about the processes that were initiated by hosts (computers/clients) workstationx and server 1000. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -200,5 +200,4 @@ function Get-DbaProcess { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaProductKey.ps1 b/functions/Get-DbaProductKey.ps1 index e0053139e9..c2bf0dafc8 100644 --- a/functions/Get-DbaProductKey.ps1 +++ b/functions/Get-DbaProductKey.ps1 @@ -41,7 +41,7 @@ function Get-DbaProductKey { Gets SQL Server versions, editions and product keys for all instances within each server or workstation. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline, Mandatory)] @@ -216,5 +216,4 @@ function Get-DbaProductKey { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Parameter CMSStore Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Parameter ServersFromFile } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaQueryExecutionTime.ps1 b/functions/Get-DbaQueryExecutionTime.ps1 index 09cdc21bb2..135433a595 100644 --- a/functions/Get-DbaQueryExecutionTime.ps1 +++ b/functions/Get-DbaQueryExecutionTime.ps1 @@ -62,7 +62,7 @@ function Get-DbaQueryExecutionTime { Return the top 100 slowest stored procedures or statements on server sql2008 for only the TestDB database, limiting results to queries with more than 200 total executions and an execution time over 1000ms or higher. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -234,5 +234,4 @@ function Get-DbaQueryExecutionTime { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRegistryRoot.ps1 b/functions/Get-DbaRegistryRoot.ps1 index 703bc027fb..4872cbe441 100644 --- a/functions/Get-DbaRegistryRoot.ps1 +++ b/functions/Get-DbaRegistryRoot.ps1 @@ -35,7 +35,7 @@ function Get-DbaRegistryRoot { Gets the registry root for all instances on server1 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -98,5 +98,4 @@ function Get-DbaRegistryRoot { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlRegistryRoot } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRepDistributor.ps1 b/functions/Get-DbaRepDistributor.ps1 index 14eeb52744..dbc159662c 100644 --- a/functions/Get-DbaRepDistributor.ps1 +++ b/functions/Get-DbaRepDistributor.ps1 @@ -33,7 +33,7 @@ function Get-DbaRepDistributor { Retrieve distributor information for servers sql2008 and sqlserver2012. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -82,5 +82,4 @@ function Get-DbaRepDistributor { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaDistributor } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRepPublication.ps1 b/functions/Get-DbaRepPublication.ps1 index 988e131385..ab98b5cbdf 100644 --- a/functions/Get-DbaRepPublication.ps1 +++ b/functions/Get-DbaRepPublication.ps1 @@ -47,7 +47,7 @@ function Get-DbaRepPublication { Return all publications on server sql2008 for all databases that have Transactional publications -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -108,5 +108,4 @@ function Get-DbaRepPublication { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRepServer.ps1 b/functions/Get-DbaRepServer.ps1 index 4b001052ac..b2d45c3a9f 100644 --- a/functions/Get-DbaRepServer.ps1 +++ b/functions/Get-DbaRepServer.ps1 @@ -36,7 +36,7 @@ function Get-DbaRepServer { Gets the replication server object for sql2016 using SQL authentication -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -55,5 +55,4 @@ function Get-DbaRepServer { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaResourceGovernor.ps1 b/functions/Get-DbaResourceGovernor.ps1 index 56e10c4f86..ba6f7238e8 100644 --- a/functions/Get-DbaResourceGovernor.ps1 +++ b/functions/Get-DbaResourceGovernor.ps1 @@ -38,7 +38,7 @@ function Get-DbaResourceGovernor { Gets the resource governor object on Sql1 and Sql2/sqlexpress instances -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -66,5 +66,4 @@ function Get-DbaResourceGovernor { Select-DefaultView -InputObject $resourcegov -Property ComputerName, InstanceName, SqlInstance, ClassifierFunction, Enabled, MaxOutstandingIOPerVolume, ReconfigurePending, ResourcePools, ExternalResourcePools } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRgClassifierFunction.ps1 b/functions/Get-DbaRgClassifierFunction.ps1 index aab7ae1a94..2535ab9002 100644 --- a/functions/Get-DbaRgClassifierFunction.ps1 +++ b/functions/Get-DbaRgClassifierFunction.ps1 @@ -41,7 +41,7 @@ function Get-DbaRgClassifierFunction { Gets the classifier function object on Sql1 and Sql2/sqlexpress instances -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -77,5 +77,4 @@ function Get-DbaRgClassifierFunction { Select-DefaultView -InputObject $classifierFunction -Property ComputerName, InstanceName, SqlInstance, Database, Schema, CreateDate, DateLastModified, Name, DataType } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRgResourcePool.ps1 b/functions/Get-DbaRgResourcePool.ps1 index 6b5e025e47..d1bb71fce7 100644 --- a/functions/Get-DbaRgResourcePool.ps1 +++ b/functions/Get-DbaRgResourcePool.ps1 @@ -50,7 +50,7 @@ function Get-DbaRgResourcePool { Gets the external resource pools on Sql1 and Sql2/sqlexpress instances -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -88,5 +88,4 @@ function Get-DbaRgResourcePool { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRgWorkloadGroup.ps1 b/functions/Get-DbaRgWorkloadGroup.ps1 index 632d2f8002..01c4b74506 100644 --- a/functions/Get-DbaRgWorkloadGroup.ps1 +++ b/functions/Get-DbaRgWorkloadGroup.ps1 @@ -41,7 +41,7 @@ function Get-DbaRgWorkloadGroup { Gets the workload groups on sql2017 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -67,5 +67,4 @@ function Get-DbaRgWorkloadGroup { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaRunningJob.ps1 b/functions/Get-DbaRunningJob.ps1 index 3ad2292db5..56f2c87454 100644 --- a/functions/Get-DbaRunningJob.ps1 +++ b/functions/Get-DbaRunningJob.ps1 @@ -47,7 +47,7 @@ function Get-DbaRunningJob { Returns all active jobs on multiple instances piped into the function. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] diff --git a/functions/Get-DbaSchemaChangeHistory.ps1 b/functions/Get-DbaSchemaChangeHistory.ps1 index 080671554c..584589eb15 100644 --- a/functions/Get-DbaSchemaChangeHistory.ps1 +++ b/functions/Get-DbaSchemaChangeHistory.ps1 @@ -62,7 +62,7 @@ function Get-DbaSchemaChangeHistory { Returns all DDL changes made to the AccountsTable object in the Finance database on the SQL Server instance localhost in the last 7 days -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -145,5 +145,4 @@ function Get-DbaSchemaChangeHistory { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerAudit.ps1 b/functions/Get-DbaServerAudit.ps1 index 3189c51f8b..349351978c 100644 --- a/functions/Get-DbaServerAudit.ps1 +++ b/functions/Get-DbaServerAudit.ps1 @@ -45,7 +45,7 @@ function Get-DbaServerAudit { Returns all Security Audits for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -92,5 +92,4 @@ function Get-DbaServerAudit { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerAuditSpecification.ps1 b/functions/Get-DbaServerAuditSpecification.ps1 index 5d88a3633f..b4abc4a310 100644 --- a/functions/Get-DbaServerAuditSpecification.ps1 +++ b/functions/Get-DbaServerAuditSpecification.ps1 @@ -39,7 +39,7 @@ function Get-DbaServerAuditSpecification { Returns all Security Audit Specifications for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -69,5 +69,4 @@ function Get-DbaServerAuditSpecification { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-SqlServerAuditSpecification } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerInstallDate.ps1 b/functions/Get-DbaServerInstallDate.ps1 index 2efacfc0d5..e06aef8665 100644 --- a/functions/Get-DbaServerInstallDate.ps1 +++ b/functions/Get-DbaServerInstallDate.ps1 @@ -61,7 +61,7 @@ function Get-DbaServerInstallDate { Returns an object with SQL Instance install date as a string for every server listed in the Central Management Server on sql2014 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -121,5 +121,4 @@ function Get-DbaServerInstallDate { } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerProtocol.ps1 b/functions/Get-DbaServerProtocol.ps1 index 73c3bf7df6..b9df3df7bf 100644 --- a/functions/Get-DbaServerProtocol.ps1 +++ b/functions/Get-DbaServerProtocol.ps1 @@ -52,7 +52,7 @@ function Get-DbaServerProtocol { Disables the VIA ServerNetworkProtocol on computer sql1. If successful, return code 0 is shown. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -90,5 +90,4 @@ function Get-DbaServerProtocol { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerRole.ps1 b/functions/Get-DbaServerRole.ps1 index e5260b21b7..681bb5da4e 100644 --- a/functions/Get-DbaServerRole.ps1 +++ b/functions/Get-DbaServerRole.ps1 @@ -45,7 +45,7 @@ function Get-DbaServerRole { Outputs the server-level role(s) that are not fixed roles on sql2017a instance. -#> + #> [CmdletBinding()] param ( [Parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -90,5 +90,4 @@ function Get-DbaServerRole { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerRoleMember.ps1 b/functions/Get-DbaServerRoleMember.ps1 index eddce434bc..8e2f2ba9dd 100644 --- a/functions/Get-DbaServerRoleMember.ps1 +++ b/functions/Get-DbaServerRoleMember.ps1 @@ -76,7 +76,7 @@ function Get-DbaServerRoleMember { Returns all server-level role(s) for the MyFriendlyDeveloper login on localhost. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -157,5 +157,4 @@ function Get-DbaServerRoleMember { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaServerTrigger.ps1 b/functions/Get-DbaServerTrigger.ps1 index 7d0f98b155..77f180ed49 100644 --- a/functions/Get-DbaServerTrigger.ps1 +++ b/functions/Get-DbaServerTrigger.ps1 @@ -33,7 +33,7 @@ function Get-DbaServerTrigger { Returns all server triggers on sql2017 -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -63,5 +63,4 @@ function Get-DbaServerTrigger { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaService.ps1 b/functions/Get-DbaService.ps1 index 95c824764e..4c0625d6a3 100644 --- a/functions/Get-DbaService.ps1 +++ b/functions/Get-DbaService.ps1 @@ -88,7 +88,7 @@ function Get-DbaService { Calls a Restart method for each Engine service on computer sql1. -#> + #> [CmdletBinding(DefaultParameterSetName = "Search")] param ( [parameter(ValueFromPipeline, Position = 1)] @@ -273,5 +273,4 @@ function Get-DbaService { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaSqlService } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaSpConfigure.ps1 b/functions/Get-DbaSpConfigure.ps1 index 7024c6155d..a33bbcc1de 100644 --- a/functions/Get-DbaSpConfigure.ps1 +++ b/functions/Get-DbaSpConfigure.ps1 @@ -67,7 +67,7 @@ function Get-DbaSpConfigure { Returns system configuration information on sql2012 using SQL Server Authentication. Only MaxServerMemory is returned as RemoteAccess was also excluded. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -227,5 +227,4 @@ function Get-DbaSpConfigure { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaSpinLockStatistic.ps1 b/functions/Get-DbaSpinLockStatistic.ps1 index cba6fc6093..6b35888406 100644 --- a/functions/Get-DbaSpinLockStatistic.ps1 +++ b/functions/Get-DbaSpinLockStatistic.ps1 @@ -58,7 +58,7 @@ function Get-DbaSpinLockStatistic { PS C:\> Get-DbaSpinLockStatistic -SqlInstance sql2008 -SqlCredential $cred Connects using sqladmin credential and returns SpinLock Statistics from sql2008 -#> + #> [CmdletBinding()] Param ( [parameter(Mandatory, ValueFromPipeline)] @@ -109,5 +109,4 @@ function Get-DbaSpinLockStatistic { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaSpn.ps1 b/functions/Get-DbaSpn.ps1 index 3314ecee90..77de77aa26 100644 --- a/functions/Get-DbaSpn.ps1 +++ b/functions/Get-DbaSpn.ps1 @@ -48,7 +48,7 @@ function Get-DbaSpn { Returns a custom object with SearchTerm (ServerName) and the SPNs that were found for multiple computers -#> + #> [cmdletbinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseApprovedVerbs", "", Justification = "Internal functions are ignored")] param ( @@ -165,4 +165,4 @@ function Get-DbaSpn { } } } -} +} \ No newline at end of file diff --git a/functions/Get-DbaSsisEnvironmentVariable.ps1 b/functions/Get-DbaSsisEnvironmentVariable.ps1 index 4991455c37..086741bbf1 100644 --- a/functions/Get-DbaSsisEnvironmentVariable.ps1 +++ b/functions/Get-DbaSsisEnvironmentVariable.ps1 @@ -104,7 +104,7 @@ function Get-DbaSsisEnvironmentVariable { Gets all variables from Environments other than 'DEV' and 'PROD' on 'localhost' server, selects Name and Value properties for variables that names start with letter 'a' and outputs it as the GridView -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -252,5 +252,4 @@ function Get-DbaSsisEnvironmentVariable { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaSsisExecutionHistory.ps1 b/functions/Get-DbaSsisExecutionHistory.ps1 index 6fb6521664..5ea7206c2c 100644 --- a/functions/Get-DbaSsisExecutionHistory.ps1 +++ b/functions/Get-DbaSsisExecutionHistory.ps1 @@ -67,7 +67,7 @@ function Get-DbaSsisExecutionHistory { Shows what would happen if the command were executed and would return the SQL statement that would be executed per instance. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory)] @@ -218,6 +218,4 @@ function Get-DbaSsisExecutionHistory { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaStartupParameter.ps1 b/functions/Get-DbaStartupParameter.ps1 index 6fa50f6054..d67dac74be 100644 --- a/functions/Get-DbaStartupParameter.ps1 +++ b/functions/Get-DbaStartupParameter.ps1 @@ -46,7 +46,7 @@ function Get-DbaStartupParameter { Logs in to WMI using the ad\sqladmin credential and gathers simplified information about the SQL Server Startup Parameters. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline, Mandatory)] @@ -187,5 +187,4 @@ function Get-DbaStartupParameter { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaSuspectPage.ps1 b/functions/Get-DbaSuspectPage.ps1 index 2c57635501..a138254508 100644 --- a/functions/Get-DbaSuspectPage.ps1 +++ b/functions/Get-DbaSuspectPage.ps1 @@ -38,7 +38,7 @@ function Get-DbaSuspectPage { Retrieve any records stored for Suspect Pages on the sql2016 SQL Server and the Test database only. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -100,5 +100,4 @@ function Get-DbaSuspectPage { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaTcpPort.ps1 b/functions/Get-DbaTcpPort.ps1 index 1df7316f76..85d2740a50 100644 --- a/functions/Get-DbaTcpPort.ps1 +++ b/functions/Get-DbaTcpPort.ps1 @@ -65,7 +65,7 @@ function Get-DbaTcpPort { Returns an object with server name, IPAddress (just ipv4), port and static ($true/$false) for every server listed in the Central Management Server on sql2014. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -203,5 +203,4 @@ function Get-DbaTcpPort { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaTempdbUsage.ps1 b/functions/Get-DbaTempdbUsage.ps1 index 322ac55c38..97246a4ccb 100644 --- a/functions/Get-DbaTempdbUsage.ps1 +++ b/functions/Get-DbaTempdbUsage.ps1 @@ -39,7 +39,7 @@ function Get-DbaTempdbUsage { Gets tempdb usage for localhost\SQLDEV2K14 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -131,5 +131,4 @@ OPTION (RECOMPILE);" $server.Query($sql) } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaTopResourceUsage.ps1 b/functions/Get-DbaTopResourceUsage.ps1 index 9d8eae55ae..2e35f0a914 100644 --- a/functions/Get-DbaTopResourceUsage.ps1 +++ b/functions/Get-DbaTopResourceUsage.ps1 @@ -72,7 +72,7 @@ function Get-DbaTopResourceUsage { Return all the columns plus the QueryPlan column -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -299,5 +299,4 @@ function Get-DbaTopResourceUsage { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaTrace.ps1 b/functions/Get-DbaTrace.ps1 index b0121d8dec..1c8e2c16a7 100644 --- a/functions/Get-DbaTrace.ps1 +++ b/functions/Get-DbaTrace.ps1 @@ -42,7 +42,7 @@ function Get-DbaTrace { Lists the default trace information on the sql2016 SQL Server. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -123,5 +123,4 @@ function Get-DbaTrace { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaTraceFlag.ps1 b/functions/Get-DbaTraceFlag.ps1 index 02d4a34708..2f46ea192e 100644 --- a/functions/Get-DbaTraceFlag.ps1 +++ b/functions/Get-DbaTraceFlag.ps1 @@ -48,7 +48,7 @@ function Get-DbaTraceFlag { Returns Trace Flag status for TF 4199 and 3205 for the local SQL Server instance if they are enabled. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -93,5 +93,4 @@ function Get-DbaTraceFlag { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaUptime.ps1 b/functions/Get-DbaUptime.ps1 index 19f1b2c8d2..ce2e47d8c6 100644 --- a/functions/Get-DbaUptime.ps1 +++ b/functions/Get-DbaUptime.ps1 @@ -54,7 +54,7 @@ function Get-DbaUptime { Returns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot time, host uptime as TimeSpan objects and host uptime as a string for every server listed in the Central Management Server on sql2014 -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -123,5 +123,4 @@ function Get-DbaUptime { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaUserPermission.ps1 b/functions/Get-DbaUserPermission.ps1 index a09ca94545..361bcebed8 100644 --- a/functions/Get-DbaUserPermission.ps1 +++ b/functions/Get-DbaUserPermission.ps1 @@ -63,7 +63,7 @@ function Get-DbaUserPermission { Check server and database permissions on server sql2008 for only the TestDB database, including public and guest grants, and sys schema objects. - #> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] diff --git a/functions/Get-DbaWaitResource.ps1 b/functions/Get-DbaWaitResource.ps1 index 6234cf3a36..cda0693657 100644 --- a/functions/Get-DbaWaitResource.ps1 +++ b/functions/Get-DbaWaitResource.ps1 @@ -50,7 +50,7 @@ function Get-DbaWaitResource { Will return an object containing; database name, schema name and index name which is being waited on, and in addition the contents of the locked row at the time the command is run. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory)] @@ -159,5 +159,4 @@ function Get-DbaWaitResource { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWaitStatistic.ps1 b/functions/Get-DbaWaitStatistic.ps1 index 64f90d0f70..685ac9900a 100644 --- a/functions/Get-DbaWaitStatistic.ps1 +++ b/functions/Get-DbaWaitStatistic.ps1 @@ -75,7 +75,7 @@ function Get-DbaWaitStatistic { Displays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -904,8 +904,4 @@ function Get-DbaWaitStatistic { } } } -} - - - - +} \ No newline at end of file diff --git a/functions/Get-DbaWaitingTask.ps1 b/functions/Get-DbaWaitingTask.ps1 index a481b5dad5..2c12358b44 100644 --- a/functions/Get-DbaWaitingTask.ps1 +++ b/functions/Get-DbaWaitingTask.ps1 @@ -45,7 +45,7 @@ function Get-DbaWaitingTask { Returns the waiting task for all sessions (user and system) on sqlserver2014a -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -133,5 +133,4 @@ function Get-DbaWaitingTask { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWindowsLog.ps1 b/functions/Get-DbaWindowsLog.ps1 index 3f56f036ee..d643bd030b 100644 --- a/functions/Get-DbaWindowsLog.ps1 +++ b/functions/Get-DbaWindowsLog.ps1 @@ -53,7 +53,7 @@ function Get-DbaWindowsLog { Returns all lines in the errorlogs that have event number 18456 in them -#> + #> #This exists to ignore the Script Analyzer rule for Start-Runspace [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] diff --git a/functions/Get-DbaWsfcAvailableDisk.ps1 b/functions/Get-DbaWsfcAvailableDisk.ps1 index dee901c48c..b87c867496 100644 --- a/functions/Get-DbaWsfcAvailableDisk.ps1 +++ b/functions/Get-DbaWsfcAvailableDisk.ps1 @@ -36,7 +36,7 @@ function Get-DbaWsfcAvailableDisk { Gets available disks from the failover cluster cluster01 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -55,5 +55,4 @@ function Get-DbaWsfcAvailableDisk { $disk | Add-Member -Force -NotePropertyName ClusterFqdn -NotePropertyValue $cluster.Fqdn -PassThru } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcCluster.ps1 b/functions/Get-DbaWsfcCluster.ps1 index 6ab389fadf..2a969b07d1 100644 --- a/functions/Get-DbaWsfcCluster.ps1 +++ b/functions/Get-DbaWsfcCluster.ps1 @@ -41,7 +41,7 @@ function Get-DbaWsfcCluster { Shows all cluster values, including the ones not shown in the default view -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -56,5 +56,4 @@ function Get-DbaWsfcCluster { $cluster | Select-DefaultView -Property Name, Fqdn, State, DrainOnShutdown, DynamicQuorumEnabled, EnableSharedVolumes, SharedVolumesRoot, QuorumPath, QuorumType, QuorumTypeValue, RequestReplyTimeout } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcDisk.ps1 b/functions/Get-DbaWsfcDisk.ps1 index a825083bdf..e97f73c9d9 100644 --- a/functions/Get-DbaWsfcDisk.ps1 +++ b/functions/Get-DbaWsfcDisk.ps1 @@ -36,7 +36,7 @@ function Get-DbaWsfcDisk { Gets disk information from the failover cluster cluster01 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -72,5 +72,4 @@ function Get-DbaWsfcDisk { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcNetwork.ps1 b/functions/Get-DbaWsfcNetwork.ps1 index d9c9eff29f..286d17d2b5 100644 --- a/functions/Get-DbaWsfcNetwork.ps1 +++ b/functions/Get-DbaWsfcNetwork.ps1 @@ -36,7 +36,7 @@ function Get-DbaWsfcNetwork { Gets network information from the failover cluster cluster01 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -55,5 +55,4 @@ function Get-DbaWsfcNetwork { $network | Select-DefaultView -Property ClusterName, ClusterFqdn, Name, Address, AddressMask, IPv4Addresses, IPv4PrefixLengths, IPv6Addresses, IPv6PrefixLengths, QuorumType, QuorumTypeValue, RequestReplyTimeout, Role } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcNetworkInterface.ps1 b/functions/Get-DbaWsfcNetworkInterface.ps1 index 4b0534dfef..f15fee6efc 100644 --- a/functions/Get-DbaWsfcNetworkInterface.ps1 +++ b/functions/Get-DbaWsfcNetworkInterface.ps1 @@ -41,7 +41,7 @@ function Get-DbaWsfcNetworkInterface { Shows all network interface values, including the ones not shown in the default view -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -58,5 +58,4 @@ function Get-DbaWsfcNetworkInterface { $network | Select-DefaultView -Property ClusterName, ClusterFqdn, Name, Network, Node, Adapter, Address, DhcpEnabled, IPv4Addresses, IPv6Addresses, IPv6Addresses } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcNode.ps1 b/functions/Get-DbaWsfcNode.ps1 index ddcf54bc7f..c1a094b329 100644 --- a/functions/Get-DbaWsfcNode.ps1 +++ b/functions/Get-DbaWsfcNode.ps1 @@ -41,7 +41,7 @@ function Get-DbaWsfcNode { Shows all node values, including the ones not shown in the default view -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -58,5 +58,4 @@ function Get-DbaWsfcNode { $node | Select-DefaultView -Property ClusterName, ClusterFqdn, Name, PrimaryOwnerName, PrimaryOwnerContact, Dedicated, NodeHighestVersion, NodeLowestVersion } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcResource.ps1 b/functions/Get-DbaWsfcResource.ps1 index 636b0c3dde..23c1cc694d 100644 --- a/functions/Get-DbaWsfcResource.ps1 +++ b/functions/Get-DbaWsfcResource.ps1 @@ -41,7 +41,7 @@ function Get-DbaWsfcResource { Shows all resource values, including the ones not shown in the default view -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -61,5 +61,4 @@ function Get-DbaWsfcResource { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcResourceType.ps1 b/functions/Get-DbaWsfcResourceType.ps1 index d191d168d4..09099118fa 100644 --- a/functions/Get-DbaWsfcResourceType.ps1 +++ b/functions/Get-DbaWsfcResourceType.ps1 @@ -36,7 +36,7 @@ function Get-DbaWsfcResourceType { Gets resource type information from the failover cluster cluster01 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -53,5 +53,4 @@ function Get-DbaWsfcResourceType { $resource | Select-DefaultView -Property ClusterName, ClusterFqdn, Name, DisplayName, DllName, RequiredDependencyTypes } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcRole.ps1 b/functions/Get-DbaWsfcRole.ps1 index 96b9495682..b39e821e02 100644 --- a/functions/Get-DbaWsfcRole.ps1 +++ b/functions/Get-DbaWsfcRole.ps1 @@ -41,7 +41,7 @@ function Get-DbaWsfcRole { Shows all role values, including the ones not shown in the default view -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -59,5 +59,4 @@ function Get-DbaWsfcRole { $role | Select-DefaultView -Property ClusterName, ClusterFqdn, Name, OwnerNode, State } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaWsfcSharedVolume.ps1 b/functions/Get-DbaWsfcSharedVolume.ps1 index 36ab67ef93..02df80bd48 100644 --- a/functions/Get-DbaWsfcSharedVolume.ps1 +++ b/functions/Get-DbaWsfcSharedVolume.ps1 @@ -36,7 +36,7 @@ function Get-DbaWsfcSharedVolume { Gets shared volume (CSV) information from the failover cluster cluster01 -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -54,5 +54,4 @@ function Get-DbaWsfcSharedVolume { $volume | Add-Member -Force -NotePropertyName State -NotePropertyValue (Get-ResourceState $resource.State) -PassThru } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaXEObject.ps1 b/functions/Get-DbaXEObject.ps1 index 5e39b7e760..7046084ce8 100644 --- a/functions/Get-DbaXEObject.ps1 +++ b/functions/Get-DbaXEObject.ps1 @@ -46,7 +46,7 @@ function Get-DbaXEObject { Lists all the XE Objects of type Action and Event on the sql2017 SQL Server. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -108,6 +108,4 @@ function Get-DbaXEObject { } } } -} - - +} \ No newline at end of file diff --git a/functions/Get-DbaXESession.ps1 b/functions/Get-DbaXESession.ps1 index dec7ee3517..e640983767 100644 --- a/functions/Get-DbaXESession.ps1 +++ b/functions/Get-DbaXESession.ps1 @@ -47,7 +47,7 @@ function Get-DbaXESession { Returns a custom object with ComputerName, SqlInstance, Session, StartTime, Status and other properties, from multiple SQL instances. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -113,5 +113,4 @@ function Get-DbaXESession { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaXESessionTarget.ps1 b/functions/Get-DbaXESessionTarget.ps1 index b553965ebe..fc9960a9b6 100644 --- a/functions/Get-DbaXESessionTarget.ps1 +++ b/functions/Get-DbaXESessionTarget.ps1 @@ -53,7 +53,7 @@ function Get-DbaXESessionTarget { Return only the package0.event_file target for the system_health session on sql2016. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(ValueFromPipeline, ParameterSetName = "instance", Mandatory)] @@ -128,5 +128,4 @@ function Get-DbaXESessionTarget { } Get-Target -Sessions $InputObject -Session $Session -Target $Target } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaXESessionTargetFile.ps1 b/functions/Get-DbaXESessionTargetFile.ps1 index 28d84f32c5..38b8552786 100644 --- a/functions/Get-DbaXESessionTargetFile.ps1 +++ b/functions/Get-DbaXESessionTargetFile.ps1 @@ -50,7 +50,7 @@ function Get-DbaXESessionTargetFile { Returns the Target Files for the system_health session on sql2016. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(ValueFromPipeline, ParameterSetName = "instance", Mandatory)] @@ -88,5 +88,4 @@ function Get-DbaXESessionTargetFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaXESessionTemplate.ps1 b/functions/Get-DbaXESessionTemplate.ps1 index d18074cf20..952c0764c1 100644 --- a/functions/Get-DbaXESessionTemplate.ps1 +++ b/functions/Get-DbaXESessionTemplate.ps1 @@ -68,7 +68,7 @@ function Get-DbaXESessionTemplate { Returns more information about the template, including the full path/filename. -#> + #> [CmdletBinding()] param ( @@ -136,5 +136,4 @@ function Get-DbaXESessionTemplate { } } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaXESmartTarget.ps1 b/functions/Get-DbaXESmartTarget.ps1 index d5b0fbfdf2..5f77f13135 100644 --- a/functions/Get-DbaXESmartTarget.ps1 +++ b/functions/Get-DbaXESmartTarget.ps1 @@ -28,7 +28,7 @@ function Get-DbaXESmartTarget { Gets an XESmartTarget PowerShell Job created by Start-DbaXESmartTarget. -#> + #> [CmdletBinding()] param ( [switch]$EnableException @@ -40,5 +40,4 @@ function Get-DbaXESmartTarget { Stop-Function -Message "Failure" -ErrorRecord $_ } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbaXEStore.ps1 b/functions/Get-DbaXEStore.ps1 index 34aa50d3b8..bf36871d42 100644 --- a/functions/Get-DbaXEStore.ps1 +++ b/functions/Get-DbaXEStore.ps1 @@ -34,7 +34,7 @@ function Get-DbaXEStore { Returns an XEvent Store. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -62,5 +62,4 @@ function Get-DbaXEStore { Select-DefaultView -InputObject $store -Property ComputerName, InstanceName, SqlInstance, ServerName, Sessions, Packages, RunningSessionCount } } -} - +} \ No newline at end of file diff --git a/functions/Get-DbatoolsConfig.ps1 b/functions/Get-DbatoolsConfig.ps1 index a23e0445a6..a41c1b04bd 100644 --- a/functions/Get-DbatoolsConfig.ps1 +++ b/functions/Get-DbatoolsConfig.ps1 @@ -41,7 +41,7 @@ function Get-DbatoolsConfig { Retrieve all configuration elements from all modules, even hidden ones. -#> + #> [CmdletBinding(DefaultParameterSetName = "FullName")] param ( [Parameter(ParameterSetName = "FullName", Position = 0)] @@ -66,5 +66,4 @@ function Get-DbatoolsConfig { } } Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Get-DbaConfig -} - +} \ No newline at end of file diff --git a/functions/Get-DbatoolsConfigValue.ps1 b/functions/Get-DbatoolsConfigValue.ps1 index 281802eb2c..9bc032be3c 100644 --- a/functions/Get-DbatoolsConfigValue.ps1 +++ b/functions/Get-DbatoolsConfigValue.ps1 @@ -37,7 +37,7 @@ function Get-DbatoolsConfigValue { Returns the configured value for 'Default.CoffeeMilk'. If no such value is configured, it returns '0' instead. -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSPossibleIncorrectComparisonWithNull", "")] [CmdletBinding()] param ( @@ -59,5 +59,4 @@ function Get-DbatoolsConfigValue { } else { return $temp } -} - +} \ No newline at end of file diff --git a/functions/Get-DbatoolsLog.ps1 b/functions/Get-DbatoolsLog.ps1 index 3c70b87737..b59a818660 100644 --- a/functions/Get-DbatoolsLog.ps1 +++ b/functions/Get-DbatoolsLog.ps1 @@ -74,7 +74,7 @@ function Get-DbatoolsLog { Returns all log entries within the last 5 executions that contained the tag "fail" -#> + #> [CmdletBinding()] param ( [string] @@ -143,5 +143,4 @@ function Get-DbatoolsLog { end { } -} - +} \ No newline at end of file diff --git a/functions/Grant-DbaAgPermission.ps1 b/functions/Grant-DbaAgPermission.ps1 index ce7bdf57c1..46f6f267b0 100644 --- a/functions/Grant-DbaAgPermission.ps1 +++ b/functions/Grant-DbaAgPermission.ps1 @@ -84,7 +84,7 @@ function Grant-DbaAgPermission { PS C:\> Get-DbaLogin -SqlInstance sql2017a | Out-GridView -Passthru | Grant-DbaAgPermission -Type EndPoint Grants the selected logins Connect permissions on the DatabaseMirroring endpoint for sql2017a -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Import-DbaCmsRegServer.ps1 b/functions/Import-DbaCmsRegServer.ps1 index ff5def934e..3500d5ee0d 100644 --- a/functions/Import-DbaCmsRegServer.ps1 +++ b/functions/Import-DbaCmsRegServer.ps1 @@ -62,7 +62,7 @@ function Import-DbaCmsRegServer { Imports all registered servers from the hr\Seattle group on sql2008 to the Seattle group on sql2017 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory)] @@ -148,5 +148,4 @@ function Import-DbaCmsRegServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Import-DbaRegisteredServer } -} - +} \ No newline at end of file diff --git a/functions/Import-DbaCsvToSql.ps1 b/functions/Import-DbaCsvToSql.ps1 index 8cf15546a0..651d0d2d48 100644 --- a/functions/Import-DbaCsvToSql.ps1 +++ b/functions/Import-DbaCsvToSql.ps1 @@ -176,7 +176,7 @@ function Import-DbaCsvToSql { Imports the entire comma-delimited housing.csv located in the directory R:\To Import on FileServer using the administrative share to the SQL "markets" database on a SQL Server named sql001. - #> + #> [CmdletBinding(DefaultParameterSetName = "Default")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Parameters SQLCredential and SQLCredentialPath")] diff --git a/functions/Import-DbaPfDataCollectorSetTemplate.ps1 b/functions/Import-DbaPfDataCollectorSetTemplate.ps1 index ebaf9d74be..15d2daa388 100644 --- a/functions/Import-DbaPfDataCollectorSetTemplate.ps1 +++ b/functions/Import-DbaPfDataCollectorSetTemplate.ps1 @@ -124,7 +124,7 @@ function Import-DbaPfDataCollectorSetTemplate { If you'd like to remove counters for the default instance, use Remove-DbaPfDataCollectorCounter. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [parameter(ValueFromPipeline)] @@ -301,5 +301,4 @@ function Import-DbaPfDataCollectorSetTemplate { } } } -} - +} \ No newline at end of file diff --git a/functions/Import-DbaSpConfigure.ps1 b/functions/Import-DbaSpConfigure.ps1 index 5eaf21e9b0..340a370ae3 100644 --- a/functions/Import-DbaSpConfigure.ps1 +++ b/functions/Import-DbaSpConfigure.ps1 @@ -81,7 +81,7 @@ function Import-DbaSpConfigure { Imports the sp_configure settings from the file .\spconfig.sql and sets them on the sqlserver server using the SQL credential stored in the variable $SqlCredential -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [Parameter(ParameterSetName = "ServerCopy")] @@ -233,5 +233,4 @@ function Import-DbaSpConfigure { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Import-SqlSpConfigure } -} - +} \ No newline at end of file diff --git a/functions/Import-DbaXESessionTemplate.ps1 b/functions/Import-DbaXESessionTemplate.ps1 index f65c939a35..e8f18f48e8 100644 --- a/functions/Import-DbaXESessionTemplate.ps1 +++ b/functions/Import-DbaXESessionTemplate.ps1 @@ -71,7 +71,7 @@ function Import-DbaXESessionTemplate { Allows you to select a Session template then import to an instance named sql2017. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -204,5 +204,4 @@ function Import-DbaXESessionTemplate { } } } -} - +} \ No newline at end of file diff --git a/functions/Install-DbaFirstResponderKit.ps1 b/functions/Install-DbaFirstResponderKit.ps1 index 86e1c10aab..94d7cbfdd4 100644 --- a/functions/Install-DbaFirstResponderKit.ps1 +++ b/functions/Install-DbaFirstResponderKit.ps1 @@ -84,7 +84,7 @@ function Install-DbaFirstResponderKit { Installs the dev branch version of the FRK in the master database on sql2016 instance. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -227,5 +227,4 @@ function Install-DbaFirstResponderKit { Write-Message -Level Verbose -Message "Finished installing/updating the First Responder Kit stored procedures in $database on $instance." } } -} - +} \ No newline at end of file diff --git a/functions/Install-DbaMaintenanceSolution.ps1 b/functions/Install-DbaMaintenanceSolution.ps1 index 2e3dfccd50..57a0d8d813 100644 --- a/functions/Install-DbaMaintenanceSolution.ps1 +++ b/functions/Install-DbaMaintenanceSolution.ps1 @@ -102,7 +102,7 @@ function Install-DbaMaintenanceSolution { - 'DatabaseIntegrityCheck - USER_DATABASES' - 'DatabaseBackup - USER_DATABASES - DIFF' -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -379,4 +379,4 @@ function Install-DbaMaintenanceSolution { Write-Message -Level Output -Message "Installation complete." } -} +} \ No newline at end of file diff --git a/functions/Install-DbaSqlWatch.ps1 b/functions/Install-DbaSqlWatch.ps1 index 2a208b7173..fe77b04553 100644 --- a/functions/Install-DbaSqlWatch.ps1 +++ b/functions/Install-DbaSqlWatch.ps1 @@ -70,7 +70,7 @@ function Install-DbaSqlWatch { $servers | Install-DbaSqlWatch Logs into sql2016\standardrtm, sql2016\sqlexpress and sql2014 with Windows authentication and then installs SqlWatch in the master database. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [Parameter(Mandatory, ValueFromPipeline)] diff --git a/functions/Install-DbaWatchUpdate.ps1 b/functions/Install-DbaWatchUpdate.ps1 index 6bbd6ef649..5c46a4c474 100644 --- a/functions/Install-DbaWatchUpdate.ps1 +++ b/functions/Install-DbaWatchUpdate.ps1 @@ -41,7 +41,7 @@ function Install-DbaWatchUpdate { Will create the scheduled task as the name MyScheduledTask -#> + #> [cmdletbinding(SupportsShouldProcess)] param( [string]$TaskName = 'dbatools version check', @@ -103,5 +103,4 @@ function Install-DbaWatchUpdate { Write-Message -Level Output -Message "Scheduled Task $TaskName is already installed on this machine." } } -} - +} \ No newline at end of file diff --git a/functions/Install-DbaWhoIsActive.ps1 b/functions/Install-DbaWhoIsActive.ps1 index 325c049a35..0ad0e4d1aa 100644 --- a/functions/Install-DbaWhoIsActive.ps1 +++ b/functions/Install-DbaWhoIsActive.ps1 @@ -67,7 +67,7 @@ function Install-DbaWhoIsActive { PS C:\> Install-DbaWhoIsActive -SqlInstance $instances -Database master Installs sp_WhoisActive to all servers within CMS -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( @@ -248,5 +248,4 @@ function Install-DbaWhoIsActive { } Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Install-SqlWhoIsActive } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaAdvancedRestore.ps1 b/functions/Invoke-DbaAdvancedRestore.ps1 index 418861a321..96b2e470e5 100644 --- a/functions/Invoke-DbaAdvancedRestore.ps1 +++ b/functions/Invoke-DbaAdvancedRestore.ps1 @@ -101,7 +101,7 @@ function Invoke-DbaAdvancedRestore { First generates just the T-SQL restore scripts so they can be sanity checked, and then if they are good perform the full restore. By reusing the BackupHistory object there is no need to rescan all the backup files again - #> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "AzureCredential", Justification = "For Parameter AzureCredential")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] diff --git a/functions/Invoke-DbaAgFailover.ps1 b/functions/Invoke-DbaAgFailover.ps1 index 8b1dc3d893..d6521a9945 100644 --- a/functions/Invoke-DbaAgFailover.ps1 +++ b/functions/Invoke-DbaAgFailover.ps1 @@ -57,7 +57,7 @@ function Invoke-DbaAgFailover { PS C:\> Invoke-DbaAgFailover -SqlInstance sql2017 -AvailabilityGroup SharePoint -Force Forcefully (with potential data loss) fails over the SharePoint AG on sql2017. Prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [parameter(Mandatory)] @@ -96,5 +96,4 @@ function Invoke-DbaAgFailover { } } } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaBalanceDataFiles.ps1 b/functions/Invoke-DbaBalanceDataFiles.ps1 index dc2ac42d56..af486cddb2 100644 --- a/functions/Invoke-DbaBalanceDataFiles.ps1 +++ b/functions/Invoke-DbaBalanceDataFiles.ps1 @@ -82,7 +82,7 @@ function Invoke-DbaBalanceDataFiles { This command will consider the fact that there might be a SQL Server edition that does not support online rebuilds of indexes. By supplying this parameter you give permission to do the rebuilds offline if the edition does not support it. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Singular Noun doesn't make sense")] param ( @@ -355,4 +355,4 @@ function Invoke-DbaBalanceDataFiles { } # end process } -} +} \ No newline at end of file diff --git a/functions/Invoke-DbaCycleErrorLog.ps1 b/functions/Invoke-DbaCycleErrorLog.ps1 index 9d12b16d83..daf56cdfee 100644 --- a/functions/Invoke-DbaCycleErrorLog.ps1 +++ b/functions/Invoke-DbaCycleErrorLog.ps1 @@ -53,7 +53,7 @@ function Invoke-DbaCycleErrorLog { Cycles the current error log for both SQL Server instance and SQL Server Agent on SQL Server instance sql2016 -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -129,5 +129,4 @@ function Invoke-DbaCycleErrorLog { } } } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbClone.ps1 b/functions/Invoke-DbaDbClone.ps1 index e76cb9f456..5a13973915 100644 --- a/functions/Invoke-DbaDbClone.ps1 +++ b/functions/Invoke-DbaDbClone.ps1 @@ -61,7 +61,7 @@ function Invoke-DbaDbClone { Updates the statistics of mydb then clones to myclone and myclone2 -#> + #> [CmdletBinding()] param ( [parameter(Position = 0)] @@ -225,5 +225,4 @@ function Invoke-DbaDbClone { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Invoke-DbaDatabaseClone } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbDecryptObject.ps1 b/functions/Invoke-DbaDbDecryptObject.ps1 index 8d4d60af9e..020bcf26b1 100644 --- a/functions/Invoke-DbaDbDecryptObject.ps1 +++ b/functions/Invoke-DbaDbDecryptObject.ps1 @@ -81,7 +81,7 @@ function Invoke-DbaDbDecryptObject { Decrypt objects "Function1" and "Function2" and output the data to the user using a pipeline for the instance. -#> + #> [CmdletBinding()] param( [parameter(Mandatory, ValueFromPipeline)] @@ -347,5 +347,4 @@ function Invoke-DbaDbDecryptObject { Write-Message -Message "Finished decrypting data" -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbLogShipRecovery.ps1 b/functions/Invoke-DbaDbLogShipRecovery.ps1 index a1fd25a8ac..e7ac34fb56 100644 --- a/functions/Invoke-DbaDbLogShipRecovery.ps1 +++ b/functions/Invoke-DbaDbLogShipRecovery.ps1 @@ -89,7 +89,7 @@ function Invoke-DbaDbLogShipRecovery { Shows what would happen if the command were executed. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( @@ -328,5 +328,4 @@ function Invoke-DbaDbLogShipRecovery { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Invoke-DbaLogShippingRecovery } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbLogShipping.ps1 b/functions/Invoke-DbaDbLogShipping.ps1 index 21c9dcd99c..14b3f7c3d3 100644 --- a/functions/Invoke-DbaDbLogShipping.ps1 +++ b/functions/Invoke-DbaDbLogShipping.ps1 @@ -384,7 +384,7 @@ function Invoke-DbaDbLogShipping { Sets up log shipping with all defaults except that a backup file is generated. The script will show a message that the copy destination has not been supplied and asks if you want to use the default which would be the backup directory of the secondary server with the folder "logshipping" i.e. "D:\SQLBackup\Logshiping". -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param( @@ -1827,5 +1827,4 @@ function Invoke-DbaDbLogShipping { Write-Message -Message "Finished setting up log shipping." -Level Verbose Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Invoke-DbaLogShipping } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbMirrorFailover.ps1 b/functions/Invoke-DbaDbMirrorFailover.ps1 index ced4e239bd..3ff8b8120d 100644 --- a/functions/Invoke-DbaDbMirrorFailover.ps1 +++ b/functions/Invoke-DbaDbMirrorFailover.ps1 @@ -57,7 +57,7 @@ function Invoke-DbaDbMirrorFailover { Forces the failover of the pubs database on sql2016 and allows data loss. Does not prompt for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter]$SqlInstance, @@ -92,5 +92,4 @@ function Invoke-DbaDbMirrorFailover { } } } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbMirroring.ps1 b/functions/Invoke-DbaDbMirroring.ps1 index 8fad5875c1..f4bad6a8e2 100644 --- a/functions/Invoke-DbaDbMirroring.ps1 +++ b/functions/Invoke-DbaDbMirroring.ps1 @@ -133,7 +133,7 @@ function Invoke-DbaDbMirroring { Mirrors pubs on sql2017a to sql2017b and uses the last full and logs from sql2017a to seed. Doesn't prompt for confirmation. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter]$Primary, diff --git a/functions/Invoke-DbaDbShrink.ps1 b/functions/Invoke-DbaDbShrink.ps1 index 21b1723136..f435f294c2 100644 --- a/functions/Invoke-DbaDbShrink.ps1 +++ b/functions/Invoke-DbaDbShrink.ps1 @@ -118,7 +118,7 @@ function Invoke-DbaDbShrink { Shrinks all databases on SQL2012 (not ideal for production) -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -324,5 +324,4 @@ function Invoke-DbaDbShrink { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Invoke-DbaDatabaseShrink } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDbUpgrade.ps1 b/functions/Invoke-DbaDbUpgrade.ps1 index c4d789f2cd..8287fad7eb 100644 --- a/functions/Invoke-DbaDbUpgrade.ps1 +++ b/functions/Invoke-DbaDbUpgrade.ps1 @@ -90,7 +90,7 @@ function Invoke-DbaDbUpgrade { Get only specific databases using GridView and pass those to Invoke-DbaDbUpgrade -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Position = 0)] @@ -277,5 +277,4 @@ function Invoke-DbaDbUpgrade { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Invoke-DbaDatabaseUpgrade } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaDiagnosticQuery.ps1 b/functions/Invoke-DbaDiagnosticQuery.ps1 index e4eeedde08..eb96c6d62e 100644 --- a/functions/Invoke-DbaDiagnosticQuery.ps1 +++ b/functions/Invoke-DbaDiagnosticQuery.ps1 @@ -127,7 +127,7 @@ function Invoke-DbaDiagnosticQuery { Run diagnostic queries targeted at specific database, and only run database level queries against this database. -#> + #> [CmdletBinding(SupportsShouldProcess)] [outputtype([pscustomobject[]])] @@ -464,5 +464,4 @@ function Invoke-DbaDiagnosticQuery { end { Write-Progress -Id $ProgressId -Activity 'Invoke-DbaDiagnosticQuery' -Completed } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaPfRelog.ps1 b/functions/Invoke-DbaPfRelog.ps1 index 010fab1bf2..c02b793482 100644 --- a/functions/Invoke-DbaPfRelog.ps1 +++ b/functions/Invoke-DbaPfRelog.ps1 @@ -143,7 +143,7 @@ function Invoke-DbaPfRelog { Relogs all the log files from the DataCollector01 on the local computer and allows overwrite. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipelineByPropertyName)] @@ -420,5 +420,4 @@ function Invoke-DbaPfRelog { foreach ($file in $allpaths) { Invoke-Command -ScriptBlock $scriptblock -ArgumentList $file } } } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaQuery.ps1 b/functions/Invoke-DbaQuery.ps1 index e439a2f0b9..349a5b493e 100644 --- a/functions/Invoke-DbaQuery.ps1 +++ b/functions/Invoke-DbaQuery.ps1 @@ -86,7 +86,7 @@ function Invoke-DbaQuery { Runs the sql commands stored in rebuild.sql against all accessible databases of the instances "server1", "server1\nordwind" and "server2" -#> + #> [CmdletBinding(DefaultParameterSetName = "Query")] param ( [parameter(ValueFromPipeline)] @@ -319,5 +319,4 @@ function Invoke-DbaQuery { Test-DbaDeprecation -DeprecatedOn '1.0.0' -Alias Invoke-DbaCmd Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Invoke-DbaSqlQuery } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaWhoisActive.ps1 b/functions/Invoke-DbaWhoisActive.ps1 index 5e09cd6c06..e7f937cf47 100644 --- a/functions/Invoke-DbaWhoisActive.ps1 +++ b/functions/Invoke-DbaWhoisActive.ps1 @@ -194,7 +194,7 @@ function Invoke-DbaWhoIsActive { Similar to running sp_WhoIsActive @get_outer_command = 1, @find_block_leaders = 1 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -341,5 +341,4 @@ function Invoke-DbaWhoIsActive { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Show-SqlWhoIsActive -CustomMessage "Show-SqlWhoIsActive is no longer supported. Use Invoke-DbaWhoIsActive | Out-GridView for similar results." } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbaXEReplay.ps1 b/functions/Invoke-DbaXEReplay.ps1 index 1b1d04e1cf..c70c92ac1a 100644 --- a/functions/Invoke-DbaXEReplay.ps1 +++ b/functions/Invoke-DbaXEReplay.ps1 @@ -61,7 +61,7 @@ function Invoke-DbaXeReplay { Runs all batch_text for sql_batch_completed against tempdb on sql2017 and sql2016. -#> + #> [Cmdletbinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -143,5 +143,4 @@ function Invoke-DbaXeReplay { } Remove-Item -Path $filename -ErrorAction Ignore } -} - +} \ No newline at end of file diff --git a/functions/Invoke-DbatoolsFormatter.ps1 b/functions/Invoke-DbatoolsFormatter.ps1 index c20b8161b6..cf3b76eec3 100644 --- a/functions/Invoke-DbatoolsFormatter.ps1 +++ b/functions/Invoke-DbatoolsFormatter.ps1 @@ -30,7 +30,7 @@ function Invoke-DbatoolsFormatter { Reformats C:\dbatools\functions\Get-DbaDatabase.ps1 to dbatools' standards -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] diff --git a/functions/Invoke-DbatoolsRenameHelper.ps1 b/functions/Invoke-DbatoolsRenameHelper.ps1 index 019fba500f..41fa99dc65 100644 --- a/functions/Invoke-DbatoolsRenameHelper.ps1 +++ b/functions/Invoke-DbatoolsRenameHelper.ps1 @@ -56,7 +56,7 @@ function Invoke-DbatoolsRenameHelper { Shows what would happen if the command would run. If the command would run and there were matches, the resulting changes would be written to disk as Ascii encoded. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -82,5 +82,4 @@ function Invoke-DbatoolsRenameHelper { } } } -} - +} \ No newline at end of file diff --git a/functions/Invoke-SqlCmd2.ps1 b/functions/Invoke-SqlCmd2.ps1 index 4560f94c74..61b3d7c0a0 100644 --- a/functions/Invoke-SqlCmd2.ps1 +++ b/functions/Invoke-SqlCmd2.ps1 @@ -290,7 +290,7 @@ function Invoke-Sqlcmd2 { [ValidateNotNullOrEmpty()] [System.Data.SqlClient.SQLConnection]$SQLConnection ) - + process { Write-Message -Level Warning -Message "This command is no longer supported. Please use Invoke-DbaQuery instead." } diff --git a/functions/Join-DbaAvailabilityGroup.ps1 b/functions/Join-DbaAvailabilityGroup.ps1 index 77dcd3dda7..de1c24db6f 100644 --- a/functions/Join-DbaAvailabilityGroup.ps1 +++ b/functions/Join-DbaAvailabilityGroup.ps1 @@ -64,7 +64,7 @@ function Join-DbaAvailabilityGroup { PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql01 -AvailabilityGroup SharePoint | Join-DbaAvailabilityGroup -SqlInstance sql02 -Confirm Prompts for confirmation then joins sql02 to the SharePoint availability group on sql01. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -115,5 +115,4 @@ function Join-DbaAvailabilityGroup { } } } -} - +} \ No newline at end of file diff --git a/functions/Measure-DbaBackupThroughput.ps1 b/functions/Measure-DbaBackupThroughput.ps1 index d30474684f..3b29047e84 100644 --- a/functions/Measure-DbaBackupThroughput.ps1 +++ b/functions/Measure-DbaBackupThroughput.ps1 @@ -88,7 +88,7 @@ function Measure-DbaBackupThroughput { Gets backup calculations, limited to the last year and only the bigoldb database -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -178,5 +178,4 @@ function Measure-DbaBackupThroughput { } } } -} - +} \ No newline at end of file diff --git a/functions/Measure-DbaDiskSpaceRequirement.ps1 b/functions/Measure-DbaDiskSpaceRequirement.ps1 index 73836675ce..2c8c1a5dff 100644 --- a/functions/Measure-DbaDiskSpaceRequirement.ps1 +++ b/functions/Measure-DbaDiskSpaceRequirement.ps1 @@ -69,7 +69,7 @@ function Measure-DbaDiskSpaceRequirement { Using a SQL table. We are DBA after all! -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param( @@ -293,5 +293,4 @@ function Measure-DbaDiskSpaceRequirement { } $DestinationDatabase = $null } -} - +} \ No newline at end of file diff --git a/functions/Measure-DbatoolsImport.ps1 b/functions/Measure-DbatoolsImport.ps1 index 8b6fd0766e..c64044a3fc 100644 --- a/functions/Measure-DbatoolsImport.ps1 +++ b/functions/Measure-DbatoolsImport.ps1 @@ -27,7 +27,6 @@ function Measure-DbatoolsImport { Displays the import load times of the dbatools PowerShell module -#> + #> [Sqlcollaborative.Dbatools.dbaSystem.DebugHost]::ImportTime -} - +} \ No newline at end of file diff --git a/functions/Mount-DbaDatabase.ps1 b/functions/Mount-DbaDatabase.ps1 index 20eeda93d9..b74b3d452a 100644 --- a/functions/Mount-DbaDatabase.ps1 +++ b/functions/Mount-DbaDatabase.ps1 @@ -65,7 +65,7 @@ function Mount-DbaDatabase { Shows what would happen if the command were executed (without actually performing the command) -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -151,5 +151,4 @@ function Mount-DbaDatabase { } } } -} - +} \ No newline at end of file diff --git a/functions/Move-DbaCmsRegServer.ps1 b/functions/Move-DbaCmsRegServer.ps1 index a6635f20f5..36c06c6841 100644 --- a/functions/Move-DbaCmsRegServer.ps1 +++ b/functions/Move-DbaCmsRegServer.ps1 @@ -59,7 +59,7 @@ function Move-DbaCmsRegServer { Moves the registered server 'Web SQL Cluster' on sql2017 to the Web group, also on sql2017 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( @@ -120,5 +120,4 @@ function Move-DbaCmsRegServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Move-DbaRegisteredServer } -} - +} \ No newline at end of file diff --git a/functions/Move-DbaCmsRegServerGroup.ps1 b/functions/Move-DbaCmsRegServerGroup.ps1 index c350aa4f1b..310744330f 100644 --- a/functions/Move-DbaCmsRegServerGroup.ps1 +++ b/functions/Move-DbaCmsRegServerGroup.ps1 @@ -56,7 +56,7 @@ function Move-DbaCmsRegServerGroup { Moves the Development group within HR to the Web group -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -120,5 +120,4 @@ function Move-DbaCmsRegServerGroup { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Move-DbaRegisteredServerGroup } -} - +} \ No newline at end of file diff --git a/functions/New-DbaAgentJob.ps1 b/functions/New-DbaAgentJob.ps1 index 4ba02087c6..b4b35ed516 100644 --- a/functions/New-DbaAgentJob.ps1 +++ b/functions/New-DbaAgentJob.ps1 @@ -132,7 +132,7 @@ function New-DbaAgentJob { Creates a job with the name "Job One" on multiple servers using the pipe line -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( @@ -414,6 +414,4 @@ function New-DbaAgentJob { Write-Message -Message "Finished creating job(s)." -Level Verbose } -} - - +} \ No newline at end of file diff --git a/functions/New-DbaAgentJobCategory.ps1 b/functions/New-DbaAgentJobCategory.ps1 index 32b803ca1d..15e5f70866 100644 --- a/functions/New-DbaAgentJobCategory.ps1 +++ b/functions/New-DbaAgentJobCategory.ps1 @@ -55,7 +55,7 @@ function New-DbaAgentJobCategory { Creates a new job category with the name 'Category 2' and assign the category type for a multi server job. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( @@ -126,5 +126,4 @@ function New-DbaAgentJobCategory { Write-Message -Message "Finished creating job category." -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/New-DbaAgentJobStep.ps1 b/functions/New-DbaAgentJobStep.ps1 index e78a66dbec..a93cdb4b42 100644 --- a/functions/New-DbaAgentJobStep.ps1 +++ b/functions/New-DbaAgentJobStep.ps1 @@ -130,7 +130,7 @@ function New-DbaAgentJobStep { Create a step in "Job1" with the name Step1 where the database will the "msdb" for multiple servers using pipeline -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( @@ -367,6 +367,4 @@ function New-DbaAgentJobStep { if (Test-FunctionInterrupt) { return } Write-Message -Message "Finished creating job step(s)" -Level Verbose } -} - - +} \ No newline at end of file diff --git a/functions/New-DbaAgentProxy.ps1 b/functions/New-DbaAgentProxy.ps1 index 0415bbd8dd..a5c6883588 100644 --- a/functions/New-DbaAgentProxy.ps1 +++ b/functions/New-DbaAgentProxy.ps1 @@ -93,7 +93,7 @@ function New-DbaAgentProxy { By default, only sysadmins have access to create job steps with proxies. This will allow 3 additional principals access: The proxy is then added to the CmdExec and PowerShell subsystems -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Parameter ProxyCredential")] param ( @@ -220,5 +220,4 @@ function New-DbaAgentProxy { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaAgentSchedule.ps1 b/functions/New-DbaAgentSchedule.ps1 index 9d42fed328..afeefa8d4b 100644 --- a/functions/New-DbaAgentSchedule.ps1 +++ b/functions/New-DbaAgentSchedule.ps1 @@ -121,7 +121,7 @@ function New-DbaAgentSchedule { Create a schedule with a monhtly frequency occuring every 10th of the month. It assumes default values for the start date, start time, end date and end time due to -Force. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -625,5 +625,4 @@ function New-DbaAgentSchedule { if (Test-FunctionInterrupt) { return } Write-Message -Message "Finished creating job schedule(s)." -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/New-DbaAvailabilityGroup.ps1 b/functions/New-DbaAvailabilityGroup.ps1 index 25562a83b2..446a0a1362 100644 --- a/functions/New-DbaAvailabilityGroup.ps1 +++ b/functions/New-DbaAvailabilityGroup.ps1 @@ -200,7 +200,7 @@ function New-DbaAvailabilityGroup { PS C:\> New-DbaAvailabilityGroup @params This exact command was used to create an availability group on docker! -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [parameter(ValueFromPipeline)] diff --git a/functions/New-DbaClientAlias.ps1 b/functions/New-DbaClientAlias.ps1 index 5388fad9b6..3651ba0728 100644 --- a/functions/New-DbaClientAlias.ps1 +++ b/functions/New-DbaClientAlias.ps1 @@ -59,7 +59,7 @@ function New-DbaClientAlias { Creates a new NamedPipes alias on the local workstation called sp, which points sqlcluster\sharepoint -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [DbaInstanceParameter[]]$ComputerName = $env:COMPUTERNAME, @@ -144,5 +144,4 @@ function New-DbaClientAlias { Get-DbaClientAlias -ComputerName $computer -Credential $Credential | Where-Object AliasName -eq $Alias } -} - +} \ No newline at end of file diff --git a/functions/New-DbaCmConnection.ps1 b/functions/New-DbaCmConnection.ps1 index a3e6316843..90a437c803 100644 --- a/functions/New-DbaCmConnection.ps1 +++ b/functions/New-DbaCmConnection.ps1 @@ -103,7 +103,7 @@ function New-DbaCmConnection { Essentially, this configures all connections to those computers to prefer failure with the specified credentials over using alternative credentials. -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Credential')] param ( [Parameter(ValueFromPipeline)] @@ -177,5 +177,4 @@ function New-DbaCmConnection { end { Write-Message -Level InternalComment -Message "Stopping execution" } -} - +} \ No newline at end of file diff --git a/functions/New-DbaComputerCertificate.ps1 b/functions/New-DbaComputerCertificate.ps1 index 447cfdad02..c52726841d 100644 --- a/functions/New-DbaComputerCertificate.ps1 +++ b/functions/New-DbaComputerCertificate.ps1 @@ -107,7 +107,7 @@ function New-DbaComputerCertificate { Creates a self-signed certificate -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -383,5 +383,4 @@ function New-DbaComputerCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaConnectionString.ps1 b/functions/New-DbaConnectionString.ps1 index 38f0f826c4..ba8ffc6396 100644 --- a/functions/New-DbaConnectionString.ps1 +++ b/functions/New-DbaConnectionString.ps1 @@ -159,7 +159,7 @@ function New-DbaConnectionString { Creates a connection string with ReadOnly ApplicationIntent. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -267,5 +267,4 @@ function New-DbaConnectionString { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias New-DbaSqlConnectionString } -} - +} \ No newline at end of file diff --git a/functions/New-DbaConnectionStringBuilder.ps1 b/functions/New-DbaConnectionStringBuilder.ps1 index 593d30e692..80aa98192e 100644 --- a/functions/New-DbaConnectionStringBuilder.ps1 +++ b/functions/New-DbaConnectionStringBuilder.ps1 @@ -64,7 +64,7 @@ function New-DbaConnectionStringBuilder { Returns a connection string builder that can be used to connect to the local sql server instance on the default port. -#> + #> [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "")] @@ -132,5 +132,4 @@ function New-DbaConnectionStringBuilder { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias New-DbaSqlConnectionStringBuilder } -} - +} \ No newline at end of file diff --git a/functions/New-DbaCredential.ps1 b/functions/New-DbaCredential.ps1 index 2b08f47637..5cb4f8456d 100644 --- a/functions/New-DbaCredential.ps1 +++ b/functions/New-DbaCredential.ps1 @@ -73,7 +73,7 @@ function New-DbaCredential { Name has to be the full URL for the blob store container that will be the backup target. Password needs to be passed the Shared Access Token (SAS Key). -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] #, ConfirmImpact = "High" param ( [parameter(Mandatory, ValueFromPipeline)] @@ -144,5 +144,4 @@ function New-DbaCredential { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaDacOption.ps1 b/functions/New-DbaDacOption.ps1 index 384f5cc4f8..c6417d617d 100644 --- a/functions/New-DbaDacOption.ps1 +++ b/functions/New-DbaDacOption.ps1 @@ -57,7 +57,7 @@ function New-DbaDacOption { Uses DacOption object to set Deployment Options and publish the db.dacpac dacpac file as DB1 on sql2016 -#> + #> [CmdletBinding(SupportsShouldProcess)] Param ( [ValidateSet('Dacpac', 'Bacpac')] @@ -110,6 +110,4 @@ function New-DbaDacOption { } } } -} - - +} \ No newline at end of file diff --git a/functions/New-DbaDacProfile.ps1 b/functions/New-DbaDacProfile.ps1 index 7ae75def66..86bc15d60a 100644 --- a/functions/New-DbaDacProfile.ps1 +++ b/functions/New-DbaDacProfile.ps1 @@ -64,7 +64,7 @@ function New-DbaDacProfile { In this example, no connections are made, and a Publish Profile XML would be created at C:\temp\localdb-MSSQLLocalDB-WorldWideImporters-publish.xml -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(ValueFromPipeline)] @@ -172,5 +172,4 @@ function New-DbaDacProfile { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias New-DbaPublishProfile } -} - +} \ No newline at end of file diff --git a/functions/New-DbaDatabase.ps1 b/functions/New-DbaDatabase.ps1 index b65e9bf84e..f5ff37fbde 100644 --- a/functions/New-DbaDatabase.ps1 +++ b/functions/New-DbaDatabase.ps1 @@ -107,7 +107,7 @@ function New-DbaDatabase { Creates a secondary group with 2 files in the Secondary filegroup. - #> + #> [Cmdletbinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( diff --git a/functions/New-DbaDbCertificate.ps1 b/functions/New-DbaDbCertificate.ps1 index 3441651ed4..1443c6e595 100644 --- a/functions/New-DbaDbCertificate.ps1 +++ b/functions/New-DbaDbCertificate.ps1 @@ -66,7 +66,7 @@ function New-DbaDbCertificate { Suppresses all prompts to install but prompts to securely enter your password and creates a certificate in the 'db1' database -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -139,5 +139,4 @@ function New-DbaDbCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaDbMasterKey.ps1 b/functions/New-DbaDbMasterKey.ps1 index c6087afb07..ea7bfaf047 100644 --- a/functions/New-DbaDbMasterKey.ps1 +++ b/functions/New-DbaDbMasterKey.ps1 @@ -60,7 +60,7 @@ function New-DbaDbMasterKey { Suppresses all prompts to install but prompts in th console to securely enter your password and creates a master key in the 'db1' database -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -111,5 +111,4 @@ function New-DbaDbMasterKey { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias New-DbaDatabaseMasterKey } -} - +} \ No newline at end of file diff --git a/functions/New-DbaDbSnapshot.ps1 b/functions/New-DbaDbSnapshot.ps1 index 2d59e239aa..789d08b064 100644 --- a/functions/New-DbaDbSnapshot.ps1 +++ b/functions/New-DbaDbSnapshot.ps1 @@ -90,7 +90,7 @@ function New-DbaDbSnapshot { Creates a snapshot for the database df on sql2016 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( @@ -329,5 +329,4 @@ function New-DbaDbSnapshot { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias New-DbaDatabaseSnapshot } -} - +} \ No newline at end of file diff --git a/functions/New-DbaDbUser.ps1 b/functions/New-DbaDbUser.ps1 index 9e052417b2..33cccebb54 100644 --- a/functions/New-DbaDbUser.ps1 +++ b/functions/New-DbaDbUser.ps1 @@ -78,7 +78,7 @@ function New-DbaDbUser { Copies users from sqlserver1.DB1 to sqlserver2.DB1. Does not copy permissions! -#> + #> [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = "NoLogin")] param( [parameter(Mandatory, Position = 1)] diff --git a/functions/New-DbaDirectory.ps1 b/functions/New-DbaDirectory.ps1 index 81d0651a47..71ffc3848f 100644 --- a/functions/New-DbaDirectory.ps1 +++ b/functions/New-DbaDirectory.ps1 @@ -52,7 +52,7 @@ function New-DbaDirectory { If the SQL Server instance sqlcluster can create the path L:\MSAS12.MSSQLSERVER\OLAP it will do and return $true, if not it will return $false. Uses a SqlCredential to connect -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Parameter(Mandatory)] @@ -99,5 +99,4 @@ function New-DbaDirectory { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaEndpoint.ps1 b/functions/New-DbaEndpoint.ps1 index a90ec7e89d..081f445022 100644 --- a/functions/New-DbaEndpoint.ps1 +++ b/functions/New-DbaEndpoint.ps1 @@ -84,7 +84,7 @@ function New-DbaEndpoint { Returns all Endpoint(s) for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] diff --git a/functions/New-DbaLogin.ps1 b/functions/New-DbaLogin.ps1 index e07460336c..a5e882e52b 100644 --- a/functions/New-DbaLogin.ps1 +++ b/functions/New-DbaLogin.ps1 @@ -108,7 +108,7 @@ function New-DbaLogin { Creates a new Windows Authentication backed login on sql1. The login will be part of the public server role. -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "Password", ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Parameters Password and MapToCredential")] param ( @@ -454,5 +454,4 @@ function New-DbaLogin { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaScriptingOption.ps1 b/functions/New-DbaScriptingOption.ps1 index 72d2ea9ef5..f0516a9888 100644 --- a/functions/New-DbaScriptingOption.ps1 +++ b/functions/New-DbaScriptingOption.ps1 @@ -27,9 +27,8 @@ function New-DbaScriptingOption { Exports Agent Jobs with the Scripting Options ScriptDrops set to $false and WithDependencies set to true -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] param() New-Object Microsoft.SqlServer.Management.Smo.ScriptingOptions -} - +} \ No newline at end of file diff --git a/functions/New-DbaServiceMasterKey.ps1 b/functions/New-DbaServiceMasterKey.ps1 index 5068c2c0ba..985703d8a9 100644 --- a/functions/New-DbaServiceMasterKey.ps1 +++ b/functions/New-DbaServiceMasterKey.ps1 @@ -43,7 +43,7 @@ function New-DbaServiceMasterKey { You will be prompted to securely enter your Service Key password, then a master key will be created in the master database on server1 if it does not exist. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -61,5 +61,4 @@ function New-DbaServiceMasterKey { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaSsisCatalog.ps1 b/functions/New-DbaSsisCatalog.ps1 index eb7303bedc..0f2892992d 100644 --- a/functions/New-DbaSsisCatalog.ps1 +++ b/functions/New-DbaSsisCatalog.ps1 @@ -52,7 +52,7 @@ function New-DbaSsisCatalog { Creates the SSIS Catalog on server DEV01 with the specified password. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -119,5 +119,4 @@ function New-DbaSsisCatalog { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaXESession.ps1 b/functions/New-DbaXESession.ps1 index 836521a313..072bfa692b 100644 --- a/functions/New-DbaXESession.ps1 +++ b/functions/New-DbaXESession.ps1 @@ -48,7 +48,7 @@ function New-DbaXESession { Returns a new XE Session object from sql2017 then adds an event, an action then creates it. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -76,5 +76,4 @@ function New-DbaXESession { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaXESmartCsvWriter.ps1 b/functions/New-DbaXESmartCsvWriter.ps1 index b939c18766..b9c6ec807d 100644 --- a/functions/New-DbaXESmartCsvWriter.ps1 +++ b/functions/New-DbaXESmartCsvWriter.ps1 @@ -57,7 +57,7 @@ function New-DbaXESmartCsvWriter { Writes Extended Events to the file "C:\temp\workload.csv". -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory)] @@ -100,5 +100,4 @@ function New-DbaXESmartCsvWriter { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaXESmartEmail.ps1 b/functions/New-DbaXESmartEmail.ps1 index 2c1883880f..1b3c8456b8 100644 --- a/functions/New-DbaXESmartEmail.ps1 +++ b/functions/New-DbaXESmartEmail.ps1 @@ -88,7 +88,7 @@ function New-DbaXESmartEmail { Sends an email each time a querytracker event is captured. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory)] @@ -153,5 +153,4 @@ function New-DbaXESmartEmail { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaXESmartQueryExec.ps1 b/functions/New-DbaXESmartQueryExec.ps1 index e98b61ec1d..347879ecd8 100644 --- a/functions/New-DbaXESmartQueryExec.ps1 +++ b/functions/New-DbaXESmartQueryExec.ps1 @@ -55,7 +55,7 @@ function New-DbaXESmartQueryExec { Executes a T-SQL command against dbadb on sql2017 whenever a deadlock event is recorded. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -110,5 +110,4 @@ function New-DbaXESmartQueryExec { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaXESmartReplay.ps1 b/functions/New-DbaXESmartReplay.ps1 index 94b2460c9c..ad0ea0b688 100644 --- a/functions/New-DbaXESmartReplay.ps1 +++ b/functions/New-DbaXESmartReplay.ps1 @@ -69,7 +69,7 @@ function New-DbaXESmartReplay { Replays events from the 'Profiler Standard' session on sql2016 to sql2017's planning database. Does not run as a job so you can see the raw output. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -126,5 +126,4 @@ function New-DbaXESmartReplay { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbaXESmartTableWriter.ps1 b/functions/New-DbaXESmartTableWriter.ps1 index 8b6eece96e..bc3ca0903b 100644 --- a/functions/New-DbaXESmartTableWriter.ps1 +++ b/functions/New-DbaXESmartTableWriter.ps1 @@ -76,7 +76,7 @@ function New-DbaXESmartTableWriter { Writes Extended Events to the deadlocktracker table in dbadb on sql2017. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -135,5 +135,4 @@ function New-DbaXESmartTableWriter { } } } -} - +} \ No newline at end of file diff --git a/functions/New-DbatoolsSupportPackage.ps1 b/functions/New-DbatoolsSupportPackage.ps1 index bbc2917c47..8a5472546f 100644 --- a/functions/New-DbatoolsSupportPackage.ps1 +++ b/functions/New-DbatoolsSupportPackage.ps1 @@ -50,7 +50,7 @@ function New-DbatoolsSupportPackage { Creates a large support pack in order to help us troubleshoot stuff. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [string] @@ -191,5 +191,4 @@ This will make it easier for us to troubleshoot and you won't be sending us the end { Write-Message -Level InternalComment -Message "Ending" } -} - +} \ No newline at end of file diff --git a/functions/Publish-DbaDacPackage.ps1 b/functions/Publish-DbaDacPackage.ps1 index 88a2e6d1c2..246cfeae58 100644 --- a/functions/Publish-DbaDacPackage.ps1 +++ b/functions/Publish-DbaDacPackage.ps1 @@ -96,7 +96,7 @@ function Publish-DbaDacPackage { PS C:\> Publish-DbaDacPackage -SqlInstance sql2017 -Database WideWorldImporters -Path C:\temp\sql2016-WideWorldImporters.dacpac -PublishXml C:\temp\sql2016-WideWorldImporters-publish.xml -GenerateDeploymentReport -ScriptOnly Does not deploy the changes, but will generate the deployment report that would be executed against WideWorldImporters. -#> + #> [CmdletBinding(DefaultParameterSetName = 'Obj')] param ( [Alias("ServerInstance", "SqlServer")] @@ -357,5 +357,4 @@ function Publish-DbaDacPackage { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Publish-DbaDacpac } -} - +} \ No newline at end of file diff --git a/functions/Read-DbaAuditFile.ps1 b/functions/Read-DbaAuditFile.ps1 index 5720e0d644..169c6c2ee6 100644 --- a/functions/Read-DbaAuditFile.ps1 +++ b/functions/Read-DbaAuditFile.ps1 @@ -46,7 +46,7 @@ function Read-DbaAuditFile { Reads remote Audit details by accessing the file over the admin UNC share. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -141,5 +141,4 @@ function Read-DbaAuditFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Read-DbaBackupHeader.ps1 b/functions/Read-DbaBackupHeader.ps1 index 753cf64a8a..32dc9b797e 100644 --- a/functions/Read-DbaBackupHeader.ps1 +++ b/functions/Read-DbaBackupHeader.ps1 @@ -83,7 +83,7 @@ function Read-DbaBackupHeader { Gets the backup header information from the SQL Server backup file stored at https://dbatoolsaz.blob.core.windows.net/azbackups/restoretime/restoretime_201705131850.bak on Azure - #> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", 'AzureCredential', Justification = "For Parameter AzureCredential")] [CmdletBinding()] param ( @@ -278,5 +278,4 @@ function Read-DbaBackupHeader { $runspacePool.Close() [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace = $defaultrunspace } -} - +} \ No newline at end of file diff --git a/functions/Read-DbaTraceFile.ps1 b/functions/Read-DbaTraceFile.ps1 index 04f9729e43..1a93ac5b3d 100644 --- a/functions/Read-DbaTraceFile.ps1 +++ b/functions/Read-DbaTraceFile.ps1 @@ -153,7 +153,7 @@ function Read-DbaTraceFile { Reads every trace file on sql2014 -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipelineByPropertyName)] @@ -277,5 +277,4 @@ function Read-DbaTraceFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Read-DbaTransactionLog.ps1 b/functions/Read-DbaTransactionLog.ps1 index 5d72f5671f..546145bb08 100644 --- a/functions/Read-DbaTransactionLog.ps1 +++ b/functions/Read-DbaTransactionLog.ps1 @@ -50,7 +50,7 @@ function Read-DbaTransactionLog { Will read the contents of the transaction log of MyDatabase on SQL Server Instance sql2016 into the local PowerShell object $Log, ignoring the recommendation of not returning more that 0.5GB of log -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Position = 0, Mandatory)] @@ -110,5 +110,4 @@ function Read-DbaTransactionLog { Write-Message -Level Verbose -Message "Starting Log retrieval" $server.Query($sql, $Database) -} - +} \ No newline at end of file diff --git a/functions/Read-DbaXEFile.ps1 b/functions/Read-DbaXEFile.ps1 index 2f9969348f..526137dbd3 100644 --- a/functions/Read-DbaXEFile.ps1 +++ b/functions/Read-DbaXEFile.ps1 @@ -47,7 +47,7 @@ function Read-DbaXEFile { Reads remote XEvents by accessing the file over the admin UNC share. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -145,5 +145,4 @@ function Read-DbaXEFile { $enum.Dispose() } } -} - +} \ No newline at end of file diff --git a/functions/Register-DbatoolsConfig.ps1 b/functions/Register-DbatoolsConfig.ps1 index 218d8591c4..2d41d48f57 100644 --- a/functions/Register-DbatoolsConfig.ps1 +++ b/functions/Register-DbatoolsConfig.ps1 @@ -54,7 +54,7 @@ function Register-DbatoolsConfig { Retrieves all configuration items of the module MyModule, then registers them in registry to enforce them for all users on the current system. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseApprovedVerbs", "", Justification = "Internal functions are ignored")] param ( @@ -164,4 +164,4 @@ function Register-DbatoolsConfig { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Register-DbaConfig } -} +} \ No newline at end of file diff --git a/functions/Remove-DbaAgDatabase.ps1 b/functions/Remove-DbaAgDatabase.ps1 index 4fe8cca494..88c160b0f2 100644 --- a/functions/Remove-DbaAgDatabase.ps1 +++ b/functions/Remove-DbaAgDatabase.ps1 @@ -52,7 +52,7 @@ function Remove-DbaAgDatabase { PS C:\> Get-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup availabilitygroup1 | Remove-DbaAgDatabase Removes the availability groups returned from the Get-DbaAvailabilityGroup function. Prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -102,5 +102,4 @@ function Remove-DbaAgDatabase { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaAgListener.ps1 b/functions/Remove-DbaAgListener.ps1 index 5a1e068cdc..46fec4eb7d 100644 --- a/functions/Remove-DbaAgListener.ps1 +++ b/functions/Remove-DbaAgListener.ps1 @@ -52,7 +52,7 @@ function Remove-DbaAgListener { PS C:\> Get-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup availabilitygroup1 | Remove-DbaAgListener Removes the listeners returned from the Get-DbaAvailabilityGroup function. Prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -94,4 +94,4 @@ function Remove-DbaAgListener { } } } -} +} \ No newline at end of file diff --git a/functions/Remove-DbaAgReplica.ps1 b/functions/Remove-DbaAgReplica.ps1 index 711b2703d6..88669ca186 100644 --- a/functions/Remove-DbaAgReplica.ps1 +++ b/functions/Remove-DbaAgReplica.ps1 @@ -54,7 +54,7 @@ function Remove-DbaAgReplica { Returns full object properties on all availability group replicas found on sql2017a -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -93,4 +93,4 @@ function Remove-DbaAgReplica { } } } -} +} \ No newline at end of file diff --git a/functions/Remove-DbaAgentJob.ps1 b/functions/Remove-DbaAgentJob.ps1 index 6db7ebea20..67fde6781c 100644 --- a/functions/Remove-DbaAgentJob.ps1 +++ b/functions/Remove-DbaAgentJob.ps1 @@ -74,7 +74,7 @@ function Remove-DbaAgentJob { Removes the job from multiple servers -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [Alias("ServerInstance", "SqlServer")] @@ -151,5 +151,4 @@ function Remove-DbaAgentJob { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaAgentJobCategory.ps1 b/functions/Remove-DbaAgentJobCategory.ps1 index 5a6d2781f0..309395be91 100644 --- a/functions/Remove-DbaAgentJobCategory.ps1 +++ b/functions/Remove-DbaAgentJobCategory.ps1 @@ -56,7 +56,7 @@ function Remove-DbaAgentJobCategory { Remove multiple job categories from the multiple instances. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -115,5 +115,4 @@ function Remove-DbaAgentJobCategory { Write-Message -Message "Finished removing job category." -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaAgentJobStep.ps1 b/functions/Remove-DbaAgentJobStep.ps1 index a60505fa2f..d66e62114f 100644 --- a/functions/Remove-DbaAgentJobStep.ps1 +++ b/functions/Remove-DbaAgentJobStep.ps1 @@ -67,7 +67,7 @@ function Remove-DbaAgentJobStep { Remove the job step from the job on multiple servers using pipeline. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -138,5 +138,4 @@ function Remove-DbaAgentJobStep { end { Write-Message -Message "Finished removing the jobs step(s)" -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaAgentSchedule.ps1 b/functions/Remove-DbaAgentSchedule.ps1 index 10850817a7..e1e468e8f4 100644 --- a/functions/Remove-DbaAgentSchedule.ps1 +++ b/functions/Remove-DbaAgentSchedule.ps1 @@ -73,7 +73,7 @@ function Remove-DbaAgentSchedule { Remove the schedules using a pipeline -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory, ValueFromPipeline, ParameterSetName = "instance")] @@ -186,5 +186,4 @@ function Remove-DbaAgentSchedule { end { Write-Message -Message "Finished removing jobs schedule(s)." -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaAvailabilityGroup.ps1 b/functions/Remove-DbaAvailabilityGroup.ps1 index 4ac090d1d3..a6eb18da54 100644 --- a/functions/Remove-DbaAvailabilityGroup.ps1 +++ b/functions/Remove-DbaAvailabilityGroup.ps1 @@ -67,7 +67,7 @@ function Remove-DbaAvailabilityGroup { PS C:\> Get-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup availabilitygroup1 | Remove-DbaAvailabilityGroup Removes the availability groups returned from the Get-DbaAvailabilityGroup function. Prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -104,5 +104,4 @@ function Remove-DbaAvailabilityGroup { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaBackup.ps1 b/functions/Remove-DbaBackup.ps1 index 6bc846c220..046b8b60fa 100644 --- a/functions/Remove-DbaBackup.ps1 +++ b/functions/Remove-DbaBackup.ps1 @@ -154,5 +154,4 @@ function Remove-DbaBackup { Write-Message -Message "Removed empty folders." -Level Verbose } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaClientAlias.ps1 b/functions/Remove-DbaClientAlias.ps1 index a6123ac6ed..cb6db17bf3 100644 --- a/functions/Remove-DbaClientAlias.ps1 +++ b/functions/Remove-DbaClientAlias.ps1 @@ -47,7 +47,7 @@ function Remove-DbaClientAlias { Removes all SQL Server client aliases on the local computer -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(ValueFromPipelineByPropertyName = $true)] @@ -113,5 +113,4 @@ function Remove-DbaClientAlias { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaCmConnection.ps1 b/functions/Remove-DbaCmConnection.ps1 index 0e789d19a8..b4646f645a 100644 --- a/functions/Remove-DbaCmConnection.ps1 +++ b/functions/Remove-DbaCmConnection.ps1 @@ -41,7 +41,7 @@ function Remove-DbaCmConnection { Clears the entire connection cache. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [Parameter(ValueFromPipeline, Mandatory)] @@ -73,5 +73,4 @@ function Remove-DbaCmConnection { end { Write-Message -Level InternalComment -Message "Ending" } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaCmsRegServer.ps1 b/functions/Remove-DbaCmsRegServer.ps1 index d857860dff..386009b509 100644 --- a/functions/Remove-DbaCmsRegServer.ps1 +++ b/functions/Remove-DbaCmsRegServer.ps1 @@ -64,7 +64,7 @@ function Remove-DbaCmsRegServer { Removes all registered servers on sql2012 and turns off all prompting -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( @@ -109,5 +109,4 @@ function Remove-DbaCmsRegServer { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Remove-DbaRegisteredServer } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaCmsRegServerGroup.ps1 b/functions/Remove-DbaCmsRegServerGroup.ps1 index 684d753810..44761e79f1 100644 --- a/functions/Remove-DbaCmsRegServerGroup.ps1 +++ b/functions/Remove-DbaCmsRegServerGroup.ps1 @@ -53,7 +53,7 @@ function Remove-DbaCmsRegServerGroup { Removes the Development subgroup within the HR group on sql2012 and turns off all prompting -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [Alias("ServerInstance", "SqlServer")] @@ -97,5 +97,4 @@ function Remove-DbaCmsRegServerGroup { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Remove-DbaRegisteredServerGroup } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaComputerCertificate.ps1 b/functions/Remove-DbaComputerCertificate.ps1 index 2d9a3b26f3..be80821970 100644 --- a/functions/Remove-DbaComputerCertificate.ps1 +++ b/functions/Remove-DbaComputerCertificate.ps1 @@ -57,7 +57,7 @@ function Remove-DbaComputerCertificate { Removes certificate with thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 in the User\My (Personal) store on Server1 -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] param ( [Alias("ServerInstance", "SqlServer", "SqlInstance")] @@ -116,5 +116,4 @@ function Remove-DbaComputerCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDatabase.ps1 b/functions/Remove-DbaDatabase.ps1 index 87b8cd2249..a9f36d343c 100644 --- a/functions/Remove-DbaDatabase.ps1 +++ b/functions/Remove-DbaDatabase.ps1 @@ -67,7 +67,7 @@ function Remove-DbaDatabase { PS C:\> Get-DbaDatabase -SqlInstance server\instance -ExcludeAllSystemDb | Remove-DbaDatabase -Confirm:$false Removes all the user databases from server\instance without any confirmation -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High', DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ParameterSetName = "instance")] diff --git a/functions/Remove-DbaDatabaseSafely.ps1 b/functions/Remove-DbaDatabaseSafely.ps1 index 11c632a671..2e2b6fcb82 100644 --- a/functions/Remove-DbaDatabaseSafely.ps1 +++ b/functions/Remove-DbaDatabaseSafely.ps1 @@ -108,7 +108,7 @@ function Remove-DbaDatabaseSafely { If there is a DBCC Error, the function will continue to perform rest of the actions and will create an Agent job with 'DBCCERROR' in the name and a Backup file with 'DBCCError' in the name. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -682,5 +682,4 @@ function Remove-DbaDatabaseSafely { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Remove-SqlDatabaseSafely } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDbBackupRestoreHistory.ps1 b/functions/Remove-DbaDbBackupRestoreHistory.ps1 index 02ec7aaec0..9b4fe981cb 100644 --- a/functions/Remove-DbaDbBackupRestoreHistory.ps1 +++ b/functions/Remove-DbaDbBackupRestoreHistory.ps1 @@ -67,7 +67,7 @@ function Remove-DbaDbBackupRestoreHistory { PS C:\> Get-DbaDatabase -SqlInstance sql2016 | Remove-DbaDbBackupRestoreHistory -WhatIf Remove complete backup and restore history for all databases on SQL Server sql2016 - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Remove-DbaDbCertificate.ps1 b/functions/Remove-DbaDbCertificate.ps1 index 18aa598e40..001c2c1853 100644 --- a/functions/Remove-DbaDbCertificate.ps1 +++ b/functions/Remove-DbaDbCertificate.ps1 @@ -51,7 +51,7 @@ function Remove-DbaDbCertificate { Suppresses all prompts to remove the certificate in the 'db1' database and drops the key. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess, ConfirmImpact = "High")] param ( [Alias("ServerInstance", "SqlServer")] @@ -94,5 +94,4 @@ function Remove-DbaDbCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDbMasterKey.ps1 b/functions/Remove-DbaDbMasterKey.ps1 index 2c59087a52..626f43b860 100644 --- a/functions/Remove-DbaDbMasterKey.ps1 +++ b/functions/Remove-DbaDbMasterKey.ps1 @@ -61,7 +61,7 @@ function Remove-DbaDbMasterKey { Suppresses all prompts to remove the master key in the 'db1' database and drops the key. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess, ConfirmImpact = "High")] param ( [Alias("ServerInstance", "SqlServer")] @@ -110,5 +110,4 @@ function Remove-DbaDbMasterKey { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDbMirror.ps1 b/functions/Remove-DbaDbMirror.ps1 index da7db838b2..58f22269cb 100644 --- a/functions/Remove-DbaDbMirror.ps1 +++ b/functions/Remove-DbaDbMirror.ps1 @@ -57,7 +57,7 @@ function Remove-DbaDbMirror { Returns all Endpoint(s) for the local and sql2016 SQL Server instances -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -103,5 +103,4 @@ function Remove-DbaDbMirror { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDbMirrorMonitor.ps1 b/functions/Remove-DbaDbMirrorMonitor.ps1 index 3376237938..1432461688 100644 --- a/functions/Remove-DbaDbMirrorMonitor.ps1 +++ b/functions/Remove-DbaDbMirrorMonitor.ps1 @@ -42,7 +42,7 @@ function Remove-DbaDbMirrorMonitor { Stops and deletes the mirroring monitor job for all the databases on sql2008 and sql2012. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -72,5 +72,4 @@ function Remove-DbaDbMirrorMonitor { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDbSnapshot.ps1 b/functions/Remove-DbaDbSnapshot.ps1 index d727fa7f85..ac8c15da87 100644 --- a/functions/Remove-DbaDbSnapshot.ps1 +++ b/functions/Remove-DbaDbSnapshot.ps1 @@ -93,7 +93,7 @@ function Remove-DbaDbSnapshot { Removes all database snapshots from sql2014 and prompts for each database -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -171,5 +171,4 @@ function Remove-DbaDbSnapshot { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Remove-DbaDatabaseSnapshot } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaDbUser.ps1 b/functions/Remove-DbaDbUser.ps1 index 62d4c03a02..55b5cb1aab 100644 --- a/functions/Remove-DbaDbUser.ps1 +++ b/functions/Remove-DbaDbUser.ps1 @@ -71,7 +71,7 @@ function Remove-DbaDbUser { Drops user1 from all databases it exists in on server 'sqlserver2014'. -#> + #> [CmdletBinding(DefaultParameterSetName = 'User', SupportsShouldProcess = $true)] param ( @@ -232,6 +232,4 @@ function Remove-DbaDbUser { } } -} - - +} \ No newline at end of file diff --git a/functions/Remove-DbaEndpoint.ps1 b/functions/Remove-DbaEndpoint.ps1 index a50ffbcdc8..e1c777ccfc 100644 --- a/functions/Remove-DbaEndpoint.ps1 +++ b/functions/Remove-DbaEndpoint.ps1 @@ -57,7 +57,7 @@ function Remove-DbaEndpoint { PS C:\> Get-DbaEndpoint -SqlInstance sqlserver2012 -Endpoint endpoint1 | Remove-DbaEndpoint Removes the endpoints returned from the Get-DbaEndpoint function. Prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -95,5 +95,4 @@ function Remove-DbaEndpoint { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaLogin.ps1 b/functions/Remove-DbaLogin.ps1 index 8334f3b434..1008b4eaa7 100644 --- a/functions/Remove-DbaLogin.ps1 +++ b/functions/Remove-DbaLogin.ps1 @@ -63,7 +63,7 @@ function Remove-DbaLogin { Removes mylogin on SQL Server server\instance -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High', DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ParameterSetName = "instance")] @@ -121,5 +121,4 @@ function Remove-DbaLogin { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaNetworkCertificate.ps1 b/functions/Remove-DbaNetworkCertificate.ps1 index 1446a4a774..b27b6cc632 100644 --- a/functions/Remove-DbaNetworkCertificate.ps1 +++ b/functions/Remove-DbaNetworkCertificate.ps1 @@ -50,7 +50,7 @@ function Remove-DbaNetworkCertificate { Shows what would happen if the command were run -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low", DefaultParameterSetName = 'Default')] param ( [Parameter(ValueFromPipeline)] @@ -136,5 +136,4 @@ function Remove-DbaNetworkCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaOrphanUser.ps1 b/functions/Remove-DbaOrphanUser.ps1 index 058bd75b2f..c400fc0309 100644 --- a/functions/Remove-DbaOrphanUser.ps1 +++ b/functions/Remove-DbaOrphanUser.ps1 @@ -85,7 +85,7 @@ function Remove-DbaOrphanUser { Removes user OrphanUser from all databases even if they have a matching Login. Any schema that the user owns will change ownership to dbo. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -314,5 +314,4 @@ function Remove-DbaOrphanUser { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Remove-SqlOrphanUser } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaPfDataCollectorCounter.ps1 b/functions/Remove-DbaPfDataCollectorCounter.ps1 index 9b0f030c6c..d483bd705a 100644 --- a/functions/Remove-DbaPfDataCollectorCounter.ps1 +++ b/functions/Remove-DbaPfDataCollectorCounter.ps1 @@ -59,7 +59,7 @@ function Remove-DbaPfDataCollectorCounter { Allows you to select which counters you'd like on localhost and does not prompt for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -136,5 +136,4 @@ function Remove-DbaPfDataCollectorCounter { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaPfDataCollectorSet.ps1 b/functions/Remove-DbaPfDataCollectorSet.ps1 index d330821860..a293d50f28 100644 --- a/functions/Remove-DbaPfDataCollectorSet.ps1 +++ b/functions/Remove-DbaPfDataCollectorSet.ps1 @@ -68,7 +68,7 @@ function Remove-DbaPfDataCollectorSet { Stops and removes the 'System Correlation' Collector. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -134,5 +134,4 @@ function Remove-DbaPfDataCollectorSet { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaSpn.ps1 b/functions/Remove-DbaSpn.ps1 index 9bb63540c3..afbae0e837 100644 --- a/functions/Remove-DbaSpn.ps1 +++ b/functions/Remove-DbaSpn.ps1 @@ -65,7 +65,7 @@ function Remove-DbaSpn { Removes all set SPNs for sql2005 and the relative delegations -#> + #> [cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Default")] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] @@ -174,5 +174,4 @@ function Remove-DbaSpn { } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaTrace.ps1 b/functions/Remove-DbaTrace.ps1 index 46a419887d..dd2d4fb650 100644 --- a/functions/Remove-DbaTrace.ps1 +++ b/functions/Remove-DbaTrace.ps1 @@ -53,7 +53,7 @@ function Remove-DbaTrace { Stops and removes selected traces on sql2008 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -106,5 +106,4 @@ function Remove-DbaTrace { } } } -} - +} \ No newline at end of file diff --git a/functions/Remove-DbaXESession.ps1 b/functions/Remove-DbaXESession.ps1 index 5dc84e068f..9febba1823 100644 --- a/functions/Remove-DbaXESession.ps1 +++ b/functions/Remove-DbaXESession.ps1 @@ -64,7 +64,7 @@ function Remove-DbaXESession { Removes the sessions returned from the Get-DbaXESession function. -#> + #> [CmdletBinding(DefaultParameterSetName = 'Session', SupportsShouldProcess, ConfirmImpact = 'High')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -136,4 +136,4 @@ function Remove-DbaXESession { } } } -} +} \ No newline at end of file diff --git a/functions/Remove-DbaXESmartTarget.ps1 b/functions/Remove-DbaXESmartTarget.ps1 index 2465ef96d3..47eb12b1b7 100644 --- a/functions/Remove-DbaXESmartTarget.ps1 +++ b/functions/Remove-DbaXESmartTarget.ps1 @@ -44,7 +44,7 @@ function Remove-DbaXESmartTarget { Removes a specific XESmartTarget job. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -63,5 +63,4 @@ function Remove-DbaXESmartTarget { } } } -} - +} \ No newline at end of file diff --git a/functions/Rename-DbaDatabase.ps1 b/functions/Rename-DbaDatabase.ps1 index 5224c550b5..2d0c1c8364 100644 --- a/functions/Rename-DbaDatabase.ps1 +++ b/functions/Rename-DbaDatabase.ps1 @@ -194,7 +194,7 @@ function Rename-DbaDatabase { Renames the HR database to "dbatools_HR" and then all filenames as "dbatools_HR_[Name of the FileGroup]_[original_filename]" The db is then set offline (watch out!). The function tries to do a simple rename and then sets the db online again to finish the rename process -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ParameterSetName = "Server")] @@ -847,5 +847,4 @@ function Rename-DbaDatabase { } #endregion db loop } -} - +} \ No newline at end of file diff --git a/functions/Rename-DbaLogin.ps1 b/functions/Rename-DbaLogin.ps1 index 0ef083c402..2885e0ab97 100644 --- a/functions/Rename-DbaLogin.ps1 +++ b/functions/Rename-DbaLogin.ps1 @@ -60,7 +60,7 @@ function Rename-DbaLogin { WhatIf Example -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory)] @@ -150,5 +150,4 @@ function Rename-DbaLogin { } } } -} - +} \ No newline at end of file diff --git a/functions/Repair-DbaDbMirror.ps1 b/functions/Repair-DbaDbMirror.ps1 index c1b92a209f..c758acbdd3 100644 --- a/functions/Repair-DbaDbMirror.ps1 +++ b/functions/Repair-DbaDbMirror.ps1 @@ -58,7 +58,7 @@ function Repair-DbaDbMirror { Attempts to repair the mirrored but suspended pubs database on sql2017. Restarts the endpoints then sets the partner to resume. Does not prompt for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -90,5 +90,4 @@ function Repair-DbaDbMirror { } } } -} - +} \ No newline at end of file diff --git a/functions/Repair-DbaOrphanUser.ps1 b/functions/Repair-DbaOrphanUser.ps1 index 8259aa6647..2aee2cad19 100644 --- a/functions/Repair-DbaOrphanUser.ps1 +++ b/functions/Repair-DbaOrphanUser.ps1 @@ -88,7 +88,7 @@ function Repair-DbaOrphanUser { Finds all orphan users of all databases present on server 'sqlserver2014a'. Removes all users that do not have matching Logins. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -229,5 +229,4 @@ function Repair-DbaOrphanUser { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Repair-SqlOrphanUser } -} - +} \ No newline at end of file diff --git a/functions/Repair-DbaServerName.ps1 b/functions/Repair-DbaServerName.ps1 index 208189bdee..c2112ecb6b 100644 --- a/functions/Repair-DbaServerName.ps1 +++ b/functions/Repair-DbaServerName.ps1 @@ -61,7 +61,7 @@ function Repair-DbaServerName { Checks to see if the server name is updatable and automatically performs the change, bypassing most prompts and confirmations. Replication or mirroring will be broken if necessary. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -249,5 +249,4 @@ function Repair-DbaServerName { } } } -} - +} \ No newline at end of file diff --git a/functions/Reset-DbaAdmin.ps1 b/functions/Reset-DbaAdmin.ps1 index 342112e589..e8ba15a252 100644 --- a/functions/Reset-DbaAdmin.ps1 +++ b/functions/Reset-DbaAdmin.ps1 @@ -84,7 +84,7 @@ function Reset-DbaAdmin { Skips restart confirmation, prompts for password, then adds a SQL Login "sqladmin" with sysadmin privileges. If the account already exists, it will be added to the sysadmin role and the password will be reset. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWMICmdlet", "", Justification = "Using Get-WmiObject for client backwards compatibilty")] param ( @@ -426,5 +426,4 @@ function Reset-DbaAdmin { end { Write-Message -Level Verbose -Message "Script complete!" } -} - +} \ No newline at end of file diff --git a/functions/Resolve-DbaNetworkName.ps1 b/functions/Resolve-DbaNetworkName.ps1 index ab05bee358..81d5c3d39a 100644 --- a/functions/Resolve-DbaNetworkName.ps1 +++ b/functions/Resolve-DbaNetworkName.ps1 @@ -82,7 +82,7 @@ function Resolve-DbaNetworkName { Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, Domain, FQDN for all SQL Servers returned by Get-DbaCmsRegServer -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -266,5 +266,4 @@ function Resolve-DbaNetworkName { } } } -} - +} \ No newline at end of file diff --git a/functions/Restart-DbaService.ps1 b/functions/Restart-DbaService.ps1 index ed36cb25ed..e7ea72a207 100644 --- a/functions/Restart-DbaService.ps1 +++ b/functions/Restart-DbaService.ps1 @@ -79,7 +79,7 @@ function Restart-DbaService { Restarts SQL Server database engine services on sql1 forcing dependent SQL Server Agent services to restart as well. -#> + #> [CmdletBinding(DefaultParameterSetName = "Server", SupportsShouldProcess = $true)] param ( [Parameter(ParameterSetName = "Server", Position = 1)] @@ -146,5 +146,4 @@ function Restart-DbaService { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Restart-DbaSqlService } -} - +} \ No newline at end of file diff --git a/functions/Restore-DbaBackupFromDirectory.ps1 b/functions/Restore-DbaBackupFromDirectory.ps1 index 249a356f73..b1b044f864 100644 --- a/functions/Restore-DbaBackupFromDirectory.ps1 +++ b/functions/Restore-DbaBackupFromDirectory.ps1 @@ -47,7 +47,7 @@ function Restore-DbaBackupFromDirectory { All user databases contained within \\fileserver\share\sqlbackups\SQLSERVERA will be restored to sqlcluster, down the most recent full/differential/logs. -#> + #> #Requires -Version 3.0 [CmdletBinding()] param ( @@ -64,5 +64,4 @@ function Restore-DbaBackupFromDirectory { ) Write-Message -Level Warning -Message "This command is no longer supported. Please use Get-ChildItem | Restore-DbaDatabase instead" -} - +} \ No newline at end of file diff --git a/functions/Restore-DbaDbCertificate.ps1 b/functions/Restore-DbaDbCertificate.ps1 index bdec1183d6..095b4f16ef 100644 --- a/functions/Restore-DbaDbCertificate.ps1 +++ b/functions/Restore-DbaDbCertificate.ps1 @@ -57,7 +57,7 @@ function Restore-DbaDbCertificate { Restores the DatabaseTDE certificate to Server1 and uses the MasterKey to encrypt the private key. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess, ConfirmImpact = "High")] param ( [Parameter(Mandatory)] @@ -121,5 +121,4 @@ function Restore-DbaDbCertificate { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Retore-DbaDatabaseCertificate } -} - +} \ No newline at end of file diff --git a/functions/Restore-DbaDbSnapshot.ps1 b/functions/Restore-DbaDbSnapshot.ps1 index f68540b4b4..9d329a2d13 100644 --- a/functions/Restore-DbaDbSnapshot.ps1 +++ b/functions/Restore-DbaDbSnapshot.ps1 @@ -79,7 +79,7 @@ function Restore-DbaDbSnapshot { Restores databases from snapshots named HR_snap_20161201 and Accounting_snap_20161101 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -198,5 +198,4 @@ function Restore-DbaDbSnapshot { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Restore-DbaFromDatabaseSnapshot } -} - +} \ No newline at end of file diff --git a/functions/Resume-DbaAgDbDataMovement.ps1 b/functions/Resume-DbaAgDbDataMovement.ps1 index 80c0aa6805..2916919348 100644 --- a/functions/Resume-DbaAgDbDataMovement.ps1 +++ b/functions/Resume-DbaAgDbDataMovement.ps1 @@ -53,7 +53,7 @@ function Resume-DbaAgDbDataMovement { Resumes data movement on the selected availability group databases. Does not prompt for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Revoke-DbaAgPermission.ps1 b/functions/Revoke-DbaAgPermission.ps1 index 3ec106a8e3..84dceef03b 100644 --- a/functions/Revoke-DbaAgPermission.ps1 +++ b/functions/Revoke-DbaAgPermission.ps1 @@ -82,7 +82,7 @@ function Revoke-DbaAgPermission { PS C:\> Get-DbaLogin -SqlInstance sql2017a | Out-GridView -Passthru | Revoke-DbaAgPermission -Type EndPoint Revokes the selected logins Connect permissions on the DatabaseMirroring endpoint for sql2017a. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Save-DbaDiagnosticQueryScript.ps1 b/functions/Save-DbaDiagnosticQueryScript.ps1 index d0bb99765a..39e5e5727e 100644 --- a/functions/Save-DbaDiagnosticQueryScript.ps1 +++ b/functions/Save-DbaDiagnosticQueryScript.ps1 @@ -34,7 +34,7 @@ function Save-DbaDiagnosticQueryScript { Downloads the most recent version of all Glenn Berry DMV scripts to the specified location. If Path is not specified, the "My Documents" location will be used. -#> + #> [CmdletBinding()] param ( [System.IO.FileInfo]$Path = [Environment]::GetFolderPath("mydocuments"), @@ -101,5 +101,4 @@ function Save-DbaDiagnosticQueryScript { return } } -} - +} \ No newline at end of file diff --git a/functions/Select-DbaBackupInformation.ps1 b/functions/Select-DbaBackupInformation.ps1 index 36619a514f..c5e67d8f61 100644 --- a/functions/Select-DbaBackupInformation.ps1 +++ b/functions/Select-DbaBackupInformation.ps1 @@ -72,7 +72,7 @@ function Select-DbaBackupInformation { Returns all the backups in \\server1\backups$ to restore to 1 hour ago using only Full and Diff backups. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -235,5 +235,4 @@ function Select-DbaBackupInformation { $dbhistory } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAgListener.ps1 b/functions/Set-DbaAgListener.ps1 index a65ea7e7fd..81320e97d9 100644 --- a/functions/Set-DbaAgListener.ps1 +++ b/functions/Set-DbaAgListener.ps1 @@ -57,7 +57,7 @@ function Set-DbaAgListener { PS C:\> Get-DbaAgListener -SqlInstance sql2017 | Out-GridView -Passthru | Set-DbaAgListener -Port 1433 -Confirm:$false Changes the port for selected AG listeners to 1433. Does not prompt for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Set-DbaAgReplica.ps1 b/functions/Set-DbaAgReplica.ps1 index 983548f288..6fdcf7f796 100644 --- a/functions/Set-DbaAgReplica.ps1 +++ b/functions/Set-DbaAgReplica.ps1 @@ -82,7 +82,7 @@ function Set-DbaAgReplica { PS C:\> Get-DbaAgReplica -SqlInstance sql2016 | Out-GridView -Passthru | Set-DbaAgReplica -BackupPriority 5000 Sets the backup priority to 5000 for the selected availability groups. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Set-DbaAgentAlert.ps1 b/functions/Set-DbaAgentAlert.ps1 index 8749646a40..e1b7331897 100644 --- a/functions/Set-DbaAgentAlert.ps1 +++ b/functions/Set-DbaAgentAlert.ps1 @@ -73,7 +73,7 @@ function Set-DbaAgentAlert { Doesn't Change the alert but shows what would happen. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [Alias("ServerInstance", "SqlServer")] @@ -165,5 +165,4 @@ function Set-DbaAgentAlert { } { Write-Message -Message "Finished changing alert(s)" -Level Verbose -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAgentJob.ps1 b/functions/Set-DbaAgentJob.ps1 index 71cdc74033..afb52b8c92 100644 --- a/functions/Set-DbaAgentJob.ps1 +++ b/functions/Set-DbaAgentJob.ps1 @@ -150,7 +150,7 @@ function Set-DbaAgentJob { Changes a job with the name "Job1" on multiple servers to have another description using pipe line -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [Alias("ServerInstance", "SqlServer")] @@ -496,5 +496,4 @@ function Set-DbaAgentJob { end { Write-Message -Message "Finished changing job(s)" -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAgentJobCategory.ps1 b/functions/Set-DbaAgentJobCategory.ps1 index 607944e9b1..84f287cd38 100644 --- a/functions/Set-DbaAgentJobCategory.ps1 +++ b/functions/Set-DbaAgentJobCategory.ps1 @@ -53,7 +53,7 @@ function Set-DbaAgentJobCategory { Rename multiple jobs in one go on multiple servers. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -148,5 +148,4 @@ function Set-DbaAgentJobCategory { Write-Message -Message "Finished changing job category." -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAgentJobOutputFile.ps1 b/functions/Set-DbaAgentJobOutputFile.ps1 index 830e540aa1..8a861142e4 100644 --- a/functions/Set-DbaAgentJobOutputFile.ps1 +++ b/functions/Set-DbaAgentJobOutputFile.ps1 @@ -45,7 +45,7 @@ function Set-DbaAgentJobOutputFile { Sets the Job step for The Agent job on SERVERNAME to E:\Logs\AgentJobStepOutput.txt -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [Parameter(Mandatory, HelpMessage = 'The SQL Server Instance', @@ -144,5 +144,4 @@ function Set-DbaAgentJobOutputFile { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAgentJobStep.ps1 b/functions/Set-DbaAgentJobStep.ps1 index a4aa9d8935..0d66649742 100644 --- a/functions/Set-DbaAgentJobStep.ps1 +++ b/functions/Set-DbaAgentJobStep.ps1 @@ -134,7 +134,7 @@ function Set-DbaAgentJobStep { Changes the database of the step in "Job1" with the name Step1 to msdb for multiple servers using pipeline -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -347,5 +347,4 @@ function Set-DbaAgentJobStep { if (Test-FunctionInterrupt) { return } Write-Message -Message "Finished changing job step(s)" -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAgentSchedule.ps1 b/functions/Set-DbaAgentSchedule.ps1 index 965f030a9c..357faa0925 100644 --- a/functions/Set-DbaAgentSchedule.ps1 +++ b/functions/Set-DbaAgentSchedule.ps1 @@ -123,7 +123,7 @@ function Set-DbaAgentSchedule { Changes the schedule for Job1 with the name 'daily' to enabled on multiple servers using pipe line -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -449,5 +449,4 @@ function Set-DbaAgentSchedule { if (Test-FunctionInterrupt) { return } Write-Message -Message "Finished changing the job schedule(s)" -Level Verbose } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaAvailabilityGroup.ps1 b/functions/Set-DbaAvailabilityGroup.ps1 index 6ea205a657..ee982d55da 100644 --- a/functions/Set-DbaAvailabilityGroup.ps1 +++ b/functions/Set-DbaAvailabilityGroup.ps1 @@ -88,7 +88,7 @@ function Set-DbaAvailabilityGroup { PS C:\> Set-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 -DtcSupportEnabled:$false Disables DTC support for the availability group AG1 -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] param ( diff --git a/functions/Set-DbaCmConnection.ps1 b/functions/Set-DbaCmConnection.ps1 index 09d2897c33..db68694866 100644 --- a/functions/Set-DbaCmConnection.ps1 +++ b/functions/Set-DbaCmConnection.ps1 @@ -131,7 +131,7 @@ function Set-DbaCmConnection { In this example, the configuration settings will also be reset, since after re-import those will be set to explicit, rather than deriving them from the global settings. In many cases, using the default settings is desirable. For specific settings, use New-DbaCmConnection as part of the profile in order to explicitly configure a connection. -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Credential')] param ( [Parameter(ValueFromPipeline)] @@ -294,5 +294,4 @@ function Set-DbaCmConnection { end { Write-Message -Level InternalComment -Message "Stopping execution" } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbCompatibility.ps1 b/functions/Set-DbaDbCompatibility.ps1 index 3e0c23b5f9..6bdeb06d73 100644 --- a/functions/Set-DbaDbCompatibility.ps1 +++ b/functions/Set-DbaDbCompatibility.ps1 @@ -69,7 +69,7 @@ function Set-DbaDbCompatibility { PS C:\> Set-DbaDbCompatibility -SqlInstance localhost\sql2017 -Database Test -TargetCompatibility 12 Changes database compatibility level for database Test on server localhost\sql2017 to Version 120 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -137,5 +137,4 @@ function Set-DbaDbCompatibility { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbCompression.ps1 b/functions/Set-DbaDbCompression.ps1 index 91863280cc..75ca8cce45 100644 --- a/functions/Set-DbaDbCompression.ps1 +++ b/functions/Set-DbaDbCompression.ps1 @@ -93,7 +93,7 @@ function Set-DbaDbCompression { Set the compression run time to 60 minutes and will start the compression of tables/indexes across all listed servers that have a difference of 25% or higher between current and recommended. Output of command is exported to a csv. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -312,5 +312,4 @@ function Set-DbaDbCompression { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbMirror.ps1 b/functions/Set-DbaDbMirror.ps1 index 00c8153765..b2813e5be5 100644 --- a/functions/Set-DbaDbMirror.ps1 +++ b/functions/Set-DbaDbMirror.ps1 @@ -74,7 +74,7 @@ function Set-DbaDbMirror { Does not prompt for confirmation and sets the state to suspend for the database "dbtools" -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -131,5 +131,4 @@ function Set-DbaDbMirror { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbOwner.ps1 b/functions/Set-DbaDbOwner.ps1 index 1d1fba6fb1..734188f078 100644 --- a/functions/Set-DbaDbOwner.ps1 +++ b/functions/Set-DbaDbOwner.ps1 @@ -60,7 +60,7 @@ function Set-DbaDbOwner { Sets database owner to 'sa' on the db1 and db2 databases if their current owner does not match 'sa'. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -156,5 +156,4 @@ function Set-DbaDbOwner { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Set-DbaDatabaseOwner } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbQueryStoreOption.ps1 b/functions/Set-DbaDbQueryStoreOption.ps1 index aabf776c77..8b8f3fe66e 100644 --- a/functions/Set-DbaDbQueryStoreOption.ps1 +++ b/functions/Set-DbaDbQueryStoreOption.ps1 @@ -89,7 +89,7 @@ function Set-DbaDbQueryStoreOption { Configure the Query Store settings for all user databases except the AdventureWorks database in the ServerA\SQL Instance. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -219,5 +219,4 @@ function Set-DbaDbQueryStoreOption { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Set-DbaDbQueryStoreOptions } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbRecoveryModel.ps1 b/functions/Set-DbaDbRecoveryModel.ps1 index da62c3f737..bd14ddaa37 100644 --- a/functions/Set-DbaDbRecoveryModel.ps1 +++ b/functions/Set-DbaDbRecoveryModel.ps1 @@ -81,7 +81,7 @@ function Set-DbaDbRecoveryModel { Sets the Recovery Model to BulkLogged for [TestDB1] and [TestDB2] databases on SQL Server instance sql2014. Runs without asking for confirmation. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess, ConfirmImpact = 'High')] param ( [parameter(Mandatory, ParameterSetName = "Instance")] @@ -145,5 +145,4 @@ function Set-DbaDbRecoveryModel { Get-DbaDbRecoveryModel -SqlInstance $db.Parent -Database $db.name } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaDbState.ps1 b/functions/Set-DbaDbState.ps1 index 293cf59ff0..a5c0c86551 100644 --- a/functions/Set-DbaDbState.ps1 +++ b/functions/Set-DbaDbState.ps1 @@ -116,7 +116,7 @@ function Set-DbaDbState { Gets the databases from Get-DbaDatabase, and sets them as SINGLE_USER, dropping all other connections (and rolling back open transactions) -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "Server")] @@ -502,5 +502,4 @@ function Set-DbaDbState { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Set-DbaDatabaseState } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaEndpoint.ps1 b/functions/Set-DbaEndpoint.ps1 index f957f17b57..3930528e0f 100644 --- a/functions/Set-DbaEndpoint.ps1 +++ b/functions/Set-DbaEndpoint.ps1 @@ -60,7 +60,7 @@ function Set-DbaEndpoint { Changes the endpoint type to tsql on endpoint ep1 -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Set-DbaErrorLogConfig.ps1 b/functions/Set-DbaErrorLogConfig.ps1 index 126514bc23..fb34789e88 100644 --- a/functions/Set-DbaErrorLogConfig.ps1 +++ b/functions/Set-DbaErrorLogConfig.ps1 @@ -58,7 +58,7 @@ function Set-DbaErrorLogConfig { Sets the number of error log files to 25 and size before it will roll over to 500 KB on sql2012 -#> + #> [cmdletbinding(SupportsShouldProcess)] param( [Parameter(ValueFromPipelineByPropertyName, Mandatory)] @@ -130,5 +130,4 @@ function Set-DbaErrorLogConfig { $collection } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaJobOwner.ps1 b/functions/Set-DbaJobOwner.ps1 index fd5ba89851..012ae291dd 100644 --- a/functions/Set-DbaJobOwner.ps1 +++ b/functions/Set-DbaJobOwner.ps1 @@ -66,7 +66,7 @@ function Set-DbaJobOwner { Sets SQL Agent Job owner to sa on all jobs where the owner does not match sa on both sqlserver and sql2016. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -137,5 +137,4 @@ function Set-DbaJobOwner { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaLogin.ps1 b/functions/Set-DbaLogin.ps1 index f70daf7ff7..71d1811ef1 100644 --- a/functions/Set-DbaLogin.ps1 +++ b/functions/Set-DbaLogin.ps1 @@ -141,7 +141,7 @@ function Set-DbaLogin { Disable the login from the pipeline -#> + #> [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Parameter Password")] @@ -363,5 +363,4 @@ function Set-DbaLogin { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaMaxDop.ps1 b/functions/Set-DbaMaxDop.ps1 index d2789230f4..5e0c628070 100644 --- a/functions/Set-DbaMaxDop.ps1 +++ b/functions/Set-DbaMaxDop.ps1 @@ -78,7 +78,7 @@ function Set-DbaMaxDop { Set recommended Max DOP for all databases on server sql2016. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -249,5 +249,4 @@ function Set-DbaMaxDop { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaMaxMemory.ps1 b/functions/Set-DbaMaxMemory.ps1 index ff9fe958e8..8a94e77486 100644 --- a/functions/Set-DbaMaxMemory.ps1 +++ b/functions/Set-DbaMaxMemory.ps1 @@ -63,7 +63,7 @@ function Set-DbaMaxMemory { Find all servers in SQL Server Central Management Server that have Max SQL memory set to higher than the total memory of the server (think 2147483647), then pipe those to Set-DbaMaxMemory and use the default recommendation. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Set-DbaNetworkCertificate.ps1 b/functions/Set-DbaNetworkCertificate.ps1 index 4b9e455b84..2ac40df910 100644 --- a/functions/Set-DbaNetworkCertificate.ps1 +++ b/functions/Set-DbaNetworkCertificate.ps1 @@ -59,7 +59,7 @@ function Set-DbaNetworkCertificate { Sets the network certificate for the SQL2008R2SP2 instance to the certificate with the thumbprint of 1223FB1ACBCA44D3EE9640F81B6BA14A92F3D6E2 in LocalMachine\My on sql1 -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low", DefaultParameterSetName = 'Default')] param ( [Parameter(ValueFromPipeline)] @@ -210,5 +210,4 @@ function Set-DbaNetworkCertificate { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaPowerPlan.ps1 b/functions/Set-DbaPowerPlan.ps1 index 7cdd74bd06..df7107cac0 100644 --- a/functions/Set-DbaPowerPlan.ps1 +++ b/functions/Set-DbaPowerPlan.ps1 @@ -73,7 +73,7 @@ function Set-DbaPowerPlan { PS C:\> Test-DbaPowerPlan -ComputerName sqlcluster | Set-DbaPowerPlan Tests the Power Plan on sqlcluster and sets the Power Plan to High Performance. Skips it if its already set. -#> + #> [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( diff --git a/functions/Set-DbaPrivilege.ps1 b/functions/Set-DbaPrivilege.ps1 index 3209e2418b..309ffeaa05 100644 --- a/functions/Set-DbaPrivilege.ps1 +++ b/functions/Set-DbaPrivilege.ps1 @@ -50,7 +50,7 @@ function Set-DbaPrivilege { Adds the SQL Service account(s) on computers sql1, sql2 and sql3 to the local privilege 'SeManageVolumePrivilege'. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(ValueFromPipeline)] @@ -159,5 +159,4 @@ function Convert-UserNameToSID ([string] `$Acc ) { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaSpConfigure.ps1 b/functions/Set-DbaSpConfigure.ps1 index f91450ea29..2b5fdf03ad 100644 --- a/functions/Set-DbaSpConfigure.ps1 +++ b/functions/Set-DbaSpConfigure.ps1 @@ -66,7 +66,7 @@ function Set-DbaSpConfigure { Returns information on the action that would be performed. No actual change will be made. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -128,5 +128,4 @@ function Set-DbaSpConfigure { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaSpn.ps1 b/functions/Set-DbaSpn.ps1 index cc456d9ab7..72d7556759 100644 --- a/functions/Set-DbaSpn.ps1 +++ b/functions/Set-DbaSpn.ps1 @@ -70,7 +70,7 @@ function Set-DbaSpn { Displays what would happen trying to set all missing SPNs for sql2016 -#> + #> [cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Default")] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] @@ -162,5 +162,4 @@ function Set-DbaSpn { } } } -} - +} \ No newline at end of file diff --git a/functions/Set-DbaTcpPort.ps1 b/functions/Set-DbaTcpPort.ps1 index c2ff0f0bc0..217d3b619b 100644 --- a/functions/Set-DbaTcpPort.ps1 +++ b/functions/Set-DbaTcpPort.ps1 @@ -58,7 +58,7 @@ function Set-DbaTcpPort { Sets the port number 1337 for all IP Addresses on SqlInstance sql2017 and sql2019 using the credentials for ad\dba. Prompts for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] param ( [parameter(Mandatory, ValueFromPipeline)] diff --git a/functions/Set-DbaTempDbConfig.ps1 b/functions/Set-DbaTempDbConfig.ps1 index 48a1e71659..008c8a8002 100644 --- a/functions/Set-DbaTempDbConfig.ps1 +++ b/functions/Set-DbaTempDbConfig.ps1 @@ -91,7 +91,7 @@ function Set-DbaTempdbConfig { Returns the T-SQL script representing tempdb configuration. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -266,5 +266,4 @@ function Set-DbaTempdbConfig { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Set-SqlTempDbConfiguration Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Set-DbaTempDbConfiguration } -} - +} \ No newline at end of file diff --git a/functions/Set-DbatoolsConfig.ps1 b/functions/Set-DbatoolsConfig.ps1 index b2334b58ff..b9139cce78 100644 --- a/functions/Set-DbatoolsConfig.ps1 +++ b/functions/Set-DbatoolsConfig.ps1 @@ -250,5 +250,4 @@ function Set-DbatoolsConfig { } } #endregion Regular configuration update -} - +} \ No newline at end of file diff --git a/functions/Show-DbaDbList.ps1 b/functions/Show-DbaDbList.ps1 index 4873e3226e..3f9163c17c 100644 --- a/functions/Show-DbaDbList.ps1 +++ b/functions/Show-DbaDbList.ps1 @@ -47,7 +47,7 @@ function Show-DbaDbList { Shows a GUI list of databases using Windows Authentication to connect to the SQL Server. The "master" database will be selected when the lists shows. Returns a string of the selected database. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -199,5 +199,4 @@ function Show-DbaDbList { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Show-SqlDatabaseList Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Show-DbaDatabaseList } -} - +} \ No newline at end of file diff --git a/functions/Show-DbaServerFileSystem.ps1 b/functions/Show-DbaServerFileSystem.ps1 index c3ee223005..bf01ea0826 100644 --- a/functions/Show-DbaServerFileSystem.ps1 +++ b/functions/Show-DbaServerFileSystem.ps1 @@ -41,7 +41,7 @@ function Show-DbaServerFileSystem { Shows a list of databases using SQL credentials to connect to the SQL Server. Returns a string of the selected path. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -211,5 +211,4 @@ function Show-DbaServerFileSystem { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Show-SqlServerFileSystem } -} - +} \ No newline at end of file diff --git a/functions/Start-DbaAgentJob.ps1 b/functions/Start-DbaAgentJob.ps1 index dc7c14102c..16f12317e5 100644 --- a/functions/Start-DbaAgentJob.ps1 +++ b/functions/Start-DbaAgentJob.ps1 @@ -80,7 +80,7 @@ function Start-DbaAgentJob { Start all the jobs -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ParameterSetName = "Instance")] @@ -176,5 +176,4 @@ function Start-DbaAgentJob { } } } -} - +} \ No newline at end of file diff --git a/functions/Start-DbaEndpoint.ps1 b/functions/Start-DbaEndpoint.ps1 index 801b1771f3..ebb15d589d 100644 --- a/functions/Start-DbaEndpoint.ps1 +++ b/functions/Start-DbaEndpoint.ps1 @@ -59,7 +59,7 @@ function Start-DbaEndpoint { Starts the endpoints returned from the Get-Endpoint function. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -91,6 +91,4 @@ function Start-DbaEndpoint { } } } -} - - +} \ No newline at end of file diff --git a/functions/Start-DbaMigration.ps1 b/functions/Start-DbaMigration.ps1 index 213b40b038..f903177496 100644 --- a/functions/Start-DbaMigration.ps1 +++ b/functions/Start-DbaMigration.ps1 @@ -217,7 +217,7 @@ function Start-DbaMigration { Migrate databases using detach/copy/attach. Reattach at source and set source databases read-only. Also migrates everything else. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess = $true)] param ( [parameter(Position = 1, Mandatory)] @@ -461,5 +461,4 @@ function Start-DbaMigration { Write-Message -Level Verbose -Message "Migration completed: $(Get-Date)" Write-Message -Level Verbose -Message "Total Elapsed time: $totaltime" } -} - +} \ No newline at end of file diff --git a/functions/Start-DbaPfDataCollectorSet.ps1 b/functions/Start-DbaPfDataCollectorSet.ps1 index 80684a5ac4..f7f1ef4fe4 100644 --- a/functions/Start-DbaPfDataCollectorSet.ps1 +++ b/functions/Start-DbaPfDataCollectorSet.ps1 @@ -66,7 +66,7 @@ function Start-DbaPfDataCollectorSet { Starts the 'System Correlation' Collector. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -125,5 +125,4 @@ function Start-DbaPfDataCollectorSet { } } } -} - +} \ No newline at end of file diff --git a/functions/Start-DbaService.ps1 b/functions/Start-DbaService.ps1 index 335fe0bea1..ed70286db0 100644 --- a/functions/Start-DbaService.ps1 +++ b/functions/Start-DbaService.ps1 @@ -71,7 +71,7 @@ function Start-DbaService { Starts the SQL Server related services of type "SSRS" (Reporting Services) on computers in the variable MyServers. -#> + #> [CmdletBinding(DefaultParameterSetName = "Server", SupportsShouldProcess = $true)] param ( [Parameter(ParameterSetName = "Server", Position = 1)] @@ -115,5 +115,4 @@ function Start-DbaService { } Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Start-DbaSqlService } -} - +} \ No newline at end of file diff --git a/functions/Start-DbaTrace.ps1 b/functions/Start-DbaTrace.ps1 index 91217d1de0..b8c1152392 100644 --- a/functions/Start-DbaTrace.ps1 +++ b/functions/Start-DbaTrace.ps1 @@ -53,7 +53,7 @@ function Start-DbaTrace { Starts selected traces on sql2008 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -95,5 +95,4 @@ function Start-DbaTrace { } } } -} - +} \ No newline at end of file diff --git a/functions/Start-DbaXESession.ps1 b/functions/Start-DbaXESession.ps1 index 87c36f809e..10fa174025 100644 --- a/functions/Start-DbaXESession.ps1 +++ b/functions/Start-DbaXESession.ps1 @@ -67,7 +67,7 @@ function Start-DbaXESession { Starts the sessions returned from the Get-DbaXESession function. -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Session')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -169,4 +169,4 @@ function Start-DbaXESession { } } } -} +} \ No newline at end of file diff --git a/functions/Start-DbaXESmartTarget.ps1 b/functions/Start-DbaXESmartTarget.ps1 index 920f01cd93..0a362624b6 100644 --- a/functions/Start-DbaXESmartTarget.ps1 +++ b/functions/Start-DbaXESmartTarget.ps1 @@ -86,7 +86,7 @@ function Start-DbaXESmartTarget { Writes Extended Events to the deadlocktracker table in dbadb on sql2017. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -223,5 +223,4 @@ function Start-DbaXESmartTarget { } } } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaAgentJob.ps1 b/functions/Stop-DbaAgentJob.ps1 index eda7d1a109..87d4ecbe79 100644 --- a/functions/Stop-DbaAgentJob.ps1 +++ b/functions/Stop-DbaAgentJob.ps1 @@ -61,7 +61,7 @@ function Stop-DbaAgentJob { Stops the cdc.DBWithCDC_capture SQL Agent Job on sql2016 -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ParameterSetName = "Instance")] @@ -128,5 +128,4 @@ function Stop-DbaAgentJob { } } } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaEndpoint.ps1 b/functions/Stop-DbaEndpoint.ps1 index 04e18450ba..70cb7ae2ff 100644 --- a/functions/Stop-DbaEndpoint.ps1 +++ b/functions/Stop-DbaEndpoint.ps1 @@ -59,7 +59,7 @@ function Stop-DbaEndpoint { Stops the endpoints returned from the Get-Endpoint command. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, @@ -91,5 +91,4 @@ function Stop-DbaEndpoint { } } } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaPfDataCollectorSet.ps1 b/functions/Stop-DbaPfDataCollectorSet.ps1 index 1768a7ad85..cfe1cad18b 100644 --- a/functions/Stop-DbaPfDataCollectorSet.ps1 +++ b/functions/Stop-DbaPfDataCollectorSet.ps1 @@ -66,7 +66,7 @@ function Stop-DbaPfDataCollectorSet { Stops the 'System Correlation' Collector. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [DbaInstance[]]$ComputerName = $env:COMPUTERNAME, @@ -125,5 +125,4 @@ function Stop-DbaPfDataCollectorSet { } } } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaProcess.ps1 b/functions/Stop-DbaProcess.ps1 index d66caaff20..4f384fe7b5 100644 --- a/functions/Stop-DbaProcess.ps1 +++ b/functions/Stop-DbaProcess.ps1 @@ -91,7 +91,7 @@ function Stop-DbaProcess { Finds processes that were created with dbatools, then kills them. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default", SupportsShouldProcess)] param ( [parameter(Mandatory, ParameterSetName = "Server")] @@ -151,5 +151,4 @@ function Stop-DbaProcess { } } } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaService.ps1 b/functions/Stop-DbaService.ps1 index 9f1a024265..727abbc327 100644 --- a/functions/Stop-DbaService.ps1 +++ b/functions/Stop-DbaService.ps1 @@ -82,7 +82,7 @@ function Stop-DbaService { Stops SQL Server database engine services on sql1 forcing dependent SQL Server Agent services to stop as well. -#> + #> [CmdletBinding(DefaultParameterSetName = "Server", SupportsShouldProcess = $true)] param ( [Parameter(ParameterSetName = "Server", Position = 1)] @@ -140,5 +140,4 @@ function Stop-DbaService { } Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Stop-DbaSqlService } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaTrace.ps1 b/functions/Stop-DbaTrace.ps1 index fd37fcb856..7924130122 100644 --- a/functions/Stop-DbaTrace.ps1 +++ b/functions/Stop-DbaTrace.ps1 @@ -53,7 +53,7 @@ function Stop-DbaTrace { Stops selected traces on sql2008 -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [Alias("ServerInstance", "SqlServer")] @@ -124,5 +124,4 @@ function Stop-DbaTrace { } } } -} - +} \ No newline at end of file diff --git a/functions/Stop-DbaXESession.ps1 b/functions/Stop-DbaXESession.ps1 index 0fa95272bc..59a7f91998 100644 --- a/functions/Stop-DbaXESession.ps1 +++ b/functions/Stop-DbaXESession.ps1 @@ -59,7 +59,7 @@ function Stop-DbaXESession { Stops the sessions returned from the Get-DbaXESession function. -#> + #> [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Session')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Internal functions are ignored")] param ( @@ -133,4 +133,4 @@ function Stop-DbaXESession { } } } -} +} \ No newline at end of file diff --git a/functions/Stop-DbaXESmartTarget.ps1 b/functions/Stop-DbaXESmartTarget.ps1 index 35e5fc173a..fb463a583c 100644 --- a/functions/Stop-DbaXESmartTarget.ps1 +++ b/functions/Stop-DbaXESmartTarget.ps1 @@ -43,7 +43,7 @@ function Stop-DbaXESmartTarget { Stops a specific XESmartTarget job. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -62,5 +62,4 @@ function Stop-DbaXESmartTarget { } } } -} - +} \ No newline at end of file diff --git a/functions/Suspend-DbaAgDbDataMovement.ps1 b/functions/Suspend-DbaAgDbDataMovement.ps1 index 7fc119724b..84a212e781 100644 --- a/functions/Suspend-DbaAgDbDataMovement.ps1 +++ b/functions/Suspend-DbaAgDbDataMovement.ps1 @@ -53,7 +53,7 @@ function Suspend-DbaAgDbDataMovement { Suspends data movement on the selected availability group databases. Does not prompt for confirmation. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Sync-DbaAvailabilityGroup.ps1 b/functions/Sync-DbaAvailabilityGroup.ps1 index e083709ca4..a3924247a8 100644 --- a/functions/Sync-DbaAvailabilityGroup.ps1 +++ b/functions/Sync-DbaAvailabilityGroup.ps1 @@ -108,7 +108,7 @@ function Sync-DbaAvailabilityGroup { PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql2016a | Sync-DbaAvailabilityGroup -WhatIf Shows what would happen if the command were to run but doesn't actually perform the action. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] param ( [DbaInstanceParameter]$Primary, diff --git a/functions/Sync-DbaLoginPermission.ps1 b/functions/Sync-DbaLoginPermission.ps1 index cfbf99fdff..4308020ffb 100644 --- a/functions/Sync-DbaLoginPermission.ps1 +++ b/functions/Sync-DbaLoginPermission.ps1 @@ -61,7 +61,7 @@ function Sync-DbaLoginPermission { Copies permissions ONLY for logins netnerds and realcajun. -#> + #> [CmdletBinding(SupportsShouldProcess)] param ( [parameter(Mandatory, ValueFromPipeline)] diff --git a/functions/Test-DbaBackupInformation.ps1 b/functions/Test-DbaBackupInformation.ps1 index b0d3f2ba15..9151fcc9ad 100644 --- a/functions/Test-DbaBackupInformation.ps1 +++ b/functions/Test-DbaBackupInformation.ps1 @@ -63,7 +63,7 @@ function Test-DbaBackupInformation { Pass in a BackupHistory object to be tested against MyInstance. Those records that pass are marked as verified. We can then use the IsVerified property to divide the failures and successes -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( diff --git a/functions/Test-DbaBuild.ps1 b/functions/Test-DbaBuild.ps1 index c7c6d8d271..b56926bdf1 100644 --- a/functions/Test-DbaBuild.ps1 +++ b/functions/Test-DbaBuild.ps1 @@ -91,7 +91,7 @@ function Test-DbaBuild { Integrate with other cmdlets to have builds checked for all your registered servers on sqlserver2014a -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( @@ -281,5 +281,4 @@ function Test-DbaBuild { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaSqlBuild } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaCmConnection.ps1 b/functions/Test-DbaCmConnection.ps1 index 7b9b13f187..7f685f8bdf 100644 --- a/functions/Test-DbaCmConnection.ps1 +++ b/functions/Test-DbaCmConnection.ps1 @@ -62,7 +62,7 @@ function Test-DbaCmConnection { The results will be reported and registered. Future calls from Get-DbaCmObject will recognize the results and optimize the query. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWMICmdlet", "", Justification = "Using Get-WmiObject is used as a fallback for testing connections")] param ( @@ -326,5 +326,4 @@ function Test-DbaCmConnection { end { } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaConnection.ps1 b/functions/Test-DbaConnection.ps1 index e559f0587a..a4f5199150 100644 --- a/functions/Test-DbaConnection.ps1 +++ b/functions/Test-DbaConnection.ps1 @@ -59,7 +59,7 @@ function Test-DbaConnection { ``` Test connection to SQL2016 and outputs information collected -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -191,5 +191,4 @@ function Test-DbaConnection { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-SqlConnection } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaConnectionAuthScheme.ps1 b/functions/Test-DbaConnectionAuthScheme.ps1 index 6ba8795a72..136bcc65f7 100644 --- a/functions/Test-DbaConnectionAuthScheme.ps1 +++ b/functions/Test-DbaConnectionAuthScheme.ps1 @@ -56,7 +56,7 @@ function Test-DbaConnectionAuthScheme { Returns the results of "SELECT * from sys.dm_exec_connections WHERE session_id = @@SPID" -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -121,5 +121,4 @@ function Test-DbaConnectionAuthScheme { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDbCollation.ps1 b/functions/Test-DbaDbCollation.ps1 index d6034f99f4..84b9c07e3c 100644 --- a/functions/Test-DbaDbCollation.ps1 +++ b/functions/Test-DbaDbCollation.ps1 @@ -57,7 +57,7 @@ function Test-DbaDbCollation { Returns db/server collation information for every database on every server listed in the Central Management Server on sql2016. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -110,5 +110,4 @@ function Test-DbaDbCollation { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaDatabaseCollation } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDbCompatibility.ps1 b/functions/Test-DbaDbCompatibility.ps1 index b76e13f11c..9ae40bb272 100644 --- a/functions/Test-DbaDbCompatibility.ps1 +++ b/functions/Test-DbaDbCompatibility.ps1 @@ -57,7 +57,7 @@ function Test-DbaDbCompatibility { Returns db/server compatibility information for every database on every server listed in the Central Management Server on sql2016. -#> + #> [CmdletBinding()] [OutputType("System.Collections.ArrayList")] param ( @@ -112,5 +112,4 @@ function Test-DbaDbCompatibility { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaDatabaseCompatibility } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDbCompression.ps1 b/functions/Test-DbaDbCompression.ps1 index c3023b8420..c74b9fb7cf 100644 --- a/functions/Test-DbaDbCompression.ps1 +++ b/functions/Test-DbaDbCompression.ps1 @@ -136,7 +136,7 @@ function Test-DbaDbCompression { This produces a full analysis of all your servers listed and is pushed to a csv for you to analyze. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -636,5 +636,4 @@ IF OBJECT_ID('tempdb..##tmpEstimatePage', 'U') IS NOT NULL } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDbLogShipStatus.ps1 b/functions/Test-DbaDbLogShipStatus.ps1 index e07ce7f27b..e06019cb8e 100644 --- a/functions/Test-DbaDbLogShipStatus.ps1 +++ b/functions/Test-DbaDbLogShipStatus.ps1 @@ -77,7 +77,7 @@ function Test-DbaDbLogShipStatus { Retrieves the log ship information and only returns the columns SQL Instance, Database, Instance Type and Status -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -279,5 +279,4 @@ EXEC master.sys.sp_help_log_shipping_monitor" end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -Alias Test-DbaLogShippingStatus } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDbOwner.ps1 b/functions/Test-DbaDbOwner.ps1 index f1a1b6ff9f..9b501df72d 100644 --- a/functions/Test-DbaDbOwner.ps1 +++ b/functions/Test-DbaDbOwner.ps1 @@ -54,7 +54,7 @@ function Test-DbaDbOwner { Returns all databases where the owner does not match 'DOMAIN\account'. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory)] @@ -127,5 +127,4 @@ function Test-DbaDbOwner { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaDatabaseOwner } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDbVirtualLogFile.ps1 b/functions/Test-DbaDbVirtualLogFile.ps1 index 8a266729ab..16c2ecbd02 100644 --- a/functions/Test-DbaDbVirtualLogFile.ps1 +++ b/functions/Test-DbaDbVirtualLogFile.ps1 @@ -66,7 +66,7 @@ function Test-DbaDbVirtualLogFile { Returns VLF counts for the db1 and db2 databases on sqlcluster. -#> + #> [CmdletBinding()] [OutputType([System.Collections.ArrayList])] param ([parameter(ValueFromPipeline, Mandatory)] @@ -131,5 +131,4 @@ function Test-DbaDbVirtualLogFile { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaVirtualLogFile } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDeprecatedFeature.ps1 b/functions/Test-DbaDeprecatedFeature.ps1 index 1e9b392436..f0bf2f867a 100644 --- a/functions/Test-DbaDeprecatedFeature.ps1 +++ b/functions/Test-DbaDeprecatedFeature.ps1 @@ -57,7 +57,7 @@ function Test-DbaDeprecatedFeature { Check deprecated features on server sql2008 for only the TestDB database -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer", "SqlServers")] @@ -104,5 +104,4 @@ function Test-DbaDeprecatedFeature { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDiskAlignment.ps1 b/functions/Test-DbaDiskAlignment.ps1 index 615bce55a3..708b2efc9e 100644 --- a/functions/Test-DbaDiskAlignment.ps1 +++ b/functions/Test-DbaDiskAlignment.ps1 @@ -74,7 +74,7 @@ function Test-DbaDiskAlignment { Tests the disk alignment of multiple servers -#> + #> param ( [parameter(Mandatory, ValueFromPipeline)] [Alias("ServerInstance", "SqlServer", "SqlInstance")] @@ -321,5 +321,4 @@ function Test-DbaDiskAlignment { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDiskAllocation.ps1 b/functions/Test-DbaDiskAllocation.ps1 index 9d1f1860a2..b90c0a7c17 100644 --- a/functions/Test-DbaDiskAllocation.ps1 +++ b/functions/Test-DbaDiskAllocation.ps1 @@ -63,7 +63,7 @@ function Test-DbaDiskAllocation { Scans all disks not hosting SQL Server data or log files on server sqlserver2014a for best practice allocation unit size. -#> + #> [CmdletBinding(SupportsShouldProcess)] [OutputType("System.Collections.ArrayList", "System.Boolean")] param ( @@ -224,5 +224,4 @@ function Test-DbaDiskAllocation { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaDiskSpeed.ps1 b/functions/Test-DbaDiskSpeed.ps1 index 5ed4080eab..b14cbd067e 100644 --- a/functions/Test-DbaDiskSpeed.ps1 +++ b/functions/Test-DbaDiskSpeed.ps1 @@ -48,7 +48,7 @@ function Test-DbaDiskSpeed { Tests how disks storing tempdb files on sql2008 are performing. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -117,5 +117,4 @@ function Test-DbaDiskSpeed { $server.Query("$sql") } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaEndpoint.ps1 b/functions/Test-DbaEndpoint.ps1 index 581f9ba299..0d5b068e24 100644 --- a/functions/Test-DbaEndpoint.ps1 +++ b/functions/Test-DbaEndpoint.ps1 @@ -64,7 +64,7 @@ function Test-DbaEndpoint { See all endpoints that were skipped due to not having a tcp listener port. -#> + #> [CmdletBinding()] param ( [DbaInstanceParameter[]]$SqlInstance, diff --git a/functions/Test-DbaIdentityUsage.ps1 b/functions/Test-DbaIdentityUsage.ps1 index e183a5aa7f..4fef00ef54 100644 --- a/functions/Test-DbaIdentityUsage.ps1 +++ b/functions/Test-DbaIdentityUsage.ps1 @@ -55,7 +55,7 @@ function Test-DbaIdentityUsage { Check identity seeds on server sql2008 for only the TestDB database, limiting results to 20% utilization of seed range or higher -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -205,5 +205,4 @@ function Test-DbaIdentityUsage { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaJobOwner.ps1 b/functions/Test-DbaJobOwner.ps1 index 0fd0147d17..93f5627d77 100644 --- a/functions/Test-DbaJobOwner.ps1 +++ b/functions/Test-DbaJobOwner.ps1 @@ -59,7 +59,7 @@ function Test-DbaJobOwner { Returns all SQL Agent Jobs where the owner does not match DOMAIN\account. Note that Login must be a valid security principal that exists on the target server. -#> + #> [CmdletBinding()] [OutputType('System.Object[]')] param ( @@ -153,5 +153,4 @@ function Test-DbaJobOwner { Select-DefaultView -InputObject $results -Property Server, Job, JobType, CurrentOwner, TargetOwner, OwnerMatch } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaLastBackup.ps1 b/functions/Test-DbaLastBackup.ps1 index 61a7d0b700..27ccbff037 100644 --- a/functions/Test-DbaLastBackup.ps1 +++ b/functions/Test-DbaLastBackup.ps1 @@ -139,7 +139,7 @@ function Test-DbaLastBackup { Copies the backup files for sql2014 databases to sql2016 default backup locations and then attempts restore from there. - #> + #> [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification = "For Paramters DestinationCredential and AzureCredential")] param ( diff --git a/functions/Test-DbaLinkedServerConnection.ps1 b/functions/Test-DbaLinkedServerConnection.ps1 index 995842143c..99358709f9 100644 --- a/functions/Test-DbaLinkedServerConnection.ps1 +++ b/functions/Test-DbaLinkedServerConnection.ps1 @@ -55,7 +55,7 @@ function Test-DbaLinkedServerConnection { Test all Linked Servers for the SQL Server instances sql2016, sql2014 and sql2012 -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] @@ -95,5 +95,4 @@ function Test-DbaLinkedServerConnection { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaLoginPassword.ps1 b/functions/Test-DbaLoginPassword.ps1 index 732c0fe22c..ceda57018b 100644 --- a/functions/Test-DbaLoginPassword.ps1 +++ b/functions/Test-DbaLoginPassword.ps1 @@ -69,7 +69,7 @@ function Test-DbaLoginPassword { Test selected logins on all servers in the $servers variable -#> + #> [CmdletBinding()] param ( [Alias("ServerInstance", "SqlServer", "SqlServers")] @@ -145,5 +145,4 @@ function Test-DbaLoginPassword { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaManagementObject.ps1 b/functions/Test-DbaManagementObject.ps1 index 9b045c9d7e..4c878c6bf4 100644 --- a/functions/Test-DbaManagementObject.ps1 +++ b/functions/Test-DbaManagementObject.ps1 @@ -36,7 +36,7 @@ function Test-DbaManagementObject { Returns True if the version exists, if it does not exist it will return False -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline)] @@ -82,5 +82,4 @@ function Test-DbaManagementObject { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaSqlManagementObject } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaMaxDop.ps1 b/functions/Test-DbaMaxDop.ps1 index e980980222..c2e9852fb9 100644 --- a/functions/Test-DbaMaxDop.ps1 +++ b/functions/Test-DbaMaxDop.ps1 @@ -59,7 +59,7 @@ function Test-DbaMaxDop { Get Max DOP setting for servers sql2016 with the recommended value. Piping the output to Select-Object * will also show the 'NUMANodes' and 'NumberOfCores' of each instance. Because it is an 2016 instance will be shown 'InstanceVersion', 'Database' and 'DatabaseMaxDop' columns. -#> + #> [CmdletBinding()] [OutputType([System.Collections.ArrayList])] param ( @@ -201,5 +201,4 @@ function Test-DbaMaxDop { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaMaxMemory.ps1 b/functions/Test-DbaMaxMemory.ps1 index 513cd99213..921eb601fb 100644 --- a/functions/Test-DbaMaxMemory.ps1 +++ b/functions/Test-DbaMaxMemory.ps1 @@ -49,7 +49,7 @@ function Test-DbaMaxMemory { Find all servers in CMS that have Max SQL memory set to higher than the total memory of the server (think 2147483647) and set it to recommended value. - #> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] diff --git a/functions/Test-DbaMigrationConstraint.ps1 b/functions/Test-DbaMigrationConstraint.ps1 index 355964c4fd..9e805352b0 100644 --- a/functions/Test-DbaMigrationConstraint.ps1 +++ b/functions/Test-DbaMigrationConstraint.ps1 @@ -69,7 +69,7 @@ function Test-DbaMigrationConstraint { Only db1 database will be verified for features in use that can't be supported on the destination server. -#> + #> [CmdletBinding(DefaultParameterSetName = "DbMigration")] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -295,5 +295,4 @@ function Test-DbaMigrationConstraint { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-SqlMigrationConstraint } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaNetworkLatency.ps1 b/functions/Test-DbaNetworkLatency.ps1 index 50592a83a2..64edefe540 100644 --- a/functions/Test-DbaNetworkLatency.ps1 +++ b/functions/Test-DbaNetworkLatency.ps1 @@ -59,7 +59,7 @@ function Test-DbaNetworkLatency { Tests the execution results return of "select top 10 * from otherdb.dbo.table" 10 times on sqlserver2014a, sqlcluster, and sqlserver using Windows credentials. -#> + #> [CmdletBinding()] [OutputType([System.Object[]])] param ( @@ -124,5 +124,4 @@ function Test-DbaNetworkLatency { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-SqlNetworkLatency } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaOptimizeForAdHoc.ps1 b/functions/Test-DbaOptimizeForAdHoc.ps1 index 95f379884c..6b490ff7a4 100644 --- a/functions/Test-DbaOptimizeForAdHoc.ps1 +++ b/functions/Test-DbaOptimizeForAdHoc.ps1 @@ -36,7 +36,7 @@ function Test-DbaOptimizeForAdHoc { Validates whether Optimize for AdHoc Workloads setting is enabled for servers sql2008 and sqlserver2012. -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -81,5 +81,4 @@ function Test-DbaOptimizeForAdHoc { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaPath.ps1 b/functions/Test-DbaPath.ps1 index c618788796..a5f001051c 100644 --- a/functions/Test-DbaPath.ps1 +++ b/functions/Test-DbaPath.ps1 @@ -43,7 +43,7 @@ function Test-DbaPath { Tests whether the service account running the "sqlcluster" SQL Server instance can access L:\MSAS12.MSSQLSERVER\OLAP. Logs into sqlcluster using SQL authentication. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -105,5 +105,4 @@ function Test-DbaPath { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-SqlPath Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaSqlPath } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaPowerPlan.ps1 b/functions/Test-DbaPowerPlan.ps1 index 5e42d02f6a..c39e7b7f7e 100644 --- a/functions/Test-DbaPowerPlan.ps1 +++ b/functions/Test-DbaPowerPlan.ps1 @@ -48,7 +48,7 @@ function Test-DbaPowerPlan { Checks the Power Plan settings for sqlserver2014a and indicates whether or not it is set to the custom plan "Maximum Performance". -#> + #> param ( [parameter(ValueFromPipeline)] [Alias("ServerInstance", "SqlServer", "SqlInstance")] @@ -132,5 +132,4 @@ function Test-DbaPowerPlan { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaRecoveryModel.ps1 b/functions/Test-DbaRecoveryModel.ps1 index 79119484a8..de17c4f925 100644 --- a/functions/Test-DbaRecoveryModel.ps1 +++ b/functions/Test-DbaRecoveryModel.ps1 @@ -64,7 +64,7 @@ function Test-DbaRecoveryModel { Shows all of the properties for the databases that have Full Recovery Model -#> + #> [CmdletBinding()] [OutputType("System.Collections.ArrayList")] param ( @@ -159,5 +159,4 @@ function Test-DbaRecoveryModel { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaRepLatency.ps1 b/functions/Test-DbaRepLatency.ps1 index 0ba1eade03..2dc34b5214 100644 --- a/functions/Test-DbaRepLatency.ps1 +++ b/functions/Test-DbaRepLatency.ps1 @@ -60,7 +60,7 @@ function Test-DbaRepLatency { Return replication latency for the TestDB_Pub publication for the TestDB database located on the server sql2008. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -218,5 +218,4 @@ function Test-DbaRepLatency { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaServerName.ps1 b/functions/Test-DbaServerName.ps1 index 114a66567d..fbacce207d 100644 --- a/functions/Test-DbaServerName.ps1 +++ b/functions/Test-DbaServerName.ps1 @@ -61,7 +61,7 @@ function Test-DbaServerName { Returns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016. If a Rename is required, it will also show Updatable, and Reasons if the server name is not updatable. -#> + #> [CmdletBinding()] [OutputType([System.Collections.ArrayList])] param ( @@ -180,5 +180,4 @@ function Test-DbaServerName { $serverInfo | Select-DefaultView -ExcludeProperty InstanceName, SqlInstance } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaSpn.ps1 b/functions/Test-DbaSpn.ps1 index 649f9f9733..04cd8f42ab 100644 --- a/functions/Test-DbaSpn.ps1 +++ b/functions/Test-DbaSpn.ps1 @@ -54,7 +54,7 @@ function Test-DbaSpn { Connects to a computer (SQLSERVERC) on a specified and queries WMI for all SQL instances and return "required" SPNs. It will then take each SPN it generates and query Active Directory to make sure the SPNs are set. Note that the credential you pass must have be a valid login with appropriate rights on the domain -#> + #> [cmdletbinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly", "", Justification = "PSSA Rule Ignored by BOH")] param ( @@ -288,5 +288,4 @@ function Test-DbaSpn { } } } -} - +} \ No newline at end of file diff --git a/functions/Test-DbaTempDbConfig.ps1 b/functions/Test-DbaTempDbConfig.ps1 index 25336abd3d..b80d7f56b7 100644 --- a/functions/Test-DbaTempDbConfig.ps1 +++ b/functions/Test-DbaTempDbConfig.ps1 @@ -56,7 +56,7 @@ function Test-DbaTempdbConfig { PS C:\> Get-DbaCmsRegServer -SqlInstance sqlserver2014a | Test-DbaTempdbConfig | Select-Object * | Out-GridView Checks tempdb configuration for a group of servers from SQL Server Central Management Server (CMS). Output includes all columns. Send output to GridView. -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -272,4 +272,4 @@ function Test-DbaTempdbConfig { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-SqlTempDbConfiguration Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaTempDbConfiguration } -} +} \ No newline at end of file diff --git a/functions/Test-DbaWindowsLogin.ps1 b/functions/Test-DbaWindowsLogin.ps1 index 5801785aa0..be6abce73a 100644 --- a/functions/Test-DbaWindowsLogin.ps1 +++ b/functions/Test-DbaWindowsLogin.ps1 @@ -59,7 +59,7 @@ function Test-DbaWindowsLogin { Tests all Domain logins excluding any that are from the testdomain -#> + #> [CmdletBinding()] param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] @@ -285,5 +285,4 @@ function Test-DbaWindowsLogin { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Test-DbaValidLogin } -} - +} \ No newline at end of file diff --git a/functions/Uninstall-DbaSqlWatch.ps1 b/functions/Uninstall-DbaSqlWatch.ps1 index 31d31a7dce..b8a2e59d68 100644 --- a/functions/Uninstall-DbaSqlWatch.ps1 +++ b/functions/Uninstall-DbaSqlWatch.ps1 @@ -42,7 +42,7 @@ Function Uninstall-DbaSqlWatch { Uninstall-DbaSqlWatch -SqlInstance server1 Deletes all user objects, agent jobs, and historical data associated with SqlWatch from the master database. - #> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [Parameter(Mandatory, ValueFromPipeline)] diff --git a/functions/Uninstall-DbaWatchUpdate.ps1 b/functions/Uninstall-DbaWatchUpdate.ps1 index b3d312e7a7..0e80552c3c 100644 --- a/functions/Uninstall-DbaWatchUpdate.ps1 +++ b/functions/Uninstall-DbaWatchUpdate.ps1 @@ -22,7 +22,7 @@ function Uninstall-DbaWatchUpdate { Removes the scheduled task created by Install-DbaWatchUpdate. -#> + #> process { if (([Environment]::OSVersion).Version.Major -lt 10) { Write-Message -Level Warning -Message "This command only supports Windows 10 and higher." @@ -70,5 +70,4 @@ function Uninstall-DbaWatchUpdate { Write-Message -Level Output -Message "All done!" } -} - +} \ No newline at end of file diff --git a/functions/Update-DbaServiceAccount.ps1 b/functions/Update-DbaServiceAccount.ps1 index 63306b2e46..e32ce25f6f 100644 --- a/functions/Update-DbaServiceAccount.ps1 +++ b/functions/Update-DbaServiceAccount.ps1 @@ -79,7 +79,7 @@ function Update-DbaServiceAccount { Configures SQL Server engine service on the machine sql1 to run under MyDomain\sqluser1. Will request user to input the account password. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = "ServiceName" )] param ( [parameter(ParameterSetName = "ServiceName")] @@ -237,5 +237,4 @@ function Update-DbaServiceAccount { } } } -} - +} \ No newline at end of file diff --git a/functions/Update-dbatools.ps1 b/functions/Update-dbatools.ps1 index 066c579c9c..5f57095be0 100644 --- a/functions/Update-dbatools.ps1 +++ b/functions/Update-dbatools.ps1 @@ -42,7 +42,7 @@ function Update-Dbatools { Updates dbatools to the current development branch. Deletes current copy and replaces it with latest from github. -#> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "It is the proper noun of the cmdlet")] param( @@ -65,4 +65,4 @@ function Update-Dbatools { & $InstallScript; } } -} +} \ No newline at end of file diff --git a/functions/Watch-DbaDbLogin.ps1 b/functions/Watch-DbaDbLogin.ps1 index 24688f0dd8..e9d3a93823 100644 --- a/functions/Watch-DbaDbLogin.ps1 +++ b/functions/Watch-DbaDbLogin.ps1 @@ -58,7 +58,7 @@ function Watch-DbaDbLogin { A list of servers is generated using database instance names within the SQL2014Clusters group on the Central Management Server SqlCms1. Using this list, the script enumerates all the processes and gathers login information and saves it to the table Dblogins in the DatabaseLogins database on sqlserver. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory)] @@ -157,5 +157,4 @@ function Watch-DbaDbLogin { end { Test-DbaDeprecation -DeprecatedOn "1.0.0" -EnableException:$false -Alias Watch-SqlDbLogin } -} - +} \ No newline at end of file diff --git a/functions/Watch-DbaUpdate.ps1 b/functions/Watch-DbaUpdate.ps1 index 1bb0f65608..c07fb25b54 100644 --- a/functions/Watch-DbaUpdate.ps1 +++ b/functions/Watch-DbaUpdate.ps1 @@ -24,7 +24,7 @@ function Watch-DbaUpdate { Watches the gallery for updates to dbatools. -#> + #> [cmdletbinding()] param() process { @@ -77,5 +77,4 @@ function Watch-DbaUpdate { Show-Notification -GalleryVersion $galleryVersion } } -} - +} \ No newline at end of file diff --git a/functions/Watch-DbaXESession.ps1 b/functions/Watch-DbaXESession.ps1 index f41a1e8f96..af665ef6b6 100644 --- a/functions/Watch-DbaXESession.ps1 +++ b/functions/Watch-DbaXESession.ps1 @@ -55,7 +55,7 @@ function Watch-DbaXESession { Exports live events to CSV. Ctrl-C may not not cancel out of this. The fastest way to do so is to stop the session. -#> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(ValueFromPipeline, ParameterSetName = "instance", Mandatory)] @@ -156,5 +156,4 @@ function Watch-DbaXESession { } } } -} - +} \ No newline at end of file diff --git a/functions/Write-DbaDataTable.ps1 b/functions/Write-DbaDataTable.ps1 index 4eb1c1641d..e57861746d 100644 --- a/functions/Write-DbaDataTable.ps1 +++ b/functions/Write-DbaDataTable.ps1 @@ -153,7 +153,7 @@ function Write-DbaDataTable { This is an example of the type conversion in action. All process properties are converted, including special types like TimeSpan. Script properties are resolved before the type conversion starts thanks to ConvertTo-DbaDataTable. -#> + #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] param ( [Parameter(Position = 0, Mandatory)] @@ -667,5 +667,4 @@ function Write-DbaDataTable { } Test-DbaDeprecation -DeprecatedOn 1.0.0 -Parameter RegularUser } -} - +} \ No newline at end of file diff --git a/install.ps1 b/install.ps1 index af1fe76135..c1fbba7afc 100644 --- a/install.ps1 +++ b/install.ps1 @@ -18,8 +18,7 @@ try { Update-Module dbatools -Erroraction Stop Write-LocalMessage -Message "Updated using the PowerShell Gallery" return -} -catch { +} catch { Write-LocalMessage -Message "dbatools was not installed by the PowerShell Gallery, continuing with web install." } @@ -38,8 +37,7 @@ $localpath = $module.ModuleBase if ($null -eq $localpath) { $localpath = "$HOME\Documents\WindowsPowerShell\Modules\dbatools" -} -else { +} else { Write-LocalMessage -Message "Updating current install" } @@ -51,13 +49,11 @@ try { Write-LocalMessage -Message "Looks like this installer is run from your GitHub Repo, defaulting to psmodulepath" $path = $localpath } - } - else { + } else { $path = $localpath } } -} -catch { +} catch { $path = $localpath } @@ -88,8 +84,7 @@ if (!(Test-Path -Path $path)) { try { Write-LocalMessage -Message "Creating directory: $path" New-Item -Path $path -ItemType Directory | Out-Null - } - catch { + } catch { throw "Can't create $Path. You may need to Run as Administrator: $_" } } @@ -97,8 +92,7 @@ if (!(Test-Path -Path $path)) { if ($beta) { $url = 'https://dbatools.io/devzip' $branch = "development" -} -else { +} else { $url = 'https://dbatools.io/zip' $branch = "master" } @@ -109,7 +103,7 @@ $zipfile = "$temp\dbatools.zip" Write-LocalMessage -Message "Downloading archive from github" try { (New-Object System.Net.WebClient).DownloadFile($url, $zipfile) -}catch { +} catch { try { #try with default proxy and usersettings Write-LocalMessage -Message "Probably using a proxy for internet access, trying default proxy settings" @@ -142,8 +136,7 @@ Copy-Item -Path "$Path\*" -Destination "$temp\dbatools-old" -ErrorAction Stop try { Write-LocalMessage -Message "2) Cleaning up installation directory" Remove-Item "$Path\*" -Recurse -Force -ErrorAction Stop -} -catch { +} catch { Write-LocalMessage -Message @" Failed to clean up installation directory, rolling back update. This usually has one of two causes: @@ -173,8 +166,7 @@ if (Get-Module dbatools) { Please restart PowerShell before working with dbatools. "@ -} -else { +} else { Import-Module "$path\dbatools.psd1" -Force Write-LocalMessage @" diff --git a/internal/configurations/configuration.ps1 b/internal/configurations/configuration.ps1 index 0c99dfee0e..4e27c7de89 100644 --- a/internal/configurations/configuration.ps1 +++ b/internal/configurations/configuration.ps1 @@ -132,8 +132,7 @@ $scriptBlock = { Enforced = $false Value = Convert-RegType -Value $item.Value } - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to interpret configuration entry from registry: $($item.Name)" -ErrorRecord $_ } } @@ -144,8 +143,7 @@ $scriptBlock = { Enforced = $false Value = Convert-RegType -Value $item.Value } - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to interpret configuration entry from registry: $($item.Name)" -ErrorRecord $_ } } @@ -156,8 +154,7 @@ $scriptBlock = { Enforced = $true Value = Convert-RegType -Value $item.Value } - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to interpret configuration entry from registry: $($item.Name)" -ErrorRecord $_ } } @@ -168,8 +165,7 @@ $scriptBlock = { Enforced = $true Value = Convert-RegType -Value $item.Value } - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to interpret configuration entry from registry: $($item.Name)" -ErrorRecord $_ } } @@ -180,8 +176,7 @@ $scriptBlock = { Set-DbatoolsConfig -Name $value.Name -Value $value.Value -EnableException [Sqlcollaborative.Dbatools.Configuration.ConfigurationHost]::Configurations[$value.Name.ToLower()].PolicySet = $true [Sqlcollaborative.Dbatools.Configuration.ConfigurationHost]::Configurations[$value.Name.ToLower()].PolicyEnforced = $value.Enforced - } - catch { } + } catch { } } [Sqlcollaborative.Dbatools.Configuration.ConfigurationHost]::ImportFromRegistryDone = $true @@ -198,8 +193,7 @@ $scriptBlock = { } if ($script:serialImport) { $scriptBlock.Invoke($global:dbatools_config) -} -else { +} else { $script:dbatoolsConfigRunspace = [System.Management.Automation.PowerShell]::Create() if ($script:dbatoolsConfigRunspace.Runspace.Name) { try { $script:dbatoolsConfigRunspace.Runspace.Name = "dbatools-import-config" } @@ -207,4 +201,4 @@ else { } $script:dbatoolsConfigRunspace.AddScript($scriptBlock).AddArgument($global:dbatools_config) $script:dbatoolsConfigRunspace.BeginInvoke() -} +} \ No newline at end of file diff --git a/internal/configurations/settings/assets.ps1 b/internal/configurations/settings/assets.ps1 index 7c77274a6c..6ddc94891e 100644 --- a/internal/configurations/settings/assets.ps1 +++ b/internal/configurations/settings/assets.ps1 @@ -3,5 +3,4 @@ This is designed for all online assets you need configurations for. #> # The default path where dbatools stores persistent data -Set-DbatoolsConfig -FullName 'assets.sqlbuildreference' -Value 'https://sqlcollaborative.github.io/assets/dbatools-buildref-index.json' -Initialize -Validation string -Handler { } -Description "The url where dbatools fetches the up to date buildreference index (e.g. for Get-DbaBuildReference)" - +Set-DbatoolsConfig -FullName 'assets.sqlbuildreference' -Value 'https://sqlcollaborative.github.io/assets/dbatools-buildref-index.json' -Initialize -Validation string -Handler { } -Description "The url where dbatools fetches the up to date buildreference index (e.g. for Get-DbaBuildReference)" \ No newline at end of file diff --git a/internal/configurations/settings/commands.ps1 b/internal/configurations/settings/commands.ps1 index a69b198ae7..7718dc3db4 100644 --- a/internal/configurations/settings/commands.ps1 +++ b/internal/configurations/settings/commands.ps1 @@ -2,4 +2,4 @@ Set-DbatoolsConfig -FullName 'commands.write-dbadatatable.timespantype' -Value 'TotalMilliseconds' -Initialize -Validation string -Description "When passing random objects at Write-DbaDataTable, it will convert them to a DataTable before writing it, using ConvertTo-DbaDataTable. This setting controls how Timespan objects are converted" Set-DbatoolsConfig -FullName 'commands.write-dbadatatable.sizetype' -Value 'Int64' -Initialize -Validation string -Description "When passing random objects at Write-DbaDataTable, it will convert them to a DataTable before writing it, using ConvertTo-DbaDataTable. This setting controls how Size objects are converted" Set-DbatoolsConfig -FullName 'commands.write-dbadatatable.ignorenull' -Value $false -Initialize -Validation bool -Description "When passing random objects at Write-DbaDataTable, it will convert them to a DataTable before writing it, using ConvertTo-DbaDataTable. This setting controls whether null objects will be ignored, rather than generating an empty row" -Set-DbatoolsConfig -FullName 'commands.write-dbadatatable.raw' -Value $false -Initialize -Validation bool -Description "When passing random objects at Write-DbaDataTable, it will convert them to a DataTable before writing it, using ConvertTo-DbaDataTable. This setting controls whether all properties will be stored as string (`$true) or as much as possible in their native type (`$false)" +Set-DbatoolsConfig -FullName 'commands.write-dbadatatable.raw' -Value $false -Initialize -Validation bool -Description "When passing random objects at Write-DbaDataTable, it will convert them to a DataTable before writing it, using ConvertTo-DbaDataTable. This setting controls whether all properties will be stored as string (`$true) or as much as possible in their native type (`$false)" \ No newline at end of file diff --git a/internal/configurations/settings/computermanagement.ps1 b/internal/configurations/settings/computermanagement.ps1 index 0cb4c65f8e..fb13cdbe64 100644 --- a/internal/configurations/settings/computermanagement.ps1 +++ b/internal/configurations/settings/computermanagement.ps1 @@ -28,4 +28,4 @@ Set-DbatoolsConfig -FullName 'ComputerManagement.Type.Disable.CimRM' -Value $fal Set-DbatoolsConfig -FullName 'ComputerManagement.Type.Disable.CimDCOM' -Value $false -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::DisableConnectionCimDCOM = $args[0] } -Description 'Globally disables all connections using Cim over DCOM' Set-DbatoolsConfig -FullName 'ComputerManagement.Type.Disable.WMI' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::DisableConnectionWMI = $args[0] } -Description 'Globally disables all connections using WMI' Set-DbatoolsConfig -FullName 'ComputerManagement.Type.Disable.PowerShellRemoting' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::DisableConnectionPowerShellRemoting = $args[0] } -Description 'Globally disables all connections using PowerShell Remoting' -#TODO: Implement Handler for type validation +#TODO: Implement Handler for type validation \ No newline at end of file diff --git a/internal/configurations/settings/formatting.ps1 b/internal/configurations/settings/formatting.ps1 index dea5dfdde6..2641f74242 100644 --- a/internal/configurations/settings/formatting.ps1 +++ b/internal/configurations/settings/formatting.ps1 @@ -14,4 +14,4 @@ Set-DbatoolsConfig -FullName 'Formatting.Disable.CustomDateTime' -Value $false - Set-DbatoolsConfig -FullName 'Formatting.Disable.CustomTimeSpan' -Value $false -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Utility.UtilityHost]::DisableCustomTimeSpan = $args[0] } -Description "Controls whether custom TimeSpan formats are used or whether to default back to DateTime standard." Set-DbatoolsConfig -FullName 'Formatting.size.style' -Value ([Sqlcollaborative.Dbatools.Utility.SizeStyle]::Dynamic) -Initialize -Validation sizestyle -Handler { [Sqlcollaborative.Dbatools.Utility.UtilityHost]::SizeStyle = $args[0] } -Description "Controls how size objects are displayed by default. Generally, their string representation is calculated to be user friendly (dynamic), can be updated to 'plain' number or a specific size. Can be overriden on a per-object basis." -Set-DbatoolsConfig -FullName 'Formatting.size.digits' -Value 2 -Initialize -Validation integer0to9 -Handler { [Sqlcollaborative.Dbatools.Utility.UtilityHost]::SizeDigits = $args[0] } -Description "How many digits are used when displaying a size object." +Set-DbatoolsConfig -FullName 'Formatting.size.digits' -Value 2 -Initialize -Validation integer0to9 -Handler { [Sqlcollaborative.Dbatools.Utility.UtilityHost]::SizeDigits = $args[0] } -Description "How many digits are used when displaying a size object." \ No newline at end of file diff --git a/internal/configurations/settings/import.ps1 b/internal/configurations/settings/import.ps1 index 322590a12b..239d619fd1 100644 --- a/internal/configurations/settings/import.ps1 +++ b/internal/configurations/settings/import.ps1 @@ -6,8 +6,7 @@ Set-DbatoolsConfig -Name 'Import.DoDotSource' -Value $false -Initialize -Validat else { $null = New-ItemProperty "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbatools\System" -Name DoDotSource -PropertyType DWORD -Value 0 -Force -ErrorAction Stop } # Scope Boundary exception: $cfg is defined in Set-DbatoolsConfig Register-DbatoolsConfig -Config $cfg - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to apply configuration 'Import.DoDotSource'" -ErrorRecord $_ -Target 'Import.DoDotSource' } } -Description "Causes the module to be imported using dotsourcing. Security policy may require it, also useful for debugging. This configuration setting persists across all PowerShell consoles for this user!" @@ -20,8 +19,7 @@ Set-DbatoolsConfig -Name 'Import.StrictSecurityMode' -Value $false -Initialize - else { $null = New-ItemProperty "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbatools\System" -Name StrictSecurityMode -PropertyType DWORD -Value 0 -Force -ErrorAction Stop } # Scope Boundary exception: $cfg is defined in Set-DbatoolsConfig Register-DbatoolsConfig -Config $cfg - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to apply configuration 'Import.StrictSecurityMode'" -ErrorRecord $_ -Target 'Import.StrictSecurityMode' } } -Description "Causes the module to import its components only from the module directory. This makes it harder to update the module, but may be required by security policy. This configuration setting persists across all PowerShell consoles for this user!" @@ -34,8 +32,7 @@ Set-DbatoolsConfig -Name 'Import.AlwaysBuildLibrary' -Value $false -Initialize - else { $null = New-ItemProperty "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbatools\System" -Name AlwaysBuildLibrary -PropertyType DWORD -Value 0 -Force -ErrorAction Stop } # Scope Boundary exception: $cfg is defined in Set-DbatoolsConfig Register-DbatoolsConfig -Config $cfg - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to apply configuration 'Import.AlwaysBuildLibrary'" -ErrorRecord $_ -Target 'Import.AlwaysBuildLibrary' } } -Description "Causes the module to compile the library from source on every import. Of interest for developers only, as this imposes a significant increase in import time. This configuration setting persists across all PowerShell consoles for this user!" @@ -48,8 +45,7 @@ Set-DbatoolsConfig -Name 'Import.SerialImport' -Value $false -Initialize -Valida else { $null = New-ItemProperty "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbatools\System" -Name SerialImport -PropertyType DWORD -Value 0 -Force -ErrorAction Stop } # Scope Boundary exception: $cfg is defined in Set-DbatoolsConfig Register-DbatoolsConfig -Config $cfg - } - catch { + } catch { Write-Message -Level Warning -Message "Failed to apply configuration 'Import.SerialImport'" -ErrorRecord $_ -Target 'Import.SerialImport' } -} -Description "Enabling this will cause the module to perform import in a serial manner, not parallelizing anything. This will impose a significant delay on import, but reduces the CPU impact during import. Setting this for an unattended script may be useful to avoid resource alerts. Can be set on script level by placing the following code in the first line: '`$dbatools_serialimport = `$true'. This configuration setting persists across all PowerShell consoles for this user!" +} -Description "Enabling this will cause the module to perform import in a serial manner, not parallelizing anything. This will impose a significant delay on import, but reduces the CPU impact during import. Setting this for an unattended script may be useful to avoid resource alerts. Can be set on script level by placing the following code in the first line: '`$dbatools_serialimport = `$true'. This configuration setting persists across all PowerShell consoles for this user!" \ No newline at end of file diff --git a/internal/configurations/settings/logging.ps1 b/internal/configurations/settings/logging.ps1 index 7f19870ae5..79b72ec467 100644 --- a/internal/configurations/settings/logging.ps1 +++ b/internal/configurations/settings/logging.ps1 @@ -16,5 +16,4 @@ Set-DbatoolsConfig -FullName 'Logging.MaxLogFileAge' -Value (New-TimeSpan -Days Set-DbatoolsConfig -FullName 'Logging.MessageLogFileEnabled' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Message.LogHost]::MessageLogFileEnabled = $args[0] } -Description "Governs, whether a log file for the system messages is written. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately." Set-DbatoolsConfig -FullName 'Logging.MessageLogEnabled' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Message.LogHost]::MessageLogEnabled = $args[0] } -Description "Governs, whether a log of recent messages is kept in memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately." Set-DbatoolsConfig -FullName 'Logging.ErrorLogFileEnabled' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Message.LogHost]::ErrorLogFileEnabled = $args[0] } -Description "Governs, whether log files for errors are written. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately." -Set-DbatoolsConfig -FullName 'Logging.ErrorLogEnabled' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Message.LogHost]::ErrorLogEnabled = $args[0] } -Description "Governs, whether a log of recent errors is kept in memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately." - +Set-DbatoolsConfig -FullName 'Logging.ErrorLogEnabled' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Message.LogHost]::ErrorLogEnabled = $args[0] } -Description "Governs, whether a log of recent errors is kept in memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately." \ No newline at end of file diff --git a/internal/configurations/settings/paths.ps1 b/internal/configurations/settings/paths.ps1 index c4623798af..02deabbde3 100644 --- a/internal/configurations/settings/paths.ps1 +++ b/internal/configurations/settings/paths.ps1 @@ -15,5 +15,4 @@ Set-DbatoolsConfig -FullName 'Path.DbatoolsLogPath' -Value "$env:AppData\PowerSh Set-DbatoolsConfig -FullName 'Path.TagCache' -Value "$ModuleRoot\bin\dbatools-index.json" -Initialize -Validation string -Handler { } -Description "The file in which dbatools stores the tag cache. That cache is used in Find-DbaCommand for more comfortable autocomplete" # The default Path for the server list (Get-DbaServerList, etc) -Set-DbatoolsConfig -FullName 'Path.Servers' -Value "$env:AppData\PowerShell\dbatools\servers.xml" -Initialize -Validation string -Handler { } -Description "The file in which dbatools stores the current user's server list, as managed by Get/Add/Update-DbaServerList" - +Set-DbatoolsConfig -FullName 'Path.Servers' -Value "$env:AppData\PowerShell\dbatools\servers.xml" -Initialize -Validation string -Handler { } -Description "The file in which dbatools stores the current user's server list, as managed by Get/Add/Update-DbaServerList" \ No newline at end of file diff --git a/internal/configurations/settings/remoting.ps1 b/internal/configurations/settings/remoting.ps1 index 6c36cde656..ed056456fb 100644 --- a/internal/configurations/settings/remoting.ps1 +++ b/internal/configurations/settings/remoting.ps1 @@ -2,4 +2,4 @@ Set-DbatoolsConfig -FullName 'PSRemoting.Sessions.ExpirationTimeout' -Value (New-TimeSpan -Minutes 5) -Initialize -Validation timespan -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::PSSessionTimeout = $args[0] } -Description 'The timeout interval for PowerShell remote sessions. Dbatools will kill sessions that have been idle for this amount of time.' # Disables session caching -Set-DbatoolsConfig -FullName 'PSRemoting.Sessions.Enable' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::PSSessionCacheEnabled = $args[0] } -Description 'Globally enables session caching for PowerShell remoting' +Set-DbatoolsConfig -FullName 'PSRemoting.Sessions.Enable' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::PSSessionCacheEnabled = $args[0] } -Description 'Globally enables session caching for PowerShell remoting' \ No newline at end of file diff --git a/internal/configurations/settings/sql.ps1 b/internal/configurations/settings/sql.ps1 index 018cb010df..12a41df866 100644 --- a/internal/configurations/settings/sql.ps1 +++ b/internal/configurations/settings/sql.ps1 @@ -1,2 +1,2 @@ # Controls the timeout on sql connects -Set-DbatoolsConfig -FullName 'sql.connection.timeout' -Value 15 -Initialize -Validation integerpositive -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::SqlConnectionTimeout = $args[0] } -Description "The number of seconds before sql server connection attempts are aborted" +Set-DbatoolsConfig -FullName 'sql.connection.timeout' -Value 15 -Initialize -Validation integerpositive -Handler { [Sqlcollaborative.Dbatools.Connection.ConnectionHost]::SqlConnectionTimeout = $args[0] } -Description "The number of seconds before sql server connection attempts are aborted" \ No newline at end of file diff --git a/internal/configurations/settings/tabexpansion.ps1 b/internal/configurations/settings/tabexpansion.ps1 index a2bd61d749..d848518cbc 100644 --- a/internal/configurations/settings/tabexpansion.ps1 +++ b/internal/configurations/settings/tabexpansion.ps1 @@ -9,8 +9,7 @@ Set-DbatoolsConfig -FullName 'TabExpansion.Disable' -Value $false -Initialize -V # Disable Async TEPP runspace if not needed if ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppAsyncDisabled -or [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppDisabled) { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces["dbatools-teppasynccache"].Stop() - } - else { + } else { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces["dbatools-teppasynccache"].Start() } } -Description 'Globally disables all TEPP functionality by dbatools' @@ -20,9 +19,8 @@ Set-DbatoolsConfig -FullName 'TabExpansion.Disable.Asynchronous' -Value $false - # Disable Async TEPP runspace if not needed if ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppAsyncDisabled -or [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppDisabled) { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces["dbatools-teppasynccache"].Stop() - } - else { + } else { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces["dbatools-teppasynccache"].Start() } } -Description 'Globally disables asynchronous TEPP updates in the background' -Set-DbatoolsConfig -FullName 'TabExpansion.Disable.Synchronous' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppSyncDisabled = $args[0] } -Description 'Globally disables synchronous TEPP updates, performed whenever connecting o the server. If this is not disabled, it will only perform updates that are fast to perform, in order to minimize performance impact. This may lead to some TEPP functionality loss if asynchronous updates are disabled.' +Set-DbatoolsConfig -FullName 'TabExpansion.Disable.Synchronous' -Value $true -Initialize -Validation bool -Handler { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppSyncDisabled = $args[0] } -Description 'Globally disables synchronous TEPP updates, performed whenever connecting o the server. If this is not disabled, it will only perform updates that are fast to perform, in order to minimize performance impact. This may lead to some TEPP functionality loss if asynchronous updates are disabled.' \ No newline at end of file diff --git a/internal/configurations/settings/userinteraction.ps1 b/internal/configurations/settings/userinteraction.ps1 index e68b3dfa9b..c52fc78462 100644 --- a/internal/configurations/settings/userinteraction.ps1 +++ b/internal/configurations/settings/userinteraction.ps1 @@ -30,4 +30,4 @@ Set-DbatoolsConfig -Name 'developer.mode.enable' -Value $false -Initialize -Vali # Message display style options Set-DbatoolsConfig -Name 'message.style.breadcrumbs' -Value $false -Initialize -Validation "bool" -Handler { [Sqlcollaborative.Dbatools.Message.MessageHost]::EnableMessageBreadcrumbs = $args[0] } -Description "Controls how messages are displayed. Enables Breadcrumb display, showing the entire callstack. Takes precedence over command name display." Set-DbatoolsConfig -Name 'message.style.functionname' -Value $true -Initialize -Validation "bool" -Handler { [Sqlcollaborative.Dbatools.Message.MessageHost]::EnableMessageDisplayCommand = $args[0] } -Description "Controls how messages are displayed. Enables command name, showing the name of the writing command. Is overwritten by enabling breadcrumbs." -Set-DbatoolsConfig -Name 'message.style.timestamp' -Value $true -Initialize -Validation "bool" -Handler { [Sqlcollaborative.Dbatools.Message.MessageHost]::EnableMessageTimestamp = $args[0] } -Description "Controls how messages are displayed. Enables timestamp display, including a timestamp in each message." +Set-DbatoolsConfig -Name 'message.style.timestamp' -Value $true -Initialize -Validation "bool" -Handler { [Sqlcollaborative.Dbatools.Message.MessageHost]::EnableMessageTimestamp = $args[0] } -Description "Controls how messages are displayed. Enables timestamp display, including a timestamp in each message." \ No newline at end of file diff --git a/internal/configurations/validation/bool.ps1 b/internal/configurations/validation/bool.ps1 index 94fa089093..78757558a2 100644 --- a/internal/configurations/validation/bool.ps1 +++ b/internal/configurations/validation/bool.ps1 @@ -14,8 +14,7 @@ Register-DbatoolsConfigValidation -Name "bool" -ScriptBlock { $Result.Success = $False return $Result } - } - catch { + } catch { $Result.Message = "Not a boolean: $Value" $Result.Success = $False return $Result @@ -24,4 +23,4 @@ Register-DbatoolsConfigValidation -Name "bool" -ScriptBlock { $Result.Value = $Value return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/consolecolor.ps1 b/internal/configurations/validation/consolecolor.ps1 index 3efb68caf0..f8b01621fe 100644 --- a/internal/configurations/validation/consolecolor.ps1 +++ b/internal/configurations/validation/consolecolor.ps1 @@ -19,4 +19,4 @@ Register-DbatoolsConfigValidation -Name "consolecolor" -ScriptBlock { $Result.Value = $color return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/datetime.ps1 b/internal/configurations/validation/datetime.ps1 index 8110145222..b8d3a6299b 100644 --- a/internal/configurations/validation/datetime.ps1 +++ b/internal/configurations/validation/datetime.ps1 @@ -19,4 +19,4 @@ Register-DbatoolsConfigValidation -Name "datetime" -ScriptBlock { $Result.Value = $DateTime return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/double.ps1 b/internal/configurations/validation/double.ps1 index 023c82c36f..7a998361b6 100644 --- a/internal/configurations/validation/double.ps1 +++ b/internal/configurations/validation/double.ps1 @@ -19,4 +19,4 @@ Register-DbatoolsConfigValidation -Name "double" -ScriptBlock { $Result.Value = $number return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/integer.ps1 b/internal/configurations/validation/integer.ps1 index acbb37641c..20cc906ab9 100644 --- a/internal/configurations/validation/integer.ps1 +++ b/internal/configurations/validation/integer.ps1 @@ -19,4 +19,4 @@ Register-DbatoolsConfigValidation -Name "integer" -ScriptBlock { $Result.Value = $number return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/integerpositive.ps1 b/internal/configurations/validation/integerpositive.ps1 index f97bb79a1f..f7535bbe70 100644 --- a/internal/configurations/validation/integerpositive.ps1 +++ b/internal/configurations/validation/integerpositive.ps1 @@ -25,4 +25,4 @@ Register-DbatoolsConfigValidation -Name "integerpositive" -ScriptBlock { $Result.Value = $number return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/long.ps1 b/internal/configurations/validation/long.ps1 index 00742e29a3..6a5327d5bb 100644 --- a/internal/configurations/validation/long.ps1 +++ b/internal/configurations/validation/long.ps1 @@ -19,4 +19,4 @@ Register-DbatoolsConfigValidation -Name "long" -ScriptBlock { $Result.Value = $number return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/sizestyle.ps1 b/internal/configurations/validation/sizestyle.ps1 index 49fdbdb945..88f628c344 100644 --- a/internal/configurations/validation/sizestyle.ps1 +++ b/internal/configurations/validation/sizestyle.ps1 @@ -4,14 +4,13 @@ Register-DbatoolsConfigValidation -Name "sizestyle" -ScriptBlock { ) $Result = New-Object PSObject -Property @{ - Success = $True - Value = $null - Message = "" + Success = $True + Value = $null + Message = "" } try { [Sqlcollaborative.Dbatools.Utility.SizeStyle]$style = $Value } - catch - { + catch { $Result.Message = "Not a size style: $Value" $Result.Success = $False return $Result @@ -20,5 +19,4 @@ Register-DbatoolsConfigValidation -Name "sizestyle" -ScriptBlock { $Result.Value = $style return $Result -} - +} \ No newline at end of file diff --git a/internal/configurations/validation/string.ps1 b/internal/configurations/validation/string.ps1 index 2e1a9ff430..f20f105ce1 100644 --- a/internal/configurations/validation/string.ps1 +++ b/internal/configurations/validation/string.ps1 @@ -12,8 +12,7 @@ Register-DbatoolsConfigValidation -Name "string" -ScriptBlock { try { # Seriously, this should work for almost anybody and anything [string]$data = $Value - } - catch { + } catch { $Result.Message = "Not a string: $Value" $Result.Success = $False return $Result @@ -34,4 +33,4 @@ Register-DbatoolsConfigValidation -Name "string" -ScriptBlock { $Result.Value = $data return $Result -} +} \ No newline at end of file diff --git a/internal/configurations/validation/timespan.ps1 b/internal/configurations/validation/timespan.ps1 index 7d094587dd..2b8af8d79b 100644 --- a/internal/configurations/validation/timespan.ps1 +++ b/internal/configurations/validation/timespan.ps1 @@ -19,4 +19,4 @@ Register-DbatoolsConfigValidation -Name "timespan" -ScriptBlock { $Result.Value = $timespan return $Result -} +} \ No newline at end of file diff --git a/internal/dynamicparams/alert.ps1 b/internal/dynamicparams/alert.ps1 index 9f5404a91e..70f33d3452 100644 --- a/internal/dynamicparams/alert.ps1 +++ b/internal/dynamicparams/alert.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["alert"][$FullSmoName] = $server.JobServer.Alerts.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/alertcategory.ps1 b/internal/dynamicparams/alertcategory.ps1 index 05404931f0..9fdff2f4ea 100644 --- a/internal/dynamicparams/alertcategory.ps1 +++ b/internal/dynamicparams/alertcategory.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["alertcategory"][$FullSmoName] = $server.JobServer.AlertCategories.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/audit.ps1 b/internal/dynamicparams/audit.ps1 index b1fe98c563..ae0a3335a1 100644 --- a/internal/dynamicparams/audit.ps1 +++ b/internal/dynamicparams/audit.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["audit"][$FullSmoName] = $server.Audits.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/auditspecification.ps1 b/internal/dynamicparams/auditspecification.ps1 index 91ebad82d0..7b3391a2dc 100644 --- a/internal/dynamicparams/auditspecification.ps1 +++ b/internal/dynamicparams/auditspecification.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["auditspecification"][$FullSmoName] = $server.AuditSpecifications.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/availabilitygroup.ps1 b/internal/dynamicparams/availabilitygroup.ps1 index 7c437d499a..c5f5103e75 100644 --- a/internal/dynamicparams/availabilitygroup.ps1 +++ b/internal/dynamicparams/availabilitygroup.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["availabilitygroup"][$FullSmoName] = $server.AvailabilityGroups.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/backupdevice.ps1 b/internal/dynamicparams/backupdevice.ps1 index 2242beff67..b695325161 100644 --- a/internal/dynamicparams/backupdevice.ps1 +++ b/internal/dynamicparams/backupdevice.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["backupdevice"][$FullSmoName] = $server.BackupDevices.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/config.ps1 b/internal/dynamicparams/config.ps1 index cf248d7164..dded41840e 100644 --- a/internal/dynamicparams/config.ps1 +++ b/internal/dynamicparams/config.ps1 @@ -68,5 +68,4 @@ $ScriptBlock = { } Register-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name configmodule -#endregion Tepp Data return: Module - +#endregion Tepp Data return: Module \ No newline at end of file diff --git a/internal/dynamicparams/configname.ps1 b/internal/dynamicparams/configname.ps1 index f526a14de2..065182136b 100644 --- a/internal/dynamicparams/configname.ps1 +++ b/internal/dynamicparams/configname.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -67,5 +65,4 @@ $ScriptBlock = { 'Properties').Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/credential.ps1 b/internal/dynamicparams/credential.ps1 index 1b12ab87b4..cd65b51069 100644 --- a/internal/dynamicparams/credential.ps1 +++ b/internal/dynamicparams/credential.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["credential"][$FullSmoName] = $server.Credentials.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/customerror.ps1 b/internal/dynamicparams/customerror.ps1 index 7617b35005..3cb66be8a7 100644 --- a/internal/dynamicparams/customerror.ps1 +++ b/internal/dynamicparams/customerror.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["customerror"][$FullSmoName] = $server.UserDefinedMessages.ID } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/database.ps1 b/internal/dynamicparams/database.ps1 index 5972ee84b8..c45651668a 100644 --- a/internal/dynamicparams/database.ps1 +++ b/internal/dynamicparams/database.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -65,5 +63,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["database"][$FullSmoName] = $server.Databases.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/endpoint.ps1 b/internal/dynamicparams/endpoint.ps1 index 6af6df830f..09e6edc15f 100644 --- a/internal/dynamicparams/endpoint.ps1 +++ b/internal/dynamicparams/endpoint.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["endpoint"][$FullSmoName] = ($server.Endpoints | Where-Object IsSystemObject -eq $false).Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/group.ps1 b/internal/dynamicparams/group.ps1 index 5304639d26..2a0309e767 100644 --- a/internal/dynamicparams/group.ps1 +++ b/internal/dynamicparams/group.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -67,5 +65,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["group"][$FullSmoName] = $cms.DatabaseEngineServerGroup.ServerGroups.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/instanceproperty.ps1 b/internal/dynamicparams/instanceproperty.ps1 index 24abc5b4af..63a88f540f 100644 --- a/internal/dynamicparams/instanceproperty.ps1 +++ b/internal/dynamicparams/instanceproperty.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -50,8 +49,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -64,5 +62,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["instanceproperty"][$FullSmoName] = $server.Information.Properties.Name + $server.UserOptions.Properties.Name + $server.Settings.Properties.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/job.ps1 b/internal/dynamicparams/job.ps1 index 3fe8e575e4..0ebd006860 100644 --- a/internal/dynamicparams/job.ps1 +++ b/internal/dynamicparams/job.ps1 @@ -29,8 +29,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -47,8 +46,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -61,5 +59,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["job"][$FullSmoName] = $server.JobServer.Jobs.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/jobcategory.ps1 b/internal/dynamicparams/jobcategory.ps1 index 3de50676e2..bde7c0e18f 100644 --- a/internal/dynamicparams/jobcategory.ps1 +++ b/internal/dynamicparams/jobcategory.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["jobcategory"][$FullSmoName] = $server.JobServer.JobCategories.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/linkedserver.ps1 b/internal/dynamicparams/linkedserver.ps1 index 663ac51acc..59d4af4f9b 100644 --- a/internal/dynamicparams/linkedserver.ps1 +++ b/internal/dynamicparams/linkedserver.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["linkedserver"][$FullSmoName] = $server.LinkedServers.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/login.ps1 b/internal/dynamicparams/login.ps1 index 47c6dc1e65..32da5cfae6 100644 --- a/internal/dynamicparams/login.ps1 +++ b/internal/dynamicparams/login.ps1 @@ -29,8 +29,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -47,8 +46,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -61,5 +59,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["login"][$FullSmoName] = $server.Logins.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/mailaccount.ps1 b/internal/dynamicparams/mailaccount.ps1 index 8bdcb3dda9..1a062a6e82 100644 --- a/internal/dynamicparams/mailaccount.ps1 +++ b/internal/dynamicparams/mailaccount.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["mailaccount"][$FullSmoName] = $server.Mail.Accounts.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/mailprofile.ps1 b/internal/dynamicparams/mailprofile.ps1 index 2f5e61acca..2c31b4badb 100644 --- a/internal/dynamicparams/mailprofile.ps1 +++ b/internal/dynamicparams/mailprofile.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["mailprofile"][$FullSmoName] = $server.Mail.Profiles.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/mailserver.ps1 b/internal/dynamicparams/mailserver.ps1 index 63717f221b..ffebfe9687 100644 --- a/internal/dynamicparams/mailserver.ps1 +++ b/internal/dynamicparams/mailserver.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["mailserver"][$FullSmoName] = $server.Mail.Accounts.MailServers.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/operator.ps1 b/internal/dynamicparams/operator.ps1 index 09552a52ab..1752bf203f 100644 --- a/internal/dynamicparams/operator.ps1 +++ b/internal/dynamicparams/operator.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -50,8 +49,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -64,5 +62,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["operator"][$FullSmoName] = $server.JobServer.Operators.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/operatorcategory.ps1 b/internal/dynamicparams/operatorcategory.ps1 index 73e7fbf9e9..8bef908e27 100644 --- a/internal/dynamicparams/operatorcategory.ps1 +++ b/internal/dynamicparams/operatorcategory.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["operatorcategory"][$FullSmoName] = $server.JobServer.OperatorCategories.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/perfmontemplate.ps1 b/internal/dynamicparams/perfmontemplate.ps1 index 6044fb1f17..35afd30508 100644 --- a/internal/dynamicparams/perfmontemplate.ps1 +++ b/internal/dynamicparams/perfmontemplate.ps1 @@ -21,4 +21,4 @@ $ScriptBlock = { } Register-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name perfmontemplate -#endregion Tepp Data return +#endregion Tepp Data return \ No newline at end of file diff --git a/internal/dynamicparams/processHostname.ps1 b/internal/dynamicparams/processHostname.ps1 index 61535187f6..7e0e8fa791 100644 --- a/internal/dynamicparams/processHostname.ps1 +++ b/internal/dynamicparams/processHostname.ps1 @@ -25,13 +25,10 @@ $scriptBlock = { $instance.EnumProcesses().Host | Select-Object -Unique | Where-DbaObject -Like "$wordToComplete*" | ForEach-Object { if (-not ([string]::IsNullOrWhiteSpace($_))) { New-DbaTeppCompletionResult -CompletionText $_ -ToolTip $_ } } - } - catch { + } catch { return - } - finally { + } finally { } } -Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name processhostname - +Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name processhostname \ No newline at end of file diff --git a/internal/dynamicparams/processProgram.ps1 b/internal/dynamicparams/processProgram.ps1 index 75cc40ffd1..7b9699ce9e 100644 --- a/internal/dynamicparams/processProgram.ps1 +++ b/internal/dynamicparams/processProgram.ps1 @@ -25,13 +25,10 @@ $scriptBlock = { $instance.EnumProcesses().Program | Select-Object -Unique | Where-DbaObject -Like "$wordToComplete*" | ForEach-Object { if (-not ([string]::IsNullOrWhiteSpace($_))) { New-DbaTeppCompletionResult -CompletionText $_ -ToolTip $_ } } - } - catch { + } catch { return - } - finally { + } finally { } } -Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name processprogram - +Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name processprogram \ No newline at end of file diff --git a/internal/dynamicparams/processSpid.ps1 b/internal/dynamicparams/processSpid.ps1 index 6eafa6cd75..683095456d 100644 --- a/internal/dynamicparams/processSpid.ps1 +++ b/internal/dynamicparams/processSpid.ps1 @@ -25,13 +25,10 @@ $scriptBlock = { $instance.EnumProcesses().Spid | Select-Object -Unique | Where-DbaObject -Like "$wordToComplete*" | ForEach-Object { if (-not ([string]::IsNullOrWhiteSpace($_))) { New-DbaTeppCompletionResult -CompletionText $_ -ToolTip $_ } } - } - catch { + } catch { return - } - finally { + } finally { } } -Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name processspid - +Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name processspid \ No newline at end of file diff --git a/internal/dynamicparams/proxyaccount.ps1 b/internal/dynamicparams/proxyaccount.ps1 index e01c547fd0..bb83b821a2 100644 --- a/internal/dynamicparams/proxyaccount.ps1 +++ b/internal/dynamicparams/proxyaccount.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["proxyaccount"][$FullSmoName] = $server.JobServer.ProxyAccounts.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/resourcepool.ps1 b/internal/dynamicparams/resourcepool.ps1 index 9b6fcf22df..4c493e8fda 100644 --- a/internal/dynamicparams/resourcepool.ps1 +++ b/internal/dynamicparams/resourcepool.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["resourcepool"][$FullSmoName] = ($server.ResourceGovernor.ResourcePools | Where-Object Name -NotIn 'internal', 'default').Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/schedule.ps1 b/internal/dynamicparams/schedule.ps1 index 2d2e048a3a..a2a4997c43 100644 --- a/internal/dynamicparams/schedule.ps1 +++ b/internal/dynamicparams/schedule.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["schedule"][$FullSmoName] = $server.JobServer.SharedSchedules.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/servertrigger.ps1 b/internal/dynamicparams/servertrigger.ps1 index 6c90170f54..a3afb98f57 100644 --- a/internal/dynamicparams/servertrigger.ps1 +++ b/internal/dynamicparams/servertrigger.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -66,5 +64,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["servertrigger"][$FullSmoName] = $server.Triggers.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/session.ps1 b/internal/dynamicparams/session.ps1 index 2ea36f069d..5c9beeada0 100644 --- a/internal/dynamicparams/session.ps1 +++ b/internal/dynamicparams/session.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -51,8 +50,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -70,5 +68,4 @@ $ScriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["session"][$FullSmoName] = $xesessions.Name } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/snapshot.ps1 b/internal/dynamicparams/snapshot.ps1 index d0a265c4c7..d8dbd4391f 100644 --- a/internal/dynamicparams/snapshot.ps1 +++ b/internal/dynamicparams/snapshot.ps1 @@ -33,8 +33,7 @@ $ScriptBlock = { try { [DbaInstanceParameter]$parServer = $server | Select-Object -First 1 - } - catch { + } catch { return } @@ -50,8 +49,7 @@ $ScriptBlock = { New-DbaTeppCompletionResult -CompletionText $name -ToolTip $name } return - } - catch { + } catch { return } } @@ -65,5 +63,4 @@ $ScriptBlock = { else { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Cache["snapshot"][$FullSmoName] = ($server.Databases | Where-Object IsDatabaseSnapShot).Name } } Register-DbaTeppInstanceCacheBuilder -ScriptBlock $ScriptBlock -#endregion Update Cache - +#endregion Update Cache \ No newline at end of file diff --git a/internal/dynamicparams/sqlinstance.ps1 b/internal/dynamicparams/sqlinstance.ps1 index 507fa314ed..4244b24929 100644 --- a/internal/dynamicparams/sqlinstance.ps1 +++ b/internal/dynamicparams/sqlinstance.ps1 @@ -24,5 +24,4 @@ $ScriptBlock = { } } Register-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name "sqlinstance" -#endregion Tepp Data return - +#endregion Tepp Data return \ No newline at end of file diff --git a/internal/dynamicparams/tag.ps1 b/internal/dynamicparams/tag.ps1 index cc2c8a0705..f8d0efcd3c 100644 --- a/internal/dynamicparams/tag.ps1 +++ b/internal/dynamicparams/tag.ps1 @@ -86,5 +86,4 @@ $ScriptBlock = { } } -Register-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name "tag" - +Register-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name "tag" \ No newline at end of file diff --git a/internal/dynamicparams/xesessiontemplate.ps1 b/internal/dynamicparams/xesessiontemplate.ps1 index 07de9e648d..8265e1266b 100644 --- a/internal/dynamicparams/xesessiontemplate.ps1 +++ b/internal/dynamicparams/xesessiontemplate.ps1 @@ -21,4 +21,4 @@ $ScriptBlock = { } Register-DbaTeppScriptblock -ScriptBlock $ScriptBlock -Name xesessiontemplate -#endregion Tepp Data return +#endregion Tepp Data return \ No newline at end of file diff --git a/internal/functions/Connect-AsServer.ps1 b/internal/functions/Connect-AsServer.ps1 index 956338fb00..52b5f0d2b0 100644 --- a/internal/functions/Connect-AsServer.ps1 +++ b/internal/functions/Connect-AsServer.ps1 @@ -21,7 +21,7 @@ License: MIT https://opensource.org/licenses/MIT Connect-AsServer -AsServer localhost Connects to SSAS on the local server -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -57,6 +57,4 @@ Connects to SSAS on the local server } return $server -} - - +} \ No newline at end of file diff --git a/internal/functions/Connect-ReplicationDB.ps1 b/internal/functions/Connect-ReplicationDB.ps1 index 1947e4a9d8..0a74f48c33 100644 --- a/internal/functions/Connect-ReplicationDB.ps1 +++ b/internal/functions/Connect-ReplicationDB.ps1 @@ -15,5 +15,4 @@ function Connect-ReplicationDB { } return $repDB -} - +} \ No newline at end of file diff --git a/internal/functions/Connect-SqlInstance.ps1 b/internal/functions/Connect-SqlInstance.ps1 index 735870dccf..5c949de139 100644 --- a/internal/functions/Connect-SqlInstance.ps1 +++ b/internal/functions/Connect-SqlInstance.ps1 @@ -54,7 +54,7 @@ function Connect-SqlInstance { Connect-SqlInstance -SqlInstance sql2014 Connect to the Server sql2014 with native credentials. - #> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidDefaultValueSwitchParameter", "")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingEmptyCatchBlock", "")] @@ -347,5 +347,4 @@ function Connect-SqlInstance { } return $server #endregion Input Object was anything else -} - +} \ No newline at end of file diff --git a/internal/functions/Convert-ByteToHexString.ps1 b/internal/functions/Convert-ByteToHexString.ps1 index 0784d2cd8b..ce91eaae0c 100644 --- a/internal/functions/Convert-ByteToHexString.ps1 +++ b/internal/functions/Convert-ByteToHexString.ps1 @@ -26,10 +26,9 @@ function Convert-ByteToHexString { Convert-ByteToHexString 18,52 Returns hex string '0x1234' -#> + #> param ([byte[]]$InputObject) $outString = "0x" $InputObject | ForEach-Object { $outString += ("{0:X}" -f $_).PadLeft(2, "0") } $outString -} - +} \ No newline at end of file diff --git a/internal/functions/Convert-DbVersionToSqlVersion.ps1 b/internal/functions/Convert-DbVersionToSqlVersion.ps1 index ff7b06d170..29cee58569 100644 --- a/internal/functions/Convert-DbVersionToSqlVersion.ps1 +++ b/internal/functions/Convert-DbVersionToSqlVersion.ps1 @@ -14,7 +14,7 @@ Convert-DbVersionToSqlVersion -dbversion 856 Returns "SQL Server vNext CTP1" -#> + #> param ( [string]$dbversion ) @@ -39,6 +39,4 @@ Returns "SQL Server vNext CTP1" } return $dbversion -} - - +} \ No newline at end of file diff --git a/internal/functions/Convert-DbaLsn.ps1 b/internal/functions/Convert-DbaLsn.ps1 index fa0b8147f5..26127834b0 100644 --- a/internal/functions/Convert-DbaLsn.ps1 +++ b/internal/functions/Convert-DbaLsn.ps1 @@ -17,7 +17,7 @@ function Convert-DbaLSN { Will return object $Output with the following value $Output.HexLSN = 0000002f:000044aa:002b $Output.NumbericLSN = - #> + #> [CmdletBinding()] param( [string]$LSN, diff --git a/internal/functions/Convert-DbaMessageException.ps1 b/internal/functions/Convert-DbaMessageException.ps1 index 037ea23264..a51213dd5a 100644 --- a/internal/functions/Convert-DbaMessageException.ps1 +++ b/internal/functions/Convert-DbaMessageException.ps1 @@ -2,44 +2,44 @@ function Convert-DbaMessageException { <# .SYNOPSIS Transforms the Exception input to the message system. - + .DESCRIPTION Transforms the Exception input to the message system. - + If there is an exception running a transformation scriptblock, it will log the error in the transform error queue and return the original object instead. - + .PARAMETER Exception The input Exception object, that might have to be transformed (may not either) - + .PARAMETER FunctionName The function writing the message - + .PARAMETER ModuleName The module, that the function writing the message is part of - + .EXAMPLE PS C:\> Convert-DbaMessageException -Exception $Exception -FunctionName 'Get-Test' -ModuleName 'MyModule' - + Checks internal storage for definitions that require a Exception transform, and either returns the original object or the transformed object. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] $Exception, - + [Parameter(Mandatory)] [string] $FunctionName, - + [Parameter(Mandatory)] [string] $ModuleName ) - + if ($null -eq $Exception) { return } - + $typeName = $Exception.GetType().FullName.ToLower() - + if ([Sqlcollaborative.Dbatools.Message.MessageHost]::ExceptionTransforms.ContainsKey($typeName)) { $scriptBlock = [Sqlcollaborative.Dbatools.Message.MessageHost]::ExceptionTransforms[$typeName] try { @@ -50,7 +50,7 @@ function Convert-DbaMessageException { return $Exception } } - + if ($transform = [Sqlcollaborative.Dbatools.Message.MessageHost]::ExceptionTransformList.Get($typeName, $ModuleName, $FunctionName)) { try { $tempException = $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create($transform.ScriptBlock.ToString())), $null, $Exception) @@ -60,7 +60,6 @@ function Convert-DbaMessageException { return $Exception } } - - return $Exception -} + return $Exception +} \ No newline at end of file diff --git a/internal/functions/Convert-DbaMessageLevel.ps1 b/internal/functions/Convert-DbaMessageLevel.ps1 index adcbfa8467..18732dd9f0 100644 --- a/internal/functions/Convert-DbaMessageLevel.ps1 +++ b/internal/functions/Convert-DbaMessageLevel.ps1 @@ -2,75 +2,74 @@ function Convert-DbaMessageLevel { <# .SYNOPSIS Processes the effective message level of a message - + .DESCRIPTION Processes the effective message level of a message - Applies level decrements - Applies message level modifiers - + .PARAMETER OriginalLevel The level the message was originally written to - + .PARAMETER FromStopFunction Whether the message was passed through Stop-PSFFunction first. This is used to increment the automatic message level decrement counter by 1 (so it ignores the fact, that it was passed through Stop-PSFFunction). The automatic message level decrement functionality allows users to make nested commands' messages be less verbose. - + .PARAMETER Tags The tags that were added to the message - + .PARAMETER FunctionName The function that wrote the message. - + .PARAMETER ModuleName The module the function writing the message comes from. - + .EXAMPLE Convert-DbaMessageLevel -OriginalLevel $Level -FromStopFunction $fromStopFunction -Tags $Tag -FunctionName $FunctionName -ModuleName $ModuleName - + This will convert the original level of $Level based on the transformation rules for levels. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] [Sqlcollaborative.Dbatools.Message.MessageLevel] $OriginalLevel, - + [Parameter(Mandatory)] [bool] $FromStopFunction, - + [Parameter(Mandatory)] [AllowNull()] [string[]] $Tags, - + [Parameter(Mandatory)] [string] $FunctionName, - + [Parameter(Mandatory)] [string] $ModuleName ) - + $number = $OriginalLevel.value__ - + if ([Sqlcollaborative.Dbatools.Message.MessageHost]::NestedLevelDecrement -gt 0) { $depth = (Get-PSCallStack).Count - 3 if ($FromStopFunction) { $depth = $depth - 1 } $number = $number + $depth * ([Sqlcollaborative.Dbatools.Message.MessageHost]::NestedLevelDecrement) } - + foreach ($modifier in [Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers.Values) { if ($modifier.AppliesTo($FunctionName, $ModuleName, $Tags)) { $number = $number + $modifier.Modifier } } - + # Finalize number and return if ($number -lt 1) { $number = 1 } if ($number -gt 9) { $number = 9 } return ([Sqlcollaborative.Dbatools.Message.MessageLevel]$number) -} - +} \ No newline at end of file diff --git a/internal/functions/Convert-DbaMessageTarget.ps1 b/internal/functions/Convert-DbaMessageTarget.ps1 index d729c528d5..246acdbe5f 100644 --- a/internal/functions/Convert-DbaMessageTarget.ps1 +++ b/internal/functions/Convert-DbaMessageTarget.ps1 @@ -2,44 +2,44 @@ function Convert-DbaMessageTarget { <# .SYNOPSIS Transforms the target input to the message system. - + .DESCRIPTION Transforms the target input to the message system. - + If there is an exception running a transformation scriptblock, it will log the error in the transform error queue and return the original object instead. - + .PARAMETER Target The input target object, that might have to be transformed (may not either) - + .PARAMETER FunctionName The function writing the message - + .PARAMETER ModuleName The module, that the function writing the message is part of - + .EXAMPLE PS C:\> Convert-DbaMessageTarget -Target $Target -FunctionName 'Get-Test' -ModuleName 'MyModule' - + Checks internal storage for definitions that require a target transform, and either returns the original object or the transformed object. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] $Target, - + [Parameter(Mandatory)] [string] $FunctionName, - + [Parameter(Mandatory)] [string] $ModuleName ) - + if ($null -eq $Target) { return } - + $typeName = $Target.GetType().FullName.ToLower() - + if ([Sqlcollaborative.Dbatools.Message.MessageHost]::TargetTransforms.ContainsKey($typeName)) { $scriptBlock = [Sqlcollaborative.Dbatools.Message.MessageHost]::TargetTransforms[$typeName] try { @@ -50,7 +50,7 @@ function Convert-DbaMessageTarget { return $Target } } - + if ($transform = [Sqlcollaborative.Dbatools.Message.MessageHost]::TargetTransformlist.Get($typeName, $ModuleName, $FunctionName)) { try { $tempTarget = $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create($transform.ScriptBlock.ToString())), $null, $Target) @@ -60,7 +60,6 @@ function Convert-DbaMessageTarget { return $Target } } - - return $Target -} + return $Target +} \ No newline at end of file diff --git a/internal/functions/Convert-DbaTimelineStatusColor.ps1 b/internal/functions/Convert-DbaTimelineStatusColor.ps1 index 1acb93a49c..f41b84896a 100644 --- a/internal/functions/Convert-DbaTimelineStatusColor.ps1 +++ b/internal/functions/Convert-DbaTimelineStatusColor.ps1 @@ -52,5 +52,4 @@ function Convert-DbaTimelineStatusColor { default {"#FF00CC"} } return $out -} - +} \ No newline at end of file diff --git a/internal/functions/Convert-HexStringToByte.ps1 b/internal/functions/Convert-HexStringToByte.ps1 index 6af8731314..3c58a7ee9d 100644 --- a/internal/functions/Convert-HexStringToByte.ps1 +++ b/internal/functions/Convert-HexStringToByte.ps1 @@ -26,7 +26,7 @@ function Convert-HexStringToByte { Convert-HexStringToByte '1234' Returns byte[] object [byte[]]@(18,52) -#> + #> param ( [string]$InputObject ) @@ -34,5 +34,4 @@ function Convert-HexStringToByte { if ($hexString.Length % 2 -eq 1) { $hexString = '0' + $hexString } [byte[]]$outByte = $null; $outByte += 0 .. (($hexString.Length) / 2 - 1) | ForEach-Object { [Int16]::Parse($hexString.Substring($_ * 2, 2), 'HexNumber') } Return $outByte -} - +} \ No newline at end of file diff --git a/internal/functions/ConvertTo-JsDate.ps1 b/internal/functions/ConvertTo-JsDate.ps1 index 1e583f9601..e2ac5cc2cf 100644 --- a/internal/functions/ConvertTo-JsDate.ps1 +++ b/internal/functions/ConvertTo-JsDate.ps1 @@ -32,7 +32,7 @@ function ConvertTo-JsDate { ConvertTo-JsDate (Get-Date) Returned output: new Date(2018, 7, 14, 07, 40, 42) - #> + #> [CmdletBinding()] param ( @@ -42,5 +42,4 @@ function ConvertTo-JsDate { ) [string]$out = "new Date($(Get-Date $InputDate -format "yyyy"), $($(Get-Date $InputDate -format "MM")-1), $(Get-Date $InputDate -format "dd"), $(Get-Date $InputDate -format "HH"), $(Get-Date $InputDate -format "mm"), $(Get-Date $InputDate -format "ss"))" return $out -} - +} \ No newline at end of file diff --git a/internal/functions/Disconnect-Regserver.ps1 b/internal/functions/Disconnect-Regserver.ps1 index 4743ef976c..ef973fe88c 100644 --- a/internal/functions/Disconnect-Regserver.ps1 +++ b/internal/functions/Disconnect-Regserver.ps1 @@ -5,5 +5,4 @@ function Disconnect-Regserver ($Server) { if ($server.ServerConnection) { $server.ServerConnection.Disconnect() } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-BackupAncientHistory.ps1 b/internal/functions/Get-BackupAncientHistory.ps1 index e8c6773f66..1064e0d9eb 100644 --- a/internal/functions/Get-BackupAncientHistory.ps1 +++ b/internal/functions/Get-BackupAncientHistory.ps1 @@ -22,7 +22,7 @@ function Get-BackupAncientHistory { Copyright: (c) 2018 by dbatools, licensed under MIT License: MIT https://opensource.org/licenses/MIT - #> + #> [CmdletBinding(DefaultParameterSetName = "Default")] param ( [parameter(Mandatory)] @@ -182,5 +182,4 @@ function Get-BackupAncientHistory { } END {} -} - +} \ No newline at end of file diff --git a/internal/functions/Get-CodePage.ps1 b/internal/functions/Get-CodePage.ps1 index 1f1165a1e4..0e68fa7e98 100644 --- a/internal/functions/Get-CodePage.ps1 +++ b/internal/functions/Get-CodePage.ps1 @@ -13,7 +13,7 @@ function Get-CodePage { Get-CodePage 1252 Returns a pscustomobject with id, alias and name - #> + #> [CmdletBinding()] param ( [int]$id @@ -23,6 +23,4 @@ function Get-CodePage { $IncludeProps = 'CodePage', 'BodyName', 'EncodingName', 'HeaderName', 'WebName', 'IsSingleByte' Select-DefaultView -InputObject $encoding -Property $IncludeProps } -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-DBAServiceErrorMessage.ps1 b/internal/functions/Get-DBAServiceErrorMessage.ps1 index 48610e1326..36996b7c90 100644 --- a/internal/functions/Get-DBAServiceErrorMessage.ps1 +++ b/internal/functions/Get-DBAServiceErrorMessage.ps1 @@ -3,7 +3,7 @@ function Get-DbaServiceErrorMessage { .SYNOPSIS Internal function. Returns the list of error code messages for Windows service management. -#> + #> param( [parameter(ValueFromPipeline, Position = 1)] [int]$ErrorNumber @@ -39,5 +39,4 @@ function Get-DbaServiceErrorMessage { } else { $returnCodes } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-DbaADObject.ps1 b/internal/functions/Get-DbaADObject.ps1 index 989bd081bc..8acdf1eef2 100644 --- a/internal/functions/Get-DbaADObject.ps1 +++ b/internal/functions/Get-DbaADObject.ps1 @@ -78,7 +78,7 @@ function Get-DbaADObject { Searches in the contoso domain for a ctrlb user, suppressing all error messages and throw exceptions that can be caught instead -#> + #> [CmdletBinding()] param ( [string[]]$ADObject, @@ -188,7 +188,4 @@ function Get-DbaADObject { } } } -} - - - +} \ No newline at end of file diff --git a/internal/functions/Get-DbaDbPhysicalFile.ps1 b/internal/functions/Get-DbaDbPhysicalFile.ps1 index cc44920db2..41185bba5f 100644 --- a/internal/functions/Get-DbaDbPhysicalFile.ps1 +++ b/internal/functions/Get-DbaDbPhysicalFile.ps1 @@ -20,7 +20,7 @@ function Get-DbaDbPhysicalFile { dbatools PowerShell module (https://dbatools.io, clemaire@gmail.com) Copyright: (c) 2018 by dbatools, licensed under MIT License: MIT https://opensource.org/licenses/MIT - #> + #> [CmdletBinding()] param( [parameter(Mandatory)] @@ -47,5 +47,4 @@ function Get-DbaDbPhysicalFile { } catch { throw "Error enumerating files" } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-DbaFileStreamFolder.ps1 b/internal/functions/Get-DbaFileStreamFolder.ps1 index a2227c1d2a..1c5daba9b2 100644 --- a/internal/functions/Get-DbaFileStreamFolder.ps1 +++ b/internal/functions/Get-DbaFileStreamFolder.ps1 @@ -38,7 +38,7 @@ function Get-DbaFileStreamFolder { Website: https://dbatools.io Copyright: (c) 2018 by dbatools, licensed under MIT License: MIT https://opensource.org/licenses/MIT - #> + #> param ( [Alias("ServerInstance", "SqlServer")] [DbaInstanceParameter]$SqlInstance, @@ -79,4 +79,4 @@ function Get-DbaFileStreamFolder { } END {} -} +} \ No newline at end of file diff --git a/internal/functions/Get-DbaMessageLevelModifier.ps1 b/internal/functions/Get-DbaMessageLevelModifier.ps1 index f648532b7f..624c2deff1 100644 --- a/internal/functions/Get-DbaMessageLevelModifier.ps1 +++ b/internal/functions/Get-DbaMessageLevelModifier.ps1 @@ -2,32 +2,31 @@ function Get-DbaMessageLevelModifier { <# .SYNOPSIS Returns all registered message level modifiers with similar name. - + .DESCRIPTION Returns all registered message level modifiers with similar name. - + Message level modifiers are created using New-DbaMessageLevelModifier and allow dynamically modifying the actual message level written by commands. - + .PARAMETER Name Default: "*" A name filter - only commands that are similar to the filter will be returned. - + .EXAMPLE PS C:\> Get-DbaMessageLevelModifier - + Returns all message level filters - + .EXAMPLE PS C:\> Get-DbaMessageLevelModifier -Name "mymodule.*" - + Returns all message level filters that start with "mymodule." -#> + #> [CmdletBinding()] param ( [string] $Name = "*" ) - - ([Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers.Values) | Where-Object Name -Like $Name -} + ([Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers.Values) | Where-Object Name -Like $Name +} \ No newline at end of file diff --git a/internal/functions/Get-DbaPathSep.ps1 b/internal/functions/Get-DbaPathSep.ps1 index 18f9220e90..16f44de9a3 100644 --- a/internal/functions/Get-DbaPathSep.ps1 +++ b/internal/functions/Get-DbaPathSep.ps1 @@ -1,7 +1,7 @@ function Get-DbaPathSep { <# Gets the instance path separator, if exists, or return the default one - #> + #> [CmdletBinding()] param ( [object]$Server diff --git a/internal/functions/Get-DbaReportingService.ps1 b/internal/functions/Get-DbaReportingService.ps1 index a7aa6eee95..a818abdb70 100644 --- a/internal/functions/Get-DbaReportingService.ps1 +++ b/internal/functions/Get-DbaReportingService.ps1 @@ -69,7 +69,7 @@ function Get-DbaReportingService { Calls a Restart method for each Reporting service on computer sql1. -#> + #> [CmdletBinding()] param ( [parameter(ValueFromPipeline, Position = 1)] diff --git a/internal/functions/Get-DbaRunspace.ps1 b/internal/functions/Get-DbaRunspace.ps1 index b89bc780ae..77d157740a 100644 --- a/internal/functions/Get-DbaRunspace.ps1 +++ b/internal/functions/Get-DbaRunspace.ps1 @@ -19,7 +19,7 @@ function Get-DbaRunspace { PS C:\> Get-DbaRunspace -Name 'mymodule.maintenance' Returns the runspace registered under the name 'mymodule.maintenance' -#> + #> [CmdletBinding()] param ( [string] @@ -27,6 +27,4 @@ function Get-DbaRunspace { ) [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces.Values | Where-Object Name -Like $Name -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-DbaSysDbUserObjectScript.ps1 b/internal/functions/Get-DbaSysDbUserObjectScript.ps1 index f4da58e209..59df445289 100644 --- a/internal/functions/Get-DbaSysDbUserObjectScript.ps1 +++ b/internal/functions/Get-DbaSysDbUserObjectScript.ps1 @@ -2,7 +2,7 @@ function Get-DbaSysDbUserObjectScript { <# .SYNOPSIS Gets all user objects found in source SQL Server's master, msdb and model databases to the destination. - #> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -33,14 +33,14 @@ function Get-DbaSysDbUserObjectScript { Stop-Function -Message "Failure" -Category ConnectionError -ErrorRecord $_ -Target $Source return } - + if (!(Test-SqlSa -SqlInstance $server -SqlCredential $SqlCredential)) { Stop-Function -Message "Not a sysadmin on $source. Quitting." return } - + $systemDbs = "master", "model", "msdb" - + foreach ($systemDb in $systemDbs) { $smodb = $server.databases[$systemDb] $destdb = $server.databases[$systemDb] @@ -56,7 +56,7 @@ function Get-DbaSysDbUserObjectScript { try { $transfer.ScriptTransfer() } catch { } Write-Output "GO" - + foreach ($table in $tables) { Write-Output "GO" $transfer = New-Object Microsoft.SqlServer.Management.Smo.Transfer $smodb @@ -66,7 +66,7 @@ function Get-DbaSysDbUserObjectScript { $null = $transfer.ObjectList.Add($table) try { $transfer.ScriptTransfer() } catch {} } - + $userobjects = Get-DbaModule -SqlInstance $server -Database $systemDb -NoSystemObjects | Sort-Object Type Write-Message -Level Verbose -Message "Copying from $systemDb" foreach ($userobject in $userobjects) { @@ -87,7 +87,7 @@ function Get-DbaSysDbUserObjectScript { "SQL_INLINE_TABLE_VALUED_FUNCTION" { $smodb.UserDefinedFunctions.Item($name) } "SQL_SCALAR_FUNCTION" { $smodb.UserDefinedFunctions.Item($name) } } - + $smobject = switch ($userobject.Type) { "VIEW" { $smodb.Views.Item($userobject.Name, $userobject.SchemaName) } "SQL_STORED_PROCEDURE" { $smodb.StoredProcedures.Item($userobject.Name, $userobject.SchemaName) } @@ -105,5 +105,4 @@ function Get-DbaSysDbUserObjectScript { } } } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-DecryptedObject.ps1 b/internal/functions/Get-DecryptedObject.ps1 index bcf170efe0..d04eeb3a7a 100644 --- a/internal/functions/Get-DecryptedObject.ps1 +++ b/internal/functions/Get-DecryptedObject.ps1 @@ -6,7 +6,7 @@ function Get-DecryptedObject { This function is heavily based on Antti Rantasaari's script at http://goo.gl/wpqSib Antti Rantasaari 2014, NetSPI License: BSD 3-Clause http://opensource.org/licenses/BSD-3-Clause - #> + #> param ( [Parameter(Mandatory)] [Microsoft.SqlServer.Management.Smo.Server]$SqlInstance, @@ -15,10 +15,10 @@ function Get-DecryptedObject { [string]$Type, [switch]$EnableException ) - + $server = $SqlInstance $sourceName = $server.Name - + # Query Service Master Key from the database - remove padding from the key # key_id 102 eq service master key, thumbprint 3 means encrypted with machinekey Write-Message -Level Verbose -Message "Querying service master key" @@ -29,13 +29,13 @@ function Get-DecryptedObject { Stop-Function -Message "Can't execute query on $sourcename" -Target $server -ErrorRecord $_ return } - + $sourceNetBios = Resolve-NetBiosName $server $instance = $server.InstanceName $serviceInstanceId = $server.ServiceInstanceId - + Write-Message -Level Verbose -Message "Get entropy from the registry - hopefully finds the right SQL server instance" - + try { [byte[]]$entropy = Invoke-Command2 -Raw -Credential $Credential -ComputerName $sourceNetBios -argumentlist $serviceInstanceId { $serviceInstanceId = $args[0] @@ -46,7 +46,7 @@ function Get-DecryptedObject { Stop-Function -Message "Can't access registry keys on $sourceName. Do you have administrative access to the Windows registry on $SqlInstance Otherwise, we're out of ideas." -Target $source return } - + Write-Message -Level Verbose -Message "Decrypt the service master key" try { $serviceKey = Invoke-Command2 -Raw -Credential $Credential -ComputerName $sourceNetBios -ArgumentList $smkbytes, $Entropy { @@ -60,17 +60,17 @@ function Get-DecryptedObject { Stop-Function -Message "Can't unprotect registry data on $sourcename. Do you have administrative access to the Windows registry on $sourcename? Otherwise, we're out of ideas." -Target $source return } - + # Choose the encryption algorithm based on the SMK length - 3DES for 2008, AES for 2012 # Choose IV length based on the algorithm Write-Message -Level Verbose -Message "Choose the encryption algorithm based on the SMK length - 3DES for 2008, AES for 2012" - + if (($serviceKey.Length -ne 16) -and ($serviceKey.Length -ne 32)) { Write-Message -Level Verbose -Message "ServiceKey found: $serviceKey.Length" Stop-Function -Message "Unknown key size. Do you have administrative access to the Windows registry on $sourcename? Otherwise, we're out of ideas." -Target $source return } - + if ($serviceKey.Length -eq 16) { $decryptor = New-Object System.Security.Cryptography.TripleDESCryptoServiceProvider $ivlen = 8 @@ -78,21 +78,21 @@ function Get-DecryptedObject { $decryptor = New-Object System.Security.Cryptography.AESCryptoServiceProvider $ivlen = 16 } - + <# Query link server password information from the Db. Remove header from pwdhash, extract IV (as iv) and ciphertext (as pass) Ignore links with blank credentials (integrated auth ?) #> - + Write-Message -Level Verbose -Message "Query link server password information from the Db." - + try { if (-not $server.IsClustered) { $connString = "Server=ADMIN:$sourceNetBios\$instance;Trusted_Connection=True" } else { $dacEnabled = $server.Configuration.RemoteDacConnectionsEnabled.ConfigValue - + if ($dacEnabled -eq $false) { If ($Pscmdlet.ShouldProcess($server.Name, "Enabling DAC on clustered instance.")) { Write-Message -Level Verbose -Message "DAC must be enabled for clusters, even when accessed from active node. Enabling." @@ -100,15 +100,15 @@ function Get-DecryptedObject { $server.Configuration.Alter() } } - + $connString = "Server=ADMIN:$sourceName;Trusted_Connection=True" } } catch { Stop-Function -Message "Failure enabling DAC on $sourcename" -Target $source -ErrorRecord $_ } - + <# NOTE: This query is accessing syslnklgns table. Can only be done via the DAC connection #> - + $sql = switch ($Type) { "LinkedServer" { "SELECT sysservers.srvname, @@ -125,10 +125,10 @@ function Get-DecryptedObject { "SELECT QUOTENAME(name) AS name,credential_identity,substring(imageval,5,$ivlen) iv, substring(imageval,$($ivlen + 5),len(imageval)-$($ivlen + 4)) pass from sys.Credentials cred inner join sys.sysobjvalues obj on cred.credential_id = obj.objid where valclass=28 and valnum=2" } } - + Write-Message -Level Debug -Message $sql Write-Message -Level Verbose -Message "Get entropy from the registry" - + try { $results = Invoke-Command2 -ErrorAction Stop -Raw -Credential $Credential -ComputerName $sourceNetBios -ArgumentList $connString, $sql { $connString = $args[0]; $sql = $args[1] @@ -145,7 +145,7 @@ function Get-DecryptedObject { Stop-Function -Message "Can't establish local DAC connection on $sourcename." -Target $server -ErrorRecord $_ return } - + if ($server.IsClustered -and $dacEnabled -eq $false) { If ($Pscmdlet.ShouldProcess($server.Name, "Disabling DAC on clustered instance.")) { try { @@ -158,7 +158,7 @@ function Get-DecryptedObject { } } } - + Write-Message -Level Verbose -Message "Go through each row in results" foreach ($result in $results) { # decrypt the password using the service master key and the extracted IV @@ -166,19 +166,19 @@ function Get-DecryptedObject { $decrypt = $decryptor.Createdecryptor($serviceKey, $result.iv) $stream = New-Object System.IO.MemoryStream ( , $result.pass) $crypto = New-Object System.Security.Cryptography.CryptoStream $stream, $decrypt, "Write" - + $crypto.Write($result.pass, 0, $result.pass.Length) [byte[]]$decrypted = $stream.ToArray() - + # convert decrypted password to unicode $encode = New-Object System.Text.UnicodeEncoding - + # Print results - removing the weird padding (8 bytes in the front, some bytes at the end)... # Might cause problems but so far seems to work.. may be dependant on SQL server version... # If problems arise remove the next three lines.. $i = 8; foreach ($b in $decrypted) { if ($decrypted[$i] -ne 0 -and $decrypted[$i + 1] -ne 0 -or $i -eq $decrypted.Length) { $i -= 1; break; }; $i += 1; } $decrypted = $decrypted[8 .. $i] - + if ($Type -eq "LinkedServer") { $name = $result.srvname $identity = $result.Name @@ -192,5 +192,4 @@ function Get-DecryptedObject { Password = $encode.GetString($decrypted) } } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-DirectoryRestoreFile.ps1 b/internal/functions/Get-DirectoryRestoreFile.ps1 index 63d6b48eab..fe745d2635 100644 --- a/internal/functions/Get-DirectoryRestoreFile.ps1 +++ b/internal/functions/Get-DirectoryRestoreFile.ps1 @@ -5,7 +5,7 @@ Internal Function to get SQL Server backfiles from a specified folder .DESCRIPTION Takes path, checks for validity. Scans for usual backup file -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -37,6 +37,4 @@ Takes path, checks for validity. Scans for usual backup file Write-Message -Level Verbose -Message "Scanning $path" $Results = Get-ChildItem -path $Path -Recurse:$Recurse | Where-Object {$_.PsIsContainer -eq $false} return $Results -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-ErrorMessage.ps1 b/internal/functions/Get-ErrorMessage.ps1 index da00608242..44e8686409 100644 --- a/internal/functions/Get-ErrorMessage.ps1 +++ b/internal/functions/Get-ErrorMessage.ps1 @@ -13,5 +13,4 @@ function Get-ErrorMessage { if (-not $innermessage) { $innermessage = $Record.Exception.Message } return $innermessage } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-InternalService.ps1 b/internal/functions/Get-InternalService.ps1 index d6bb46191d..fc3f7ac2f1 100644 --- a/internal/functions/Get-InternalService.ps1 +++ b/internal/functions/Get-InternalService.ps1 @@ -43,7 +43,7 @@ function Get-InternalService { Get-InternalService -ComputerName "server1","server2","server3" -Name Lanman% Scans the servers server1, server2 and server3 for all services whose name starts with 'lanman' -#> + #> [CmdletBinding()] param ( [string[]] @@ -109,6 +109,4 @@ function Get-InternalService { end { Write-Message -Level InternalComment -Message "Ending" } -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-JobList.ps1 b/internal/functions/Get-JobList.ps1 index a1b16b59e6..76b86fc590 100644 --- a/internal/functions/Get-JobList.ps1 +++ b/internal/functions/Get-JobList.ps1 @@ -53,7 +53,7 @@ function Get-JobList { Website: https://dbatools.io Copyright: (c) 2018 by dbatools, licensed under MIT License: MIT https://opensource.org/licenses/MIT - #> + #> [cmdletbinding()] param( [Parameter(ValueFromPipeline)] @@ -134,5 +134,4 @@ function Get-JobList { $jobs } } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-Language.ps1 b/internal/functions/Get-Language.ps1 index 9b2a3b15b8..453af545ee 100644 --- a/internal/functions/Get-Language.ps1 +++ b/internal/functions/Get-Language.ps1 @@ -13,7 +13,7 @@ function Get-Language { Get-Language 1033 Returns a pscustomobject with id, alias and name - #> + #> [CmdletBinding()] param ( [int]$id @@ -26,5 +26,4 @@ function Get-Language { , 'OptionalCalendars', 'UseUserOverride', 'IsReadOnly' Select-DefaultView -InputObject $culture -ExcludeProperty $excludeProps } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-OfflineSqlFileStructure.ps1 b/internal/functions/Get-OfflineSqlFileStructure.ps1 index 95d744a40e..9ebd428d60 100644 --- a/internal/functions/Get-OfflineSqlFileStructure.ps1 +++ b/internal/functions/Get-OfflineSqlFileStructure.ps1 @@ -3,7 +3,7 @@ function Get-OfflineSqlFileStructure { .SYNOPSIS Internal function. Returns dictionary object that contains file structures for SQL databases. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, Position = 0)] @@ -63,6 +63,4 @@ Internal function. Returns dictionary object that contains file structures for S } return $destinationfiles -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-PasswordHash.ps1 b/internal/functions/Get-PasswordHash.ps1 index 8ac9e03ea5..cf6858e487 100644 --- a/internal/functions/Get-PasswordHash.ps1 +++ b/internal/functions/Get-PasswordHash.ps1 @@ -32,7 +32,7 @@ function Get-PasswordHash { Generates password hash for SQL 2005 using custom salt from the $byte variable -#> + #> param ( [object]$Password, $SqlMajorVersion, @@ -79,5 +79,4 @@ function Get-PasswordHash { $bytes | ForEach-Object { $hashString += ("{0:X2}" -f $_).PadLeft(2, "0") } } return $hashString -} - +} \ No newline at end of file diff --git a/internal/functions/Get-RegServerGroupReverseParse.ps1 b/internal/functions/Get-RegServerGroupReverseParse.ps1 index ea2ef128ef..7c8256b435 100644 --- a/internal/functions/Get-RegServerGroupReverseParse.ps1 +++ b/internal/functions/Get-RegServerGroupReverseParse.ps1 @@ -8,9 +8,8 @@ function Get-RegServerGroupReverseParse ($object) { $object = $object.Parent } until ($object.Name -eq 'DatabaseEngineServerGroup') - + [array]::Reverse($name) $name -join '\' } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-RegServerParent.ps1 b/internal/functions/Get-RegServerParent.ps1 index ae4be5f6ba..5799d0ad54 100644 --- a/internal/functions/Get-RegServerParent.ps1 +++ b/internal/functions/Get-RegServerParent.ps1 @@ -11,11 +11,10 @@ function Get-RegServerParent { } } until ($null -ne $InputObject.ServerConnection -or $parentcount++ -gt 10) - - + + if ($parentcount -lt 10) { $InputObject } } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-ResourceState.ps1 b/internal/functions/Get-ResourceState.ps1 index ed8c81bc0e..90f11ae2b5 100644 --- a/internal/functions/Get-ResourceState.ps1 +++ b/internal/functions/Get-ResourceState.ps1 @@ -10,5 +10,4 @@ function Get-ResourceState ($state) { 129 { "Online Pending" } 130 { "Offline Pending" } } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-RestoreContinuableDatabase.ps1 b/internal/functions/Get-RestoreContinuableDatabase.ps1 index 92d6769de6..34f57a538d 100644 --- a/internal/functions/Get-RestoreContinuableDatabase.ps1 +++ b/internal/functions/Get-RestoreContinuableDatabase.ps1 @@ -7,7 +7,7 @@ function Get-RestoreContinuableDatabase { Takes a SQL instance and checks for databases with a redo_start_lsn value, and returns the database name and that value -gt SQl 2005 it comes from master.sys.master_files -eq SQL 2000 DBCC DBINFO -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -36,6 +36,4 @@ function Get-RestoreContinuableDatabase { )" } $server.ConnectionContext.ExecuteWithResults($sql).Tables.Rows -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-SaLoginName.ps1 b/internal/functions/Get-SaLoginName.ps1 index 9622c8ced2..cc2bcd6cc7 100644 --- a/internal/functions/Get-SaLoginName.ps1 +++ b/internal/functions/Get-SaLoginName.ps1 @@ -19,7 +19,7 @@ function Get-SaLoginName { Website: https://dbatools.io Copyright: (c) 2018 by dbatools, licensed under MIT License: MIT https://opensource.org/licenses/MIT - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -32,6 +32,4 @@ function Get-SaLoginName { $saname = ($server.logins | Where-Object { $_.id -eq 1 }).Name return $saname -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-SmoServerForDynamicParams.ps1 b/internal/functions/Get-SmoServerForDynamicParams.ps1 index c182d4b17f..0ace6b5ec8 100644 --- a/internal/functions/Get-SmoServerForDynamicParams.ps1 +++ b/internal/functions/Get-SmoServerForDynamicParams.ps1 @@ -20,6 +20,4 @@ function Get-SmoServerForDynamicParams { if ($SqlInstance) { Connect-SqlInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential -ParameterConnection } -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-SqlCmdVars.ps1 b/internal/functions/Get-SqlCmdVars.ps1 index ab67c2714b..96f5360028 100644 --- a/internal/functions/Get-SqlCmdVars.ps1 +++ b/internal/functions/Get-SqlCmdVars.ps1 @@ -57,7 +57,7 @@ function Get-SqlCmdVars { $dacProfile = [Microsoft.SqlServer.Dac.DacProfile]::Load($publishXml) Get-SqlCmdVars $dacProfile.DeployOptions.SqlCommandVariableValues -EnableException " - #> + #> [CmdletBinding()] param ( @@ -79,5 +79,4 @@ function Get-SqlCmdVars { $errorMsg = 'The following SqlCmd variables are not defined in the session (but are defined in the publish profile): {0}' -f ($missingVariables -join " `n") Stop-Function -Message $errorMsg -EnableException $EnableException } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-SqlDefaultPaths.ps1 b/internal/functions/Get-SqlDefaultPaths.ps1 index fcfad37a8b..26f604de4d 100644 --- a/internal/functions/Get-SqlDefaultPaths.ps1 +++ b/internal/functions/Get-SqlDefaultPaths.ps1 @@ -2,7 +2,7 @@ function Get-SqlDefaultPaths { <# .SYNOPSIS Internal function. Returns the default data and log paths for SQL Server. Needed because SMO's server.defaultpath is sometimes null. -#> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "")] param ( @@ -53,6 +53,4 @@ function Get-SqlDefaultPaths { if ($filepath.Length -eq 0) { throw "Cannot determine the required directory path" } $filepath = $filepath.TrimEnd("\") return $filepath -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-SqlDefaultSpConfigure.ps1 b/internal/functions/Get-SqlDefaultSpConfigure.ps1 index 1ca7ec9e5e..112956d58c 100644 --- a/internal/functions/Get-SqlDefaultSpConfigure.ps1 +++ b/internal/functions/Get-SqlDefaultSpConfigure.ps1 @@ -18,7 +18,7 @@ function Get-SqlDefaultSpConfigure { Get-SqlDefaultSpConfigure -SqlVersion 11 Returns a list of sp_configure (sys.configurations) items for SQL 2012. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -559,6 +559,4 @@ function Get-SqlDefaultSpConfigure { } -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-SqlFileStructure.ps1 b/internal/functions/Get-SqlFileStructure.ps1 index a3defa92b8..97bce1653a 100644 --- a/internal/functions/Get-SqlFileStructure.ps1 +++ b/internal/functions/Get-SqlFileStructure.ps1 @@ -3,7 +3,7 @@ function Get-SqlFileStructure { .SYNOPSIS Internal function. Returns custom object that contains file structures on destination paths (\\SqlInstance\m$\mssql\etc\etc\file.mdf) for source and destination servers. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory, Position = 0)] @@ -122,6 +122,4 @@ function Get-SqlFileStructure { $filestructure = [pscustomobject]@{ "databases" = $dbcollection } return $filestructure -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-SqlSaLogin.ps1 b/internal/functions/Get-SqlSaLogin.ps1 index d4e98d57f5..6848249765 100644 --- a/internal/functions/Get-SqlSaLogin.ps1 +++ b/internal/functions/Get-SqlSaLogin.ps1 @@ -6,7 +6,7 @@ function Get-SqlSaLogin { The SQL Server instance. .PARAMETER SqlCredential Allows you to login to servers using SQL Logins instead of Windows Authentication (AKA Integrated or Trusted). - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -17,6 +17,4 @@ function Get-SqlSaLogin { $server = Connect-SqlInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential $sa = $server.Logins | Where-Object Id -eq 1 return $sa.Name -} - - +} \ No newline at end of file diff --git a/internal/functions/Get-TableNameParts.ps1 b/internal/functions/Get-TableNameParts.ps1 index 34cd6e4cbf..759ca5c6db 100644 --- a/internal/functions/Get-TableNameParts.ps1 +++ b/internal/functions/Get-TableNameParts.ps1 @@ -28,7 +28,7 @@ function Get-TableNameParts { Get-TableNameParts '[Bad. Name]]].[Schema.With.Dots]]].[Another .Silly]] Name..]' Parses a three-part name into its constitute parts. Uses square brackets to enclose special characters. -#> + #> param ( [string]$Table ) @@ -105,5 +105,4 @@ function Get-TableNameParts { } return $fqtns } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-WmiHadr.ps1 b/internal/functions/Get-WmiHadr.ps1 index bdb7a01a02..809b4516eb 100644 --- a/internal/functions/Get-WmiHadr.ps1 +++ b/internal/functions/Get-WmiHadr.ps1 @@ -10,7 +10,7 @@ function Get-WmiHadr { ) process { foreach ($instance in $SqlInstance) { - + try { $computer = $computerName = $instance.ComputerName $instanceName = $instance.InstanceName @@ -19,7 +19,7 @@ function Get-WmiHadr { Stop-Function -Message "Failure connecting to $computer" -Category ConnectionError -ErrorRecord $_ -Target $instance return } - + if ($null -eq $currentState.IsHadrEnabled) { $isenabled = $false } else { @@ -33,5 +33,4 @@ function Get-WmiHadr { } } } -} - +} \ No newline at end of file diff --git a/internal/functions/Get-XpDirTreeRestoreFile.ps1 b/internal/functions/Get-XpDirTreeRestoreFile.ps1 index e05393f6a3..8972d7f174 100644 --- a/internal/functions/Get-XpDirTreeRestoreFile.ps1 +++ b/internal/functions/Get-XpDirTreeRestoreFile.ps1 @@ -24,7 +24,7 @@ function Get-XpDirTreeRestoreFile { PS C:\> Get-XpDirTreeRestoreFile -Path '\\foo\bar\' -SqlInstance $SqlInstance Tests whether the instance $SqlInstance has access to the path \\foo\bar\ -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] diff --git a/internal/functions/Import-DbaCmdlet.ps1 b/internal/functions/Import-DbaCmdlet.ps1 index ae2dc8bbcd..e38f3f3857 100644 --- a/internal/functions/Import-DbaCmdlet.ps1 +++ b/internal/functions/Import-DbaCmdlet.ps1 @@ -2,74 +2,74 @@ function Import-DbaCmdlet { <# .SYNOPSIS Loads a cmdlet into the current context. - + .DESCRIPTION Loads a cmdlet into the current context. This can be used to register a cmdlet during module import, making it easy to have hybrid modules publishing both cmdlets and functions. Can also be used to register cmdlets written in PowerShell classes. - + .PARAMETER Name The name of the cmdlet to register. - + .PARAMETER Type The type of the class implementing the cmdlet. - + .PARAMETER HelpFile Path to the help XML containing the help for the cmdlet. - + .PARAMETER Module Module to inject the cmdlet into. - + .EXAMPLE PS C:\> Import-DbaCmdlet -Name Get-Something -Type ([GetSomethingCommand]) - + Imports the Get-Something cmdlet into the current context. - + .EXAMPLE PS C:\> Import-DbaCmdlet -Name Get-Something -Type ([GetSomethingCommand]) -Module (Get-Module PSReadline) - + Imports the Get-Something cmdlet into the PSReadline module. - + .NOTES Original Author: Chris Dent Link: https://www.indented.co.uk/cmdlets-without-a-dll/ -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] [String] $Name, - + [Parameter(Mandatory)] [Type] $Type, - + [string] $HelpFile, - + [System.Management.Automation.PSModuleInfo] $Module ) - + begin { $scriptBlock = { param ( [String] $Name, - + [Type] $Type, - + [string] $HelpFile ) - + $sessionStateCmdletEntry = New-Object System.Management.Automation.Runspaces.SessionStateCmdletEntry( $Name, $Type, $HelpFile ) - + # System.Management.Automation.Runspaces.LocalPipeline will let us get at ExecutionContext. # Note: $ExecutionContext is *not* an instance of this object. $pipelineType = [PowerShell].Assembly.GetType('System.Management.Automation.Runspaces.LocalPipeline') @@ -77,7 +77,7 @@ function Import-DbaCmdlet { 'GetExecutionContextFromTLS', [System.Reflection.BindingFlags]'Static,NonPublic' ) - + # Invoke the method to get an instance of ExecutionContext. $context = $method.Invoke( $null, @@ -86,10 +86,10 @@ function Import-DbaCmdlet { $null, (Get-Culture) ) - + # Get the SessionStateInternal type $internalType = [PowerShell].Assembly.GetType('System.Management.Automation.SessionStateInternal') - + # Get a valid constructor which accepts a param of type ExecutionContext $constructor = $internalType.GetConstructor( [System.Reflection.BindingFlags]'Instance,NonPublic', @@ -97,10 +97,10 @@ function Import-DbaCmdlet { $context.GetType(), $null ) - + # Get the SessionStateInternal for this execution context $sessionStateInternal = $constructor.Invoke($context) - + # Get the method which allows Cmdlets to be added to the session $method = $internalType.GetMethod( 'AddSessionStateEntry', @@ -113,10 +113,9 @@ function Import-DbaCmdlet { $method.Invoke($sessionStateInternal, $sessionStateCmdletEntry) } } - + process { if (-not $Module) { $scriptBlock.Invoke($Name, $Type, $HelpFile) } else { $Module.Invoke($scriptBlock, @($Name, $Type, $HelpFile)) } } -} - +} \ No newline at end of file diff --git a/internal/functions/Invoke-Alter.ps1 b/internal/functions/Invoke-Alter.ps1 index 0ee6335f82..5cfac3796c 100644 --- a/internal/functions/Invoke-Alter.ps1 +++ b/internal/functions/Invoke-Alter.ps1 @@ -1,7 +1,7 @@ function Invoke-Alter { <# For stubborn .net objects that won't throw properly - #> + #> [CmdletBinding(SupportsShouldProcess)] param ( [object]$Object @@ -13,4 +13,4 @@ function Invoke-Alter { $Object.Alter() } } -} +} \ No newline at end of file diff --git a/internal/functions/Invoke-Command2.ps1 b/internal/functions/Invoke-Command2.ps1 index 0306a8ca26..23e21a94a2 100644 --- a/internal/functions/Invoke-Command2.ps1 +++ b/internal/functions/Invoke-Command2.ps1 @@ -29,7 +29,7 @@ function Invoke-Command2 { Executes the scriptblock '{ dir }' on the computer sql2014 using the credentials stored in $Credential. If $Credential is null, no harm done. - #> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUsePSCredentialType", "")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")] @@ -86,5 +86,4 @@ function Invoke-Command2 { $currentSession | Remove-PSSession } } -} - +} \ No newline at end of file diff --git a/internal/functions/Invoke-Create.ps1 b/internal/functions/Invoke-Create.ps1 index 3882a210da..02f54f9bae 100644 --- a/internal/functions/Invoke-Create.ps1 +++ b/internal/functions/Invoke-Create.ps1 @@ -1,7 +1,7 @@ function Invoke-Create { <# For stubborn .net objects that won't throw properly - #> + #> [CmdletBinding(SupportsShouldProcess)] param ( [object]$Object @@ -18,5 +18,4 @@ function Invoke-Create { $Object.Create() } } -} - +} \ No newline at end of file diff --git a/internal/functions/Invoke-DbMirrorValidation.ps1 b/internal/functions/Invoke-DbMirrorValidation.ps1 index 6c078230bf..8517f30b41 100644 --- a/internal/functions/Invoke-DbMirrorValidation.ps1 +++ b/internal/functions/Invoke-DbMirrorValidation.ps1 @@ -3,12 +3,12 @@ function Invoke-DbMirrorValidation { <# .SYNOPSIS Validates if a mirror is ready - + .DESCRIPTION Validates if a mirror is ready Thanks to https://github.com/mmessano/PowerShell/blob/master/SQL-ConfigureDatabaseMirroring.ps1 - + .PARAMETER Primary SQL Server name or SMO object representing the primary SQL Server. @@ -26,16 +26,16 @@ function Invoke-DbMirrorValidation { .PARAMETER WitnessSqlCredential Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential) - + .PARAMETER Database The database or databases to mirror - + .PARAMETER NetworkShare The network share where the backups will be - + .PARAMETER InputObject Enables piping from Get-DbaDatabase - + .PARAMETER EnableException 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. @@ -56,12 +56,12 @@ function Invoke-DbMirrorValidation { Database = 'onthewall' NetworkShare = '\\nas\sql\share' } - + PS C:\> Invoke-DbMirrorValidation @params - + Do things - - #> + + #> [CmdletBinding()] param ( [DbaInstanceParameter]$Primary, @@ -82,32 +82,32 @@ function Invoke-DbMirrorValidation { Stop-Function -Message "Database is required when SqlInstance is specified" return } - + if ($Primary) { $InputObject += Get-DbaDatabase -SqlInstance $Primary -SqlCredential $SqlCredential -Database $Database } - + foreach ($db in $InputObject) { $server = $db.Parent $dbname = $db.Name $canmirror = $true $dest = Connect-DbaInstance -SqlInstance $Mirror -Credential $MirrorSqlCredential - + $endpoints = @() $endpoints += Get-DbaEndpoint -SqlInstance $server | Where-Object EndpointType -eq DatabaseMirroring $endpoints += Get-DbaEndpoint -SqlInstance $dest | Where-Object EndpointType -eq DatabaseMirroring - + if (Test-Bound -ParameterName Witness) { try { $witserver = Connect-DbaInstance -SqlInstance $Witness -SqlCredential $WitnessSqlCredential $endpoints += Get-DbaEndpoint -SqlInstance $witserver | Where-Object EndpointType -eq DatabaseMirroring $witdb = Get-DbaDatabase -SqlInstance $witserver -Database $db.Name $wexists = $true - + if ($witdb.Status -ne 'Restoring') { $canmirror = $false } - + if ($witdb) { $witexists = $true } else { @@ -120,32 +120,32 @@ function Invoke-DbMirrorValidation { $canmirror = $false } } - + if ($db.MirroringStatus -ne [Microsoft.SqlServer.Management.Smo.MirroringStatus]::None) { Write-Message -Level Verbose -Message "Cannot setup mirroring on database ($dbname) due to its current mirroring state: $($db.MirroringStatus)" $canmirror = $false } - + if ($db.Status -ne [Microsoft.SqlServer.Management.Smo.DatabaseStatus]::Normal) { Write-Message -Level Verbose -Message "Cannot setup mirroring on database ($dbname) due to its current Status: $($db.Status)" $canmirror = $false } - + if ($db.RecoveryModel -ne 'Full') { Write-Message -Level Verbose -Message "Cannot setup mirroring on database ($dbname) due to its current recovery model: $($db.RecoveryModel)" $canmirror = $false } - + $destdb = Get-DbaDatabase -SqlInstance $dest -Database $db.Name - + if ($destdb.RecoveryModel -ne 'Full') { $canmirror = $false } - + if ($destdb.Status -ne 'Restoring') { $canmirror = $false } - + if ($destdb) { $destdbexists = $true } else { @@ -153,7 +153,7 @@ function Invoke-DbMirrorValidation { $canmirror = $false $destdbexists = $false } - + if ((Test-Bound -ParameterName NetworkShare) -and -not (Test-DbaPath -SqlInstance $dest -Path $NetworkShare)) { Write-Message -Level Verbose -Message "Cannot access $NetworkShare from $($destdb.Parent.Name)" $canmirror = $false @@ -161,7 +161,7 @@ function Invoke-DbMirrorValidation { } else { $nexists = $true } - + if ($server.EngineEdition -ne $dest.EngineEdition) { Write-Message -Level Verbose -Message "This mirroring configuration is not supported. Because the principal server instance, $server, is $($server.EngineEdition) Edition, the mirror server instance must also be $($server.EngineEdition) Edition." $canmirror = $false @@ -169,7 +169,7 @@ function Invoke-DbMirrorValidation { } else { $edition = $true } - + # There's a better way to do this but I'm sleepy if ((Test-Bound -ParameterName Witness)) { if ($endpoints.Count -eq 3) { @@ -184,7 +184,7 @@ function Invoke-DbMirrorValidation { $endpointpass = $false } } - + $results = [pscustomobject]@{ Primary = $Primary Mirror = $Mirror @@ -203,7 +203,7 @@ function Invoke-DbMirrorValidation { WitnessDbStatus = $witdb.Status ValidationPassed = $canmirror } - + if ((Test-Bound -ParameterName Witness)) { $results | Select-DefaultView -Property Primary, Mirror, Witness, Database, RecoveryModel, MirroringStatus, State, EndPoints, DatabaseExistsOnMirror, OnlineWitness, DatabaseExistsOnWitness, EditionMatch, AccessibleShare, DestinationDbStatus, WitnessDbStatus, ValidationPassed } else { diff --git a/internal/functions/Invoke-DbaAsync.ps1 b/internal/functions/Invoke-DbaAsync.ps1 index 44270e8463..5777f6b761 100644 --- a/internal/functions/Invoke-DbaAsync.ps1 +++ b/internal/functions/Invoke-DbaAsync.ps1 @@ -39,7 +39,7 @@ function Invoke-DbaAsync { .PARAMETER EnableException By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. - #> + #> param ( [Alias('Connection', 'Conn')] @@ -174,7 +174,7 @@ function Invoke-DbaAsync { $ds = New-Object system.Data.DataSet $da = New-Object system.Data.SqlClient.SqlDataAdapter($cmd) - + if ($MessagesToOutput) { $defaultrunspace = [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace $pool = [RunspaceFactory]::CreateRunspacePool(1, [int]$env:NUMBER_OF_PROCESSORS + 1) @@ -290,6 +290,4 @@ function Invoke-DbaAsync { } #foreach ($piece in $Pieces) } -} - - +} \ No newline at end of file diff --git a/internal/functions/Invoke-DbaDatabaseCorruption.ps1 b/internal/functions/Invoke-DbaDatabaseCorruption.ps1 index bec773d49c..865be6e0da 100644 --- a/internal/functions/Invoke-DbaDatabaseCorruption.ps1 +++ b/internal/functions/Invoke-DbaDatabaseCorruption.ps1 @@ -50,7 +50,7 @@ function Invoke-DbaDbCorruption { .EXAMPLE Invoke-DbaDbCorruption -SqlInstance sql2016 -Database containeddb -Table Customers -Confirm:$false Does not prompt and immediately corrupts table customers in database containeddb on the sql2016 instance (by putting database into single user mode, writing to garbage to its first non-iam page, and returning it to multi-user.) - #> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -182,6 +182,4 @@ function Invoke-DbaDbCorruption { Status = "Corrupted" } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Invoke-DbaDiagnosticQueryScriptParser.ps1 b/internal/functions/Invoke-DbaDiagnosticQueryScriptParser.ps1 index 5b99a76d82..78d67595bf 100644 --- a/internal/functions/Invoke-DbaDiagnosticQueryScriptParser.ps1 +++ b/internal/functions/Invoke-DbaDiagnosticQueryScriptParser.ps1 @@ -69,6 +69,4 @@ function Invoke-DbaDiagnosticQueryScriptParser { $newscript = New-Object -TypeName PSObject -Property $properties $ParsedScript += $newscript $ParsedScript -} - - +} \ No newline at end of file diff --git a/internal/functions/Invoke-ManagedComputerCommand.ps1 b/internal/functions/Invoke-ManagedComputerCommand.ps1 index a0c0d1e338..5f5bab5fdd 100644 --- a/internal/functions/Invoke-ManagedComputerCommand.ps1 +++ b/internal/functions/Invoke-ManagedComputerCommand.ps1 @@ -24,7 +24,7 @@ function Invoke-ManagedComputerCommand { .PARAMETER EnableException Left in for legacy reasons. This command will throw no matter what - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -37,27 +37,27 @@ function Invoke-ManagedComputerCommand { [switch][Alias('Silent')] $EnableException # Left in for legacy but this command needs to throw ) - + $computer = $ComputerName.ComputerName - + $null = Test-ElevationRequirement -ComputerName $computer -EnableException $true - + $resolved = Resolve-DbaNetworkName -ComputerName $computer -Turbo $ipaddr = $resolved.IpAddress $ArgumentList += $ipaddr - + [scriptblock]$setupScriptBlock = { $ipaddr = $args[$args.GetUpperBound(0)] - + # Just in case we go remote, ensure the assembly is loaded [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SqlWmiManagement') $wmi = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer $ipaddr $null = $wmi.Initialize() } - + $prescriptblock = $setupScriptBlock.ToString() $postscriptblock = $ScriptBlock.ToString() - + $scriptblock = [ScriptBlock]::Create("$prescriptblock $postscriptblock") Write-Message -Level Verbose -Message "Connecting to SQL WMI on $computer." @@ -65,11 +65,10 @@ function Invoke-ManagedComputerCommand { Invoke-Command2 -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList -Credential $Credential -ErrorAction Stop } catch { Write-Message -Level Verbose -Message "Local connection attempt to $computer failed. Connecting remotely." - + # For surely resolve stuff, and going by default with kerberos, this needs to match FullComputerName $hostname = $resolved.FullComputerName - + Invoke-Command2 -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList -ComputerName $hostname -ErrorAction Stop } -} - +} \ No newline at end of file diff --git a/internal/functions/Invoke-SmoCheck.ps1 b/internal/functions/Invoke-SmoCheck.ps1 index b94133f73b..74cdea4137 100644 --- a/internal/functions/Invoke-SmoCheck.ps1 +++ b/internal/functions/Invoke-SmoCheck.ps1 @@ -3,7 +3,7 @@ function Invoke-SmoCheck { .SYNOPSIS Checks for PowerShell SMO version vs SQL Server's SMO version. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -22,6 +22,4 @@ function Invoke-SmoCheck { Write-Warning "If you encounter issues, consider upgrading SMO." } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Invoke-SteppablePipeline.ps1 b/internal/functions/Invoke-SteppablePipeline.ps1 index df6a3e1c52..f7fc23ee81 100644 --- a/internal/functions/Invoke-SteppablePipeline.ps1 +++ b/internal/functions/Invoke-SteppablePipeline.ps1 @@ -3,34 +3,32 @@ function Invoke-SteppablePipeline { <# .SYNOPSIS Allows using steppable pipelines on the pipeline. - + .DESCRIPTION Allows using steppable pipelines on the pipeline. - + .PARAMETER InputObject The object(s) to process Should only receive input from the pipeline! - + .PARAMETER Pipeline The pipeline to execute - + .EXAMPLE PS C:\> Get-ChildItem | Invoke-SteppablePipeline -Pipeline $steppablePipeline - + Processes the object returned by Get-ChildItem in the pipeline defined -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] $InputObject, - + [Parameter(Mandatory)] $Pipeline ) - + process { $Pipeline.Process($InputObject) } -} - - +} \ No newline at end of file diff --git a/internal/functions/Invoke-TagCommand.ps1 b/internal/functions/Invoke-TagCommand.ps1 index 11ed811915..ad10f6ed2e 100644 --- a/internal/functions/Invoke-TagCommand.ps1 +++ b/internal/functions/Invoke-TagCommand.ps1 @@ -22,7 +22,7 @@ function Invoke-TagCommand ([string]$Tag, [string]$Keyword) { Tag-Command -Tag SQLWMI -Keyword Invoke-ManagedComputerCommand Tag-Command -Tag WSMan -Keyword Invoke-Command -#> + #> $tagsRex = ([regex]'(?m)^[\s]{0,15}Tags:(.*)$') $modulepath = (Get-Module -Name dbatools).Path @@ -78,6 +78,4 @@ function Invoke-TagCommand ([string]$Tag, [string]$Keyword) { } } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Invoke-TlsWebRequest.ps1 b/internal/functions/Invoke-TlsWebRequest.ps1 index 2410efafd3..04ba74fbc0 100644 --- a/internal/functions/Invoke-TlsWebRequest.ps1 +++ b/internal/functions/Invoke-TlsWebRequest.ps1 @@ -5,7 +5,7 @@ function Invoke-TlsWebRequest { rather than the default, which on a lot of standard installations is just TLS 1.0 - #> + #> $currentVersionTls = [Net.ServicePointManager]::SecurityProtocol $currentSupportableTls = [Math]::Max($currentVersionTls.value__, [Net.SecurityProtocolType]::Tls.value__) $availableTls = [enum]::GetValues('Net.SecurityProtocolType') | Where-Object { $_ -gt $currentSupportableTls } @@ -16,5 +16,4 @@ function Invoke-TlsWebRequest { Invoke-WebRequest @Args [Net.ServicePointManager]::SecurityProtocol = $currentVersionTls -} - +} \ No newline at end of file diff --git a/internal/functions/Join-AdminUnc.ps1 b/internal/functions/Join-AdminUnc.ps1 index 6a411104a4..c799ce8771 100644 --- a/internal/functions/Join-AdminUnc.ps1 +++ b/internal/functions/Join-AdminUnc.ps1 @@ -2,7 +2,7 @@ function Join-AdminUnc { <# .SYNOPSIS Internal function. Parses a path to make it an admin UNC. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -23,6 +23,4 @@ function Join-AdminUnc { $newpath = Join-Path "\\$servername\" $filepath.replace(':', '$') return $newpath } else { return } -} - - +} \ No newline at end of file diff --git a/internal/functions/Join-SomePath.ps1 b/internal/functions/Join-SomePath.ps1 index b6820ae1dc..c0edbe2f07 100644 --- a/internal/functions/Join-SomePath.ps1 +++ b/internal/functions/Join-SomePath.ps1 @@ -1,9 +1,9 @@ function Join-SomePath { <# An internal command that does not require the local path to exist - + Boo, this does not work, but keeping it for future ref. - #> + #> [CmdletBinding()] param ( [string]$Path, @@ -12,5 +12,4 @@ function Join-SomePath { process { [IO.Path]::Combine($Path, $ChildPath) } -} - +} \ No newline at end of file diff --git a/internal/functions/New-DbaLogShippingPrimaryDatabase.ps1 b/internal/functions/New-DbaLogShippingPrimaryDatabase.ps1 index e07f2b85cb..0c9e3583da 100644 --- a/internal/functions/New-DbaLogShippingPrimaryDatabase.ps1 +++ b/internal/functions/New-DbaLogShippingPrimaryDatabase.ps1 @@ -87,7 +87,7 @@ function New-DbaLogShippingPrimaryDatabase { .EXAMPLE New-DbaLogShippingPrimaryDatabase -SqlInstance sql1 -Database DB1 -BackupDirectory D:\data\logshipping -BackupJob LSBackup_DB1 -BackupRetention 4320 -BackupShare "\\sql1\logshipping" -BackupThreshold 60 -CompressBackup -HistoryRetention 14420 -MonitorServer sql1 -ThresholdAlertEnabled - #> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( @@ -251,5 +251,4 @@ function New-DbaLogShippingPrimaryDatabase { Write-Message -Message "Finished adding the primary database $Database to log shipping." -Level Verbose -} - +} \ No newline at end of file diff --git a/internal/functions/New-DbaLogShippingPrimarySecondary.ps1 b/internal/functions/New-DbaLogShippingPrimarySecondary.ps1 index bdad5367a8..52f1d54319 100644 --- a/internal/functions/New-DbaLogShippingPrimarySecondary.ps1 +++ b/internal/functions/New-DbaLogShippingPrimarySecondary.ps1 @@ -48,7 +48,7 @@ function New-DbaLogShippingPrimarySecondary { .EXAMPLE New-DbaLogShippingPrimarySecondary -SqlInstance sql1 -PrimaryDatabase DB1 -SecondaryServer sql2 -SecondaryDatabase DB1_DR - #> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory)] @@ -131,5 +131,4 @@ function New-DbaLogShippingPrimarySecondary { Write-Message -Message "Finished configuring of primary database $PrimaryDatabase to secondary database $SecondaryDatabase." -Level Verbose -} - +} \ No newline at end of file diff --git a/internal/functions/New-DbaLogShippingSecondaryDatabase.ps1 b/internal/functions/New-DbaLogShippingSecondaryDatabase.ps1 index 6a8e6c5593..1d98b9a5da 100644 --- a/internal/functions/New-DbaLogShippingSecondaryDatabase.ps1 +++ b/internal/functions/New-DbaLogShippingSecondaryDatabase.ps1 @@ -87,7 +87,7 @@ function New-DbaLogShippingSecondaryDatabase { .EXAMPLE New-DbaLogShippingSecondaryDatabase -SqlInstance sql2 -SecondaryDatabase DB1_DR -PrimaryServer sql1 -PrimaryDatabase DB1 -RestoreDelay 0 -RestoreMode standby -DisconnectUsers -RestoreThreshold 45 -ThresholdAlertEnabled -HistoryRetention 14420 - #> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] @@ -230,6 +230,4 @@ function New-DbaLogShippingSecondaryDatabase { Write-Message -Message "Finished adding the secondary database $SecondaryDatabase to log shipping." -Level Verbose -} - - +} \ No newline at end of file diff --git a/internal/functions/New-DbaLogShippingSecondaryPrimary.ps1 b/internal/functions/New-DbaLogShippingSecondaryPrimary.ps1 index f95ad16055..694d53c12b 100644 --- a/internal/functions/New-DbaLogShippingSecondaryPrimary.ps1 +++ b/internal/functions/New-DbaLogShippingSecondaryPrimary.ps1 @@ -81,7 +81,7 @@ function New-DbaLogShippingSecondaryPrimary { .EXAMPLE New-DbaLogShippingSecondaryPrimary -SqlInstance sql2 -BackupSourceDirectory "\\sql1\logshipping\DB1" -BackupDestinationDirectory D:\Data\logshippingdestination\DB1_DR -CopyJob LSCopy_sql2_DB1_DR -FileRetentionPeriod 4320 -MonitorServer sql2 -MonitorServerSecurityMode 'Windows' -PrimaryServer sql1 -PrimaryDatabase DB1 -RestoreJob LSRestore_sql2_DB1_DR - #> + #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] param ( [parameter(Mandatory)] @@ -220,5 +220,4 @@ function New-DbaLogShippingSecondaryPrimary { } Write-Message -Message "Finished configuring of secondary database to primary database $PrimaryDatabase." -Level Verbose -} - +} \ No newline at end of file diff --git a/internal/functions/New-DbaMessageLevelModifier.ps1 b/internal/functions/New-DbaMessageLevelModifier.ps1 index 5cd1130069..6212311452 100644 --- a/internal/functions/New-DbaMessageLevelModifier.ps1 +++ b/internal/functions/New-DbaMessageLevelModifier.ps1 @@ -2,23 +2,23 @@ function New-DbaMessageLevelModifier { <# .SYNOPSIS Allows modifying message levels by powerful filters. - + .DESCRIPTION Allows modifying message levels by powerful filters. - + This is designed to allow a developer to have more control over what is written how during the development process. It also allows a debug user to fine tune what he is shown. - + This functionality is NOT designed for default implementation within a module. Instead, set healthy message levels for your own messages and leave others to tend to their own levels. - + Note: Adding too many level modifiers may impact performance, use with discretion. - + .PARAMETER Name The name of the level modifier. Can be arbitrary, but must be unique. Not case sensitive. - + .PARAMETER Modifier The level modifier to apply. - Use a negative value to make a message more relevant @@ -27,107 +27,105 @@ function New-DbaMessageLevelModifier { - 1-3 : Written to host and debug by default - 4-6 : Written to verbose and debug by default - 7-9 : Internas, written only to debug - + .PARAMETER IncludeFunctionName Only messages from functions with one of these exact names will be considered. - + .PARAMETER ExcludeFunctionName Messages from functions with one of these exact names will be ignored. - + .PARAMETER IncludeModuleName Only messages from modules with one of these exact names will be considered. - + .PARAMETER ExcludeModuleName Messages from module with one of these exact names will be ignored. - + .PARAMETER IncludeTags Only messages that contain one of these tags will be considered. - + .PARAMETER ExcludeTags Messages that contain one of these tags will be ignored. - + .PARAMETER EnableException This parameters disables user-friendly warnings and enables the throwing of exceptions. This is less user friendly, but allows catching exceptions in calling scripts. - + .EXAMPLE PS C:\> New-DbaMessageLevelModifier -Name 'MyModule-Include' -Modifier -9 -IncludeModuleName MyModule PS C:\> New-DbaMessageLevelModifier -Name 'MyModule-Exclude' -Modifier 9 -ExcludeModuleName MyModule - + These settings will cause all messages from the module 'MyModule' to be highly prioritized and almost certainly written to host. It will also make it highly unlikely, that messages from other modules will even be considered for anything but the lowest level. - + This is useful when prioritizing your own module during development. -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( [Parameter(Mandatory)] [string] $Name, - + [Parameter(Mandatory)] [int] $Modifier, - + [string] $IncludeFunctionName, - + [string] $ExcludeFunctionName, - + [string] $IncludeModuleName, - + [string] $ExcludeModuleName, - + [string[]] $IncludeTags, - + [string[]] $ExcludeTags, - + [switch] $EnableException ) - + if (Test-Bound -ParameterName IncludeFunctionName, ExcludeFunctionName, IncludeModuleName, ExcludeModuleName, IncludeTags, ExcludeTags -Not) { Stop-Function -Message "Must specify at least one condition in order to apply message level modifier!" -EnableException $EnableException -Category InvalidArgument return } - + $levelModifier = New-Object Sqlcollaborative.Dbatools.Message.MessageLevelModifier $levelModifier.Name = $Name.ToLower() $levelModifier.Modifier = $Modifier - + if (Test-Bound -ParameterName IncludeFunctionName) { $levelModifier.IncludeFunctionName = $IncludeFunctionName } - + if (Test-Bound -ParameterName ExcludeFunctionName) { $levelModifier.ExcludeFunctionName = $ExcludeFunctionName } - + if (Test-Bound -ParameterName IncludeModuleName) { $levelModifier.IncludeModuleName = $IncludeModuleName } - + if (Test-Bound -ParameterName ExcludeModuleName) { $levelModifier.ExcludeModuleName = $ExcludeModuleName } - + if (Test-Bound -ParameterName IncludeTags) { $levelModifier.IncludeTags = $IncludeTags } - + if (Test-Bound -ParameterName ExcludeTags) { $levelModifier.ExcludeTags = $ExcludeTags } - - [Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers[$levelModifier.Name] = $levelModifier - - $levelModifier -} + [Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers[$levelModifier.Name] = $levelModifier + $levelModifier +} \ No newline at end of file diff --git a/internal/functions/New-DbaTeppCompletionResult.ps1 b/internal/functions/New-DbaTeppCompletionResult.ps1 index 95aa65fb39..3d58d79a16 100644 --- a/internal/functions/New-DbaTeppCompletionResult.ps1 +++ b/internal/functions/New-DbaTeppCompletionResult.ps1 @@ -26,7 +26,7 @@ function global:New-DbaTeppCompletionResult { New-DbaTeppCompletionResult -CompletionText 'master' -ToolTip 'master' Returns a CompletionResult with the text and tooltip 'master' - #> + #> param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory, ValueFromPipeline)] [ValidateNotNullOrEmpty()] @@ -76,5 +76,4 @@ function global:New-DbaTeppCompletionResult { } } -(Get-Item Function:\New-DbaTeppCompletionResult).Visibility = "Private" - +(Get-Item Function:\New-DbaTeppCompletionResult).Visibility = "Private" \ No newline at end of file diff --git a/internal/functions/Register-DbaMaintenanceTask.ps1 b/internal/functions/Register-DbaMaintenanceTask.ps1 index d5eb52b040..7a0e50e4fa 100644 --- a/internal/functions/Register-DbaMaintenanceTask.ps1 +++ b/internal/functions/Register-DbaMaintenanceTask.ps1 @@ -39,7 +39,7 @@ function Register-DbaMaintenanceTask { .EXAMPLE PS C:\> Register-DbaMaintenanceTask -Name 'value1' -ScriptBlock $ScriptBlock -Once - #> + #> [CmdletBinding()] param ( @@ -101,5 +101,4 @@ function Register-DbaMaintenanceTask { [Sqlcollaborative.Dbatools.Maintenance.MaintenanceHost]::Tasks[$Name.ToLower()] = $task } #endregion New Task -} - +} \ No newline at end of file diff --git a/internal/functions/Register-DbaMessageEvent.ps1 b/internal/functions/Register-DbaMessageEvent.ps1 index a28a2e06fb..de6022f4f8 100644 --- a/internal/functions/Register-DbaMessageEvent.ps1 +++ b/internal/functions/Register-DbaMessageEvent.ps1 @@ -2,126 +2,125 @@ function Register-DbaMessageEvent { <# .SYNOPSIS Registers an event to when a message is written. - + .DESCRIPTION Registers an event to when a message is written. These events will fire whenever the written message fulfills the specified filter criteria. - + This allows integrating direct alerts and reactions to messages as they occur. - + Warnings: - Adding many subscriptions can impact overall performance, even without triggering. - Events are executed synchronously. executing complex operations may introduce a significant delay to the command execution. - + It is recommended to push processing that involves outside resources to a separate runspace, then use the event to pass the object as trigger. The TaskEngine component may prove to be just what is needed to accomplish this. - + .PARAMETER Name The name of the subscription. Each subscription must have a name, subscriptions of equal name will overwrite each other. This is in order to avoid having runspace uses explode the number of subscriptions on each invocation. - + .PARAMETER ScriptBlock The scriptblock to execute. It will receive the message entry (as returned by Get-DbatoolsLog) as its sole argument. - + .PARAMETER MessageFilter Filter by message content. Understands wildcards, but not regex. - + .PARAMETER ModuleNameFilter Filter by Name of the module, from which the message comes. Understands wildcards, but not regex. - + .PARAMETER FunctionNameFilter Filter by Name of the function, from which the message comes. Understands wildcards, but not regex. - + .PARAMETER TargetFilter Filter by target object. Performs equality comparison on an object level. - + .PARAMETER LevelFilter Include only messages of the specified levels. - + .PARAMETER TagFilter Only include messages with any of the specified tags. - + .PARAMETER RunspaceFilter Only include messages which were written by the specified runspace. You can find out the current runspace ID by running this: [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace.InstanceId You can retrieve the primary runspace - the Guid used by the runspace the user sees - by running this: [Sqlcollaborative.Dbatools.Utility.UtilityHost]::PrimaryRunspace - + .EXAMPLE PS C:\> Register-DbaMessageEvent -Name 'Mymodule.OffloadTrigger' -ScriptBlock $ScriptBlock -Tag 'engine' -Module 'MyModule' -Level Warning - + Registers an event subscription ... - Under the name 'Mymodule.OffloadTrigger' ... - To execute $ScriptBlock ... - Whenever a message is written with the tag 'engine' by the module 'MyModule' at the level 'Warning' -#> + #> [CmdletBinding(PositionalBinding = $false)] param ( [Parameter(Mandatory)] [string] $Name, - + [Parameter(Mandatory)] [System.Management.Automation.ScriptBlock] $ScriptBlock, - + [string] $MessageFilter, - + [string] $ModuleNameFilter, - + [string] $FunctionNameFilter, - + $TargetFilter, - + [Sqlcollaborative.Dbatools.Message.MessageLevel[]] $LevelFilter, - + [string[]] $TagFilter, - + [System.Guid] $RunspaceFilter ) - + $newName = $Name.ToLower() $eventSubscription = New-Object Sqlcollaborative.Dbatools.Message.MessageEventSubscription $eventSubscription.Name = $newName $eventSubscription.ScriptBlock = $ScriptBlock - + if (Test-Bound -ParameterName MessageFilter) { $eventSubscription.MessageFilter = $MessageFilter } - + if (Test-Bound -ParameterName ModuleNameFilter) { $eventSubscription.ModuleNameFilter = $ModuleNameFilter } - + if (Test-Bound -ParameterName FunctionNameFilter) { $eventSubscription.FunctionNameFilter = $FunctionNameFilter } - + if (Test-Bound -ParameterName TargetFilter) { $eventSubscription.TargetFilter = $TargetFilter } - + if (Test-Bound -ParameterName LevelFilter) { $eventSubscription.LevelFilter = $LevelFilter } - + if (Test-Bound -ParameterName TagFilter) { $eventSubscription.TagFilter = $TagFilter } - + if (Test-Bound -ParameterName RunspaceFilter) { $eventSubscription.RunspaceFilter = $RunspaceFilter } - - [Sqlcollaborative.Dbatools.Message.MessageHost]::Events[$newName] = $eventSubscription -} + [Sqlcollaborative.Dbatools.Message.MessageHost]::Events[$newName] = $eventSubscription +} \ No newline at end of file diff --git a/internal/functions/Register-DbaMessageTransform.ps1 b/internal/functions/Register-DbaMessageTransform.ps1 index 232581a333..afef31e582 100644 --- a/internal/functions/Register-DbaMessageTransform.ps1 +++ b/internal/functions/Register-DbaMessageTransform.ps1 @@ -2,120 +2,119 @@ function Register-DbaMessageTransform { <# .SYNOPSIS Registers a scriptblock that can transform message content. - + .DESCRIPTION Registers a scriptblock that can transform message content. This can be used to convert some kinds of input. Specifically: - + Target: When specifying a target, this target may require some conversion. For example, an object containing a live connection may need to have a static copy stored instead, as otherwise its export on a different runspace may cause access violations. - + Exceptions: Some exceptions may need transforming. For example some APIs might wrap the actual exception into a common wrapper. In this scenario you may want the actual exception in order to provide more specific information. - + In all instances, the scriptblock will be called, receiving only the relevant object as its sole input. - + Note: This transformation is performed synchronously on the active runspace. Complex scriptblocks may delay execution times when a matching object is passed. - + .PARAMETER TargetType The full typename of the target object to apply the scriptblock to. All objects of that typename will be processed through that scriptblock. - + .PARAMETER ExceptionType The full typename of the exception object to apply the scriptblock to. All objects of that typename will be processed through that scriptblock. Note: In case of error records, the type of the Exception Property is inspected. The error record as a whole will not be touched, except for having its exception exchanged. - + .PARAMETER ScriptBlock The scriptblock that performs the transformation. - + .PARAMETER TargetTypeFilter A filter for the typename of the target object to transform. Supports wildcards, but not regex. WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them! - + .PARAMETER ExceptionTypeFilter A filter for the typename of the exception object to transform. Supports wildcards, but not regex. WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them! - + .PARAMETER FunctionNameFilter Default: "*" Allows filtering by function name, in order to consider whether the function is affected. Supports wildcards, but not regex. WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them! - + .PARAMETER ModuleNameFilter Default: "*" Allows filtering by module name, in order to consider whether the function is affected. Supports wildcards, but not regex. WARNING: Adding too many filter-type transforms may impact overall performance, try to avoid using them! - + .EXAMPLE PS C:\> Register-DbaMessageTransform -TargetType 'mymodule.category.classname' -ScriptBlock $ScriptBlock - + Whenever a target object of type 'mymodule.category.classname' is specified, invoke $ScriptBlock (with the object as sole argument) and store the result as target instead. - + .EXAMPLE PS C:\> Register-DbaMessageTransform -ExceptionType 'mymodule.category.exceptionname' -ScriptBlock $ScriptBlock - + Whenever an exception or error record of type 'mymodule.category.classname' is specified, invoke $ScriptBlock (with the object as sole argument) and store the result as exception instead. If the full error record is specified, only the updated exception will be inserted - + .EXAMPLE PS C:\> Register-DbaMessageTransform -TargetTypeFilter 'mymodule.category.*' -ScriptBlock $ScriptBlock - + Adds a transform for all target objects that are of a type whose full name starts with 'mymodule.category.' All target objects matching that typename will be run through the specified scriptblock, which in return generates the new target object. -#> + #> [CmdletBinding(PositionalBinding = $false)] param ( [Parameter(Mandatory, ParameterSetName = "Target")] [string] $TargetType, - + [Parameter(Mandatory, ParameterSetName = "Exception")] [string] $ExceptionType, - + [Parameter(Mandatory)] [ScriptBlock] $ScriptBlock, - + [Parameter(Mandatory, ParameterSetName = "TargetFilter")] [string] $TargetTypeFilter, - + [Parameter(Mandatory, ParameterSetName = "ExceptionFilter")] [string] $ExceptionTypeFilter, - + [Parameter(ParameterSetName = "TargetFilter")] [Parameter(ParameterSetName = "ExceptionFilter")] $FunctionNameFilter = "*", - + [Parameter(ParameterSetName = "TargetFilter")] [Parameter(ParameterSetName = "ExceptionFilter")] $ModuleNameFilter = "*" ) - + process { if ($TargetType) { [Sqlcollaborative.Dbatools.Message.MessageHost]::TargetTransforms[$TargetType.ToLower()] = $ScriptBlock } if ($ExceptionType) { [Sqlcollaborative.Dbatools.Message.MessageHost]::ExceptionTransforms[$ExceptionType.ToLower()] = $ScriptBlock } - + if ($TargetTypeFilter) { $condition = New-Object Sqlcollaborative.Dbatools.Message.TransformCondition($TargetTypeFilter, $ModuleNameFilter, $FunctionNameFilter, $ScriptBlock, "Target") [Sqlcollaborative.Dbatools.Message.MessageHost]::TargetTransformList.Add($condition) } - + if ($ExceptionTypeFilter) { $condition = New-Object Sqlcollaborative.Dbatools.Message.TransformCondition($ExceptionTypeFilter, $ModuleNameFilter, $FunctionNameFilter, $ScriptBlock, "Exception") [Sqlcollaborative.Dbatools.Message.MessageHost]::ExceptionTransformList.Add($condition) } } -} - +} \ No newline at end of file diff --git a/internal/functions/Register-DbaRunspace.ps1 b/internal/functions/Register-DbaRunspace.ps1 index 0d9eaf0207..dc250dfc19 100644 --- a/internal/functions/Register-DbaRunspace.ps1 +++ b/internal/functions/Register-DbaRunspace.ps1 @@ -37,7 +37,7 @@ function Register-DbaRunspace { Registers the script defined in $scriptBlock under the name 'mymodule.maintenance' Then it starts the runspace, running the registered $scriptBlock -#> + #> [CmdletBinding(PositionalBinding = $false)] param ( @@ -61,6 +61,4 @@ function Register-DbaRunspace { Write-Message -Level Verbose -Message "Registering runspace: $($Name.ToLower())" -Target $Name.ToLower() [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces[$Name.ToLower()] = New-Object Sqlcollaborative.Dbatools.Runspace.RunspaceContainer($Name.ToLower(), $ScriptBlock) } -} - - +} \ No newline at end of file diff --git a/internal/functions/Register-DbaTeppArgumentCompleter.ps1 b/internal/functions/Register-DbaTeppArgumentCompleter.ps1 index 9a8089501a..c56a6b7d1e 100644 --- a/internal/functions/Register-DbaTeppArgumentCompleter.ps1 +++ b/internal/functions/Register-DbaTeppArgumentCompleter.ps1 @@ -27,7 +27,7 @@ function Register-DbaTeppArgumentCompleter { Register-DbaTeppArgumentCompleter -Command Get-DbaBackupHistory -Parameter Database Registers the "Database" parameter of the Get-DbaBackupHistory to receive Database-Tepp - #> + #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingEmptyCatchBlock", "")] param ( @@ -82,6 +82,4 @@ function Register-DbaTeppArgumentCompleter { Register-ArgumentCompleter -CommandName $Command -ParameterName $p -ScriptBlock $scriptBlock } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Register-DbaTeppInstanceCacheBuilder.ps1 b/internal/functions/Register-DbaTeppInstanceCacheBuilder.ps1 index a08da92c3a..b98ab52876 100644 --- a/internal/functions/Register-DbaTeppInstanceCacheBuilder.ps1 +++ b/internal/functions/Register-DbaTeppInstanceCacheBuilder.ps1 @@ -32,7 +32,7 @@ function Register-DbaTeppInstanceCacheBuilder { .NOTES Additional information about the function. - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -48,6 +48,4 @@ function Register-DbaTeppInstanceCacheBuilder { } elseif ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppGatherScriptsFast -notcontains $ScriptBlock) { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppGatherScriptsFast.Add($ScriptBlock) } -} - - +} \ No newline at end of file diff --git a/internal/functions/Register-DbaTeppScriptBlock.ps1 b/internal/functions/Register-DbaTeppScriptBlock.ps1 index 8f1420e628..e6e9b53b7d 100644 --- a/internal/functions/Register-DbaTeppScriptBlock.ps1 +++ b/internal/functions/Register-DbaTeppScriptBlock.ps1 @@ -16,7 +16,7 @@ function Register-DbaTeppScriptblock { Register-DbaTeppScriptblock -ScriptBlock $scriptBlock -Name MyFirstTeppScriptBlock Stores the scriptblock stored in $scriptBlock under the name "MyFirstTeppScriptBlock" - #> + #> [CmdletBinding()] param ( [System.Management.Automation.ScriptBlock] @@ -32,6 +32,4 @@ function Register-DbaTeppScriptblock { $scp.LastDuration = New-TimeSpan -Seconds -1 [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::Scripts[$Name.ToLower()] = $scp -} - - +} \ No newline at end of file diff --git a/internal/functions/Register-DbatoolsConfigValidation.ps1 b/internal/functions/Register-DbatoolsConfigValidation.ps1 index 79bed0aa78..cc92b57274 100644 --- a/internal/functions/Register-DbatoolsConfigValidation.ps1 +++ b/internal/functions/Register-DbatoolsConfigValidation.ps1 @@ -24,7 +24,7 @@ function Register-DbatoolsConfigValidation { PS C:\> Register-DbatoolsConfigValidation -Name IntPositive -ScriptBlock $scriptblock Registers the scriptblock stored in $scriptblock as validation with the name IntPositive - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -37,5 +37,4 @@ function Register-DbatoolsConfigValidation { ) [Sqlcollaborative.Dbatools.Configuration.ConfigurationHost]::Validation[$Name.ToLower()] = $ScriptBlock -} - +} \ No newline at end of file diff --git a/internal/functions/Remove-DbaMessageLevelModifier.ps1 b/internal/functions/Remove-DbaMessageLevelModifier.ps1 index b387c8bcfd..36b2376161 100644 --- a/internal/functions/Remove-DbaMessageLevelModifier.ps1 +++ b/internal/functions/Remove-DbaMessageLevelModifier.ps1 @@ -2,52 +2,52 @@ function Remove-DbaMessageLevelModifier { <# .SYNOPSIS Removes a message level modifier. - + .DESCRIPTION Removes a message level modifier. - + Message Level Modifiers can be created by using New-DbaMessageLevelModifier. They are used to emphasize or deemphasize messages, in order to help with debugging. - + .PARAMETER Name Name of the message level modifier to remove. - + .PARAMETER Modifier The actual modifier to remove, as returned by Get-DbaMessageLevelModifier. - + .PARAMETER EnableException This parameters disables user-friendly warnings and enables the throwing of exceptions. This is less user friendly, but allows catching exceptions in calling scripts. - + .EXAMPLE PS C:\> Get-DbaMessageLevelModifier | Remove-DbaMessageLevelModifier - + Removes all message level modifiers, restoring everything to their default levels. - + .EXAMPLE PS C:\> Remove-DbaMessageLevelModifier -Name "mymodule.foo" - + Removes the message level modifier named "mymodule.foo" -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] [string[]] $Name, - + [Parameter(ValueFromPipeline)] [Sqlcollaborative.Dbatools.Message.MessageLevelModifier[]] $Modifier, - + [switch] $EnableException ) - + process { foreach ($item in $Name) { if ($item -eq "Sqlcollaborative.Dbatools.Message.MessageLevelModifier") { continue } - + if ([Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers.ContainsKey($item.ToLower())) { [Sqlcollaborative.Dbatools.Message.MessageHost]::MessageLevelModifiers.Remove($item.ToLower()) } else { @@ -62,5 +62,4 @@ function Remove-DbaMessageLevelModifier { } } } -} - +} \ No newline at end of file diff --git a/internal/functions/Remove-InvalidFileNameChars.ps1 b/internal/functions/Remove-InvalidFileNameChars.ps1 index 1bddac67f7..a43dab1417 100644 --- a/internal/functions/Remove-InvalidFileNameChars.ps1 +++ b/internal/functions/Remove-InvalidFileNameChars.ps1 @@ -10,5 +10,4 @@ Function Remove-InvalidFileNameChars { $invalidChars = [IO.Path]::GetInvalidFileNameChars() -join '' $re = "[{0}]" -f [RegEx]::Escape($invalidChars) return ($Name -replace $re) -} - +} \ No newline at end of file diff --git a/internal/functions/Resolve-IpAddress.ps1 b/internal/functions/Resolve-IpAddress.ps1 index 5f102bed84..993b621efe 100644 --- a/internal/functions/Resolve-IpAddress.ps1 +++ b/internal/functions/Resolve-IpAddress.ps1 @@ -12,6 +12,4 @@ function Resolve-IpAddress { } else { return $ipaddress = ((Test-Connection $server.Split('\')[0] -Count 1 -ErrorAction SilentlyContinue).Ipv4Address).IPAddressToString } -} - - +} \ No newline at end of file diff --git a/internal/functions/Resolve-NetBiosName.ps1 b/internal/functions/Resolve-NetBiosName.ps1 index f31a239352..e0b16fa0fe 100644 --- a/internal/functions/Resolve-NetBiosName.ps1 +++ b/internal/functions/Resolve-NetBiosName.ps1 @@ -2,7 +2,7 @@ function Resolve-NetBiosName { <# .SYNOPSIS Internal function. Takes a best guess at the NetBIOS name of a server. - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -12,5 +12,4 @@ Internal function. Takes a best guess at the NetBIOS name of a server. ) $server = Connect-SqlInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential $server.ComputerName -} - +} \ No newline at end of file diff --git a/internal/functions/Resolve-SqlIpAddress.ps1 b/internal/functions/Resolve-SqlIpAddress.ps1 index 159b4531f7..f96a93c4dc 100644 --- a/internal/functions/Resolve-SqlIpAddress.ps1 +++ b/internal/functions/Resolve-SqlIpAddress.ps1 @@ -11,6 +11,4 @@ function Resolve-SqlIpAddress { $servernetbios = $server.ComputerNamePhysicalNetBIOS $ipaddr = (Test-Connection $servernetbios -count 1).Ipv4Address return $ipaddr -} - - +} \ No newline at end of file diff --git a/internal/functions/Select-DefaultView.ps1 b/internal/functions/Select-DefaultView.ps1 index e021a92903..5fe1b2e7f4 100644 --- a/internal/functions/Select-DefaultView.ps1 +++ b/internal/functions/Select-DefaultView.ps1 @@ -9,36 +9,36 @@ function Select-DefaultView { https://learn-powershell.net/2013/08/03/quick-hits-set-the-default-property-display-in-powershell-on-custom-objects/ TypeName creates a new type so that we can use ps1xml to modify the output - #> - + #> + [CmdletBinding()] param ( [parameter(ValueFromPipeline)] [object] $InputObject, - + [string[]] $Property, - + [string[]] $ExcludeProperty, - + [string] $TypeName ) process { - + if ($null -eq $InputObject) { return } - + if ($TypeName) { $InputObject.PSObject.TypeNames.Insert(0, "dbatools.$TypeName") } - + if ($ExcludeProperty) { if ($InputObject.GetType().Name.ToString() -eq 'DataRow') { $ExcludeProperty += 'Item', 'RowError', 'RowState', 'Table', 'ItemArray', 'HasErrors' } - + $props = ($InputObject | Get-Member | Where-Object MemberType -in 'Property', 'NoteProperty', 'AliasProperty' | Where-Object { $_.Name -notin $ExcludeProperty }).Name $defaultset = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet', [string[]]$props) } else { @@ -59,13 +59,12 @@ function Select-DefaultView { } $defaultset = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet', [string[]]$Property) } - + $standardmembers = [System.Management.Automation.PSMemberInfo[]]@($defaultset) - + # Do not be tempted to not pipe here $inputobject | Add-Member -Force -MemberType MemberSet -Name PSStandardMembers -Value $standardmembers -ErrorAction SilentlyContinue - + $inputobject } -} - +} \ No newline at end of file diff --git a/internal/functions/Set-ServiceStartMode.ps1 b/internal/functions/Set-ServiceStartMode.ps1 index c9d81b7337..707520b051 100644 --- a/internal/functions/Set-ServiceStartMode.ps1 +++ b/internal/functions/Set-ServiceStartMode.ps1 @@ -36,7 +36,7 @@ function Set-ServiceStartMode { Sets all SQL services on sql1 to Automatic startup. -#> + #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [string]$Mode, @@ -69,5 +69,4 @@ function Set-ServiceStartMode { } } } -} - +} \ No newline at end of file diff --git a/internal/functions/Set-WmiFilestreamSetting.ps1 b/internal/functions/Set-WmiFilestreamSetting.ps1 index 1f91b0fb65..067a6c6cce 100644 --- a/internal/functions/Set-WmiFilestreamSetting.ps1 +++ b/internal/functions/Set-WmiFilestreamSetting.ps1 @@ -49,7 +49,7 @@ function Set-FileSystemSetting { } } } - + function Get-WmiFilestreamSetting { # not available in SQL WMI [CmdletBinding()] @@ -57,21 +57,21 @@ function Set-FileSystemSetting { [DbaInstance]$Instance, [PSCredential]$Credential ) - + $computer = $computerName = $Machine = $instance.ComputerName $instanceName = $instance.InstanceName - + Write-Message -Level Verbose -Message "Attempting to connect to $computer's WMI" $ognamespace = Get-DbaCmObject -EnableException -ComputerName $computerName -Namespace root\Microsoft\SQLServer -Query "SELECT NAME FROM __NAMESPACE WHERE NAME LIKE 'ComputerManagement%'" $namespace = $ognamespace | Where-Object { (Get-DbaCmObject -EnableException -ComputerName $computerName -Namespace $("root\Microsoft\SQLServer\" + $_.Name) -ClassName FilestreamSettings).Count -gt 0 } | Sort-Object Name -Descending | Select-Object -First 1 - + if (-not $namespace) { $namespace = $ognamespace } - + if ($namespace.Name) { if ($Credential) { $wmi = Get-WmiObject -Credential $Credential -ErrorAction Stop -ComputerName $computerName -Namespace $("root\Microsoft\SQLServer\" + $namespace.Name) -Class FilestreamSettings | Where-Object InstanceName -eq $instanceName | Select-Object -First 1 @@ -98,4 +98,4 @@ function Set-FileSystemSetting { } $returnvalue } -} +} \ No newline at end of file diff --git a/internal/functions/Show-Notification.ps1 b/internal/functions/Show-Notification.ps1 index 477fcb3854..d73673b04d 100644 --- a/internal/functions/Show-Notification.ps1 +++ b/internal/functions/Show-Notification.ps1 @@ -35,5 +35,4 @@ function Show-Notification { $notify = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($appId) $notify.Show($toastXml) -} - +} \ No newline at end of file diff --git a/internal/functions/Start-DbaRunspace.ps1 b/internal/functions/Start-DbaRunspace.ps1 index 3f20cf4ffc..681c81f85e 100644 --- a/internal/functions/Start-DbaRunspace.ps1 +++ b/internal/functions/Start-DbaRunspace.ps1 @@ -22,7 +22,7 @@ function Start-DbaRunspace { PS C:\> Start-DbaRunspace -Name 'mymodule.maintenance' Starts the runspace registered under the name 'mymodule.maintenance' -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] @@ -63,6 +63,4 @@ function Start-DbaRunspace { } } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Start-DbccCheck.ps1 b/internal/functions/Start-DbccCheck.ps1 index edc3f8aa73..d81c4243d6 100644 --- a/internal/functions/Start-DbccCheck.ps1 +++ b/internal/functions/Start-DbccCheck.ps1 @@ -38,6 +38,4 @@ function Start-DbccCheck { return $message.Trim() } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Stop-DbaRunspace.ps1 b/internal/functions/Stop-DbaRunspace.ps1 index b5f165c3ac..f09696ed7e 100644 --- a/internal/functions/Stop-DbaRunspace.ps1 +++ b/internal/functions/Stop-DbaRunspace.ps1 @@ -29,7 +29,7 @@ function Stop-DbaRunspace { PS C:\> Stop-DbaRunspace -Name 'mymodule.maintenance' Stops the runspace registered under the name 'mymodule.maintenance' -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( @@ -71,6 +71,4 @@ function Stop-DbaRunspace { } } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Stop-Function.ps1 b/internal/functions/Stop-Function.ps1 index e8d11114f7..a460e7d685 100644 --- a/internal/functions/Stop-Function.ps1 +++ b/internal/functions/Stop-Function.ps1 @@ -4,96 +4,96 @@ function Stop-Function { <# .SYNOPSIS Function that interrupts a function. - + .DESCRIPTION Function that interrupts a function. - + This function is a utility function used by other functions to reduce error catching overhead. It is designed to allow gracefully terminating a function with a warning by default and also allow opt-in into terminating errors. It also allows simple integration into loops. - + Note: When calling this function with the intent to terminate the calling function in non-EnableException mode too, you need to add a return below the call. - + .PARAMETER Message A message to pass along, explaining just what the error was. - + .PARAMETER EnableException 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. - + .PARAMETER Category What category does this termination belong to? Mandatory so long as no inner exception is passed. - + .PARAMETER ErrorRecord An option to include an inner exception in the error record (and in the exception thrown, if one is thrown). Use this, whenever you call Stop-Function in a catch block. - + Note: Pass the full error record, not just the exception. - + .PARAMETER Tag Tags to add to the message written. This allows filtering and grouping by category of message, targeting specific messages. - + .PARAMETER FunctionName The name of the function to crash. This parameter is very optional, since it automatically selects the name of the calling function. The function name is used as part of the errorid. That in turn allows easily figuring out, which exception belonged to which function when checking out the $error variable. - + .PARAMETER File The file in which Stop-PSFFunction was called. Will be automatically set, but can be overridden when necessary. - + .PARAMETER Line The line on which Stop-PSFFunction was called. Will be automatically set, but can be overridden when necessary. - + .PARAMETER Target The object that was processed when the error was thrown. For example, if you were trying to process a Database Server object when the processing failed, add the object here. This object will be in the error record (which will be written, even in non-EnableException mode, just won't show it). If you specify such an object, it becomes simple to actually figure out, just where things failed at. - + .PARAMETER Exception Allows specifying an inner exception as input object. This will be passed on to the logging and used for messages. When specifying both ErrorRecord AND Exception, Exception wins, but ErrorRecord is still used for record metadata. - + .PARAMETER OverrideExceptionMessage Disables automatic appending of exception messages. Use in cases where you already have a speaking message interpretation and do not need the original message. - + .PARAMETER Continue This will cause the function to call continue while not running silently. Useful when mass-processing items where an error shouldn't break the loop. - + .PARAMETER SilentlyContinue This will cause the function to call continue while running silently. Useful when mass-processing items where an error shouldn't break the loop. - + .PARAMETER ContinueLabel When specifying a label in combination with "-Continue" or "-SilentlyContinue", this function will call continue with this specified label. Helpful when trying to continue on an upper level named loop. - + .EXAMPLE Stop-Function -Message "Foo failed bar!" -EnableException $EnableException -ErrorRecord $_ return - + Depending on whether $EnableException is true or false it will: - Throw a bloody terminating error. Game over. - Write a nice warning about how Foo failed bar, then terminate the function. The return on the next line will then end the calling function. - + .EXAMPLE Stop-Function -Message "Foo failed bar!" -EnableException $EnableException -Category InvalidOperation -Target $foo -Continue - + Depending on whether $silent is true or false it will: - Throw a bloody terminating error. Game over. - Write a nice warning about how Foo failed bar, then call continue to process the next item in the loop. In both cases, the error record added to $error will have the content of $foo added, the better to figure out what went wrong. -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding(DefaultParameterSetName = 'Plain')] param ( @@ -114,16 +114,16 @@ function Stop-Function { [Alias('InnerErrorRecord')] [System.Management.Automation.ErrorRecord[]] $ErrorRecord, - + [string[]] $Tag, [string] $FunctionName = ((Get-PSCallStack)[0].Command), - + [string] $File, - + [int] $Line, @@ -145,7 +145,7 @@ function Stop-Function { [string] $ContinueLabel ) - + #region Initialize information on the calling command $callStack = (Get-PSCallStack)[1] if (-not $FunctionName) { $FunctionName = $callStack.Command } @@ -153,14 +153,14 @@ function Stop-Function { if (-not $File) { $File = $callStack.Position.File } if (-not $Line) { $Line = $callStack.Position.StartLineNumber } #endregion Initialize information on the calling command - + #region Apply Transforms #region Target Transform if ($null -ne $Target) { $Target = Convert-DbaMessageTarget -Target $Target -FunctionName $FunctionName -ModuleName $ModuleName } #endregion Target Transform - + #region Exception Transforms if ($Exception) { $Exception = Convert-DbaMessageException -Exception $Exception -FunctionName $FunctionName -ModuleName $ModuleName @@ -171,7 +171,7 @@ function Stop-Function { if ($tempException -ne $ErrorRecord[$int].Exception) { $ErrorRecord[$int] = New-Object System.Management.Automation.ErrorRecord($tempException, $ErrorRecord[$int].FullyQualifiedErrorId, $ErrorRecord[$int].CategoryInfo.Category, $ErrorRecord[$int].TargetObject) } - + $int++ } } @@ -193,14 +193,14 @@ function Stop-Function { } else { $records += New-Object System.Management.Automation.ErrorRecord($Exception, "$($ModuleName)_$FunctionName", $Category, $Target) } - + # Manage Debugging if ($EnableException) { Write-Message -Level Warning -Message $Message -EnableException $EnableException -FunctionName $FunctionName -Target $Target -ErrorRecord $records -Tag $Tag -ModuleName $ModuleName -OverrideExceptionMessage:$OverrideExceptionMessage -File $File -Line $Line 3>$null } else { Write-Message -Level Warning -Message $Message -EnableException $EnableException -FunctionName $FunctionName -Target $Target -ErrorRecord $records -Tag $Tag -ModuleName $ModuleName -OverrideExceptionMessage:$OverrideExceptionMessage -File $File -Line $Line } } else { $exception = New-Object System.Exception($Message) $records += New-Object System.Management.Automation.ErrorRecord($Exception, "dbatools_$FunctionName", $Category, $Target) - + # Manage Debugging if ($EnableException) { Write-Message -Level Warning -Message $Message -EnableException $EnableException -FunctionName $FunctionName -Target $Target -ErrorRecord $records -Tag $Tag -ModuleName $ModuleName -OverrideExceptionMessage:$true -File $File -Line $Line 3>$null} else { Write-Message -Level Warning -Message $Message -EnableException $EnableException -FunctionName $FunctionName -Target $Target -ErrorRecord $records -Tag $Tag -ModuleName $ModuleName -OverrideExceptionMessage:$true -File $File -Line $Line } @@ -242,5 +242,4 @@ function Stop-Function { } } #endregion Non-EnableException Mode -} - +} \ No newline at end of file diff --git a/internal/functions/Test-Bound.ps1 b/internal/functions/Test-Bound.ps1 index 4184e6969b..b5b4f6b50a 100644 --- a/internal/functions/Test-Bound.ps1 +++ b/internal/functions/Test-Bound.ps1 @@ -36,7 +36,7 @@ function Test-Bound { Test-Bound -And 'Login', 'Spid', 'ExcludeSpid', 'Host', 'Program', 'Database' Returns whether any of the specified parameters was not bound - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory, Position = 0)] @@ -69,5 +69,4 @@ function Test-Bound { } return ((-not $Not) -eq $test) -} - +} \ No newline at end of file diff --git a/internal/functions/Test-ComputerTarget.ps1 b/internal/functions/Test-ComputerTarget.ps1 index 19afa62bb5..f36235a98e 100644 --- a/internal/functions/Test-ComputerTarget.ps1 +++ b/internal/functions/Test-ComputerTarget.ps1 @@ -25,7 +25,7 @@ function Test-ComputerTarget { Will test, whether the names passed to it are legal targets. - The first two will pass, the last one will fail - Note that it will only return boolean values, so the order needs to be remembered (due to this, using it by pipeline on more than one object is not really recommended). -#> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline, Mandatory)] @@ -38,6 +38,4 @@ function Test-ComputerTarget { [Sqlcollaborative.Dbatools.Utility.Validation]::IsValidComputerTarget($ComputerName) } } -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-DbaDeprecation.ps1 b/internal/functions/Test-DbaDeprecation.ps1 index 43ea1ed1d3..9e6930b2b5 100644 --- a/internal/functions/Test-DbaDeprecation.ps1 +++ b/internal/functions/Test-DbaDeprecation.ps1 @@ -52,7 +52,7 @@ function Test-DbaDeprecation { Will - once per session - complain if the alias 'Copy-SqlDatabase' is used. Will cause tests to fail, if it's still in the code after release 1.0.0.0. - #> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] diff --git a/internal/functions/Test-DbaLsnChain.ps1 b/internal/functions/Test-DbaLsnChain.ps1 index 461f77f110..9925de877e 100644 --- a/internal/functions/Test-DbaLsnChain.ps1 +++ b/internal/functions/Test-DbaLsnChain.ps1 @@ -25,7 +25,7 @@ function Test-DbaLsnChain { Checks that the Restore chain in $FilteredFiles is complete and can be fully restored -#> + #> [CmdletBinding()] param ( [parameter(Mandatory, ValueFromPipeline)] @@ -119,6 +119,4 @@ function Test-DbaLsnChain { Write-Message -Level VeryVerbose -Message "Passed LSN Chain checks" return $true } -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-DbaRestoreVersion.ps1 b/internal/functions/Test-DbaRestoreVersion.ps1 index 36e80d6082..56b89377bc 100644 --- a/internal/functions/Test-DbaRestoreVersion.ps1 +++ b/internal/functions/Test-DbaRestoreVersion.ps1 @@ -34,7 +34,7 @@ function Test-DbaRestoreVersion { Checks that the Restore chain in $FilteredFiles is compatible with the SQL Server version of server1\instance1 -#> + #> [CmdletBinding()] param ( [parameter(Mandatory)] @@ -89,7 +89,4 @@ function Test-DbaRestoreVersion { $server.ConnectionContext.Disconnect() } return $True -} - - - +} \ No newline at end of file diff --git a/internal/functions/Test-ElevationRequirement.ps1 b/internal/functions/Test-ElevationRequirement.ps1 index 4e89011b80..a082e3bcc9 100644 --- a/internal/functions/Test-ElevationRequirement.ps1 +++ b/internal/functions/Test-ElevationRequirement.ps1 @@ -93,6 +93,4 @@ function Test-ElevationRequirement { . Stop-Function @splatStopFunction -FunctionName (Get-PSCallStack)[1].Command return $testResult } -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-FunctionInterrupt.ps1 b/internal/functions/Test-FunctionInterrupt.ps1 index ef0f79b6ad..bee9268582 100644 --- a/internal/functions/Test-FunctionInterrupt.ps1 +++ b/internal/functions/Test-FunctionInterrupt.ps1 @@ -20,7 +20,7 @@ function Test-FunctionInterrupt { if (Test-FunctionInterrupt) { return } The calling function will stop if this function returns true. - #> + #> [CmdletBinding()] param ( @@ -30,5 +30,4 @@ function Test-FunctionInterrupt { if ($var.Value) { return $true } return $false -} - +} \ No newline at end of file diff --git a/internal/functions/Test-HostOSLinux.ps1 b/internal/functions/Test-HostOSLinux.ps1 index d373c6c0a1..5119104b06 100644 --- a/internal/functions/Test-HostOSLinux.ps1 +++ b/internal/functions/Test-HostOSLinux.ps1 @@ -6,6 +6,4 @@ function Test-HostOSLinux { $server = Connect-SqlInstance -SqlInstance $SqlInstance -SqlCredential $sqlcredential $server.ConnectionContext.ExecuteScalar("SELECT @@VERSION") -match "Linux" -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-PSRemoting.ps1 b/internal/functions/Test-PSRemoting.ps1 index 14c30c9413..0835d87401 100644 --- a/internal/functions/Test-PSRemoting.ps1 +++ b/internal/functions/Test-PSRemoting.ps1 @@ -4,7 +4,7 @@ function Test-PSRemoting { <# Jeff Hicks https://www.petri.com/test-network-connectivity-powershell-test-connection-cmdlet -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUsePSCredentialType", "")] [Cmdletbinding()] param( @@ -27,6 +27,4 @@ function Test-PSRemoting { } #process -} #close function - - +} #close function \ No newline at end of file diff --git a/internal/functions/Test-SqlAgent.ps1 b/internal/functions/Test-SqlAgent.ps1 index 0558c7670d..67003693ba 100644 --- a/internal/functions/Test-SqlAgent.ps1 +++ b/internal/functions/Test-SqlAgent.ps1 @@ -2,7 +2,7 @@ function Test-SqlAgent { <# .SYNOPSIS Internal function. Checks to see if SQL Server Agent is running on a server. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -19,6 +19,4 @@ function Test-SqlAgent { if ($null -eq $SqlInstance.JobServer) { return $false } try { $null = $SqlInstance.JobServer.script(); return $true } catch { return $false } -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-SqlLoginAccess.ps1 b/internal/functions/Test-SqlLoginAccess.ps1 index c3e04276e1..df70f1df1f 100644 --- a/internal/functions/Test-SqlLoginAccess.ps1 +++ b/internal/functions/Test-SqlLoginAccess.ps1 @@ -2,7 +2,7 @@ function Test-SqlLoginAccess { <# .SYNOPSIS Internal function. Ensures login has access on SQL Server. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -30,6 +30,4 @@ function Test-SqlLoginAccess { } } return $true -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-SqlQueryComplete.ps1 b/internal/functions/Test-SqlQueryComplete.ps1 index 2b6362d66a..886fad3a3e 100644 --- a/internal/functions/Test-SqlQueryComplete.ps1 +++ b/internal/functions/Test-SqlQueryComplete.ps1 @@ -20,6 +20,4 @@ function Test-SqlQueryComplete { } else { return $true } -} - - +} \ No newline at end of file diff --git a/internal/functions/Test-SqlSa.ps1 b/internal/functions/Test-SqlSa.ps1 index 2d4e6ba2fb..ad6714257c 100644 --- a/internal/functions/Test-SqlSa.ps1 +++ b/internal/functions/Test-SqlSa.ps1 @@ -2,7 +2,7 @@ function Test-SqlSa { <# .SYNOPSIS Internal function. Ensures sysadmin account access on SQL Server. -#> + #> [CmdletBinding()] param ( [Parameter(Mandatory)] @@ -21,6 +21,4 @@ function Test-SqlSa { $server = Connect-SqlInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential return ($server.ConnectionContext.FixedServerRoles -match "SysAdmin") } catch { return $false } -} - - +} \ No newline at end of file diff --git a/internal/functions/Update-ServiceStatus.ps1 b/internal/functions/Update-ServiceStatus.ps1 index 1882896aea..130fb7b173 100644 --- a/internal/functions/Update-ServiceStatus.ps1 +++ b/internal/functions/Update-ServiceStatus.ps1 @@ -49,7 +49,7 @@ function Update-ServiceStatus { Update-ServiceStatus -InputObject $InputObject -Action 'stop' -Timeout 0 -Credential $credential Stops SQL services on sql1 and waits indefinitely for them to stop. Uses $credential to authorize on the server. -#> + #> [CmdletBinding(SupportsShouldProcess)] param( [parameter(ValueFromPipeline, Mandatory)] @@ -223,6 +223,4 @@ function Update-ServiceStatus { } end { } -} - - +} \ No newline at end of file diff --git a/internal/functions/Update-SqlDbOwner.ps1 b/internal/functions/Update-SqlDbOwner.ps1 index 3822c698f8..4e524fdf49 100644 --- a/internal/functions/Update-SqlDbOwner.ps1 +++ b/internal/functions/Update-SqlDbOwner.ps1 @@ -2,7 +2,7 @@ function Update-SqlDbOwner { <# .SYNOPSIS Internal function. Updates specified database dbowner. -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( diff --git a/internal/functions/Update-SqlDbReadOnly.ps1 b/internal/functions/Update-SqlDbReadOnly.ps1 index e30557750c..bc943ecdb0 100644 --- a/internal/functions/Update-SqlDbReadOnly.ps1 +++ b/internal/functions/Update-SqlDbReadOnly.ps1 @@ -2,7 +2,7 @@ function Update-SqlDbReadOnly { <# .SYNOPSIS Internal function. Updates specified database to read-only or read-write. Necessary because SMO doesn't appear to support NO_WAIT. -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding()] param ( @@ -34,6 +34,4 @@ function Update-SqlDbReadOnly { Write-Message -Level Warning "Could not change readonly status for $dbname on $($server.name)" return $false } -} - - +} \ No newline at end of file diff --git a/internal/functions/Update-SqlPermission.ps1 b/internal/functions/Update-SqlPermission.ps1 index dd37f7f830..2b75555f2a 100644 --- a/internal/functions/Update-SqlPermission.ps1 +++ b/internal/functions/Update-SqlPermission.ps1 @@ -12,7 +12,7 @@ function Update-SqlPermission { Destination Login .PARAMETER EnableException Use this switch to disable any kind of verbose messages - #> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "")] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding(SupportsShouldProcess = $true)] @@ -336,5 +336,4 @@ function Update-SqlPermission { } } } -} - +} \ No newline at end of file diff --git a/internal/functions/Where-DbaObject.ps1 b/internal/functions/Where-DbaObject.ps1 index 128a79fa78..b5da3bf042 100644 --- a/internal/functions/Where-DbaObject.ps1 +++ b/internal/functions/Where-DbaObject.ps1 @@ -46,7 +46,7 @@ function global:Where-DbaObject { "foo","bar" | Where-DbaObject -match "o" Filters out all strings that don't contain the letter "o" - #> + #> [CmdletBinding()] param ( [Parameter(ValueFromPipeline, Mandatory)] @@ -136,5 +136,4 @@ function global:Where-DbaObject { } } -(Get-Item Function:\Where-DbaObject).Visibility = "Private" - +(Get-Item Function:\Where-DbaObject).Visibility = "Private" \ No newline at end of file diff --git a/internal/functions/Write-HostColor.ps1 b/internal/functions/Write-HostColor.ps1 index edf5a28024..2fd3a9ad84 100644 --- a/internal/functions/Write-HostColor.ps1 +++ b/internal/functions/Write-HostColor.ps1 @@ -49,7 +49,7 @@ function Write-HostColor { Write-HostColor -String $stringLong Will print a long multiline text in its entirety while still respecting the colorcodes -#> + #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWriteHost", "")] [CmdletBinding()] param ( @@ -86,5 +86,4 @@ function Write-HostColor { } } } -} - +} \ No newline at end of file diff --git a/internal/functions/Write-ProgressHelper.ps1 b/internal/functions/Write-ProgressHelper.ps1 index 6e87ef0469..59ba283181 100644 --- a/internal/functions/Write-ProgressHelper.ps1 +++ b/internal/functions/Write-ProgressHelper.ps1 @@ -6,7 +6,7 @@ function Write-ProgressHelper { [string]$Activity, [string]$Message ) - + $caller = (Get-PSCallStack)[1].Command if (-not $Activity) { @@ -37,7 +37,7 @@ function Write-ProgressHelper { } } } - + $TotalSteps = ([regex]::Matches((Get-Command -Module dbatools -Name $caller).Definition, "Write-ProgressHelper")).Count Write-Progress -Activity $Activity -Status $Message -PercentComplete (($StepNumber / $TotalSteps) * 100) } \ No newline at end of file diff --git a/internal/maintenance/PSSession-Cleanup.ps1 b/internal/maintenance/PSSession-Cleanup.ps1 index a0e3dcf5ee..f4e1b2cd7e 100644 --- a/internal/maintenance/PSSession-Cleanup.ps1 +++ b/internal/maintenance/PSSession-Cleanup.ps1 @@ -11,4 +11,4 @@ Register-DbaMaintenanceTask -Name "pssession_cleanup" -ScriptBlock $scriptBlock $script:pssession_cleanup_timer = New-Object System.Timers.TImer $script:pssession_cleanup_timer.Interval = 60000 $null = Register-ObjectEvent -InputObject $script:pssession_cleanup_timer -EventName elapsed -SourceIdentifier dbatools_Timer -Action { Get-PSSession | Where-Object State -Like Closed | Remove-PSSession } -ErrorAction Ignore -$script:pssession_cleanup_timer.Start() +$script:pssession_cleanup_timer.Start() \ No newline at end of file diff --git a/internal/maintenance/tempcleanup.ps1 b/internal/maintenance/tempcleanup.ps1 index f91b8f28ce..aeafaf8c8b 100644 --- a/internal/maintenance/tempcleanup.ps1 +++ b/internal/maintenance/tempcleanup.ps1 @@ -1,4 +1,4 @@ $scriptBlock = { Get-ChildItem -Path $env:TEMP -Filter dbatools* | Remove-Item -ErrorAction Ignore -Recurse } -Register-DbaMaintenanceTask -Name "tempcleanup" -ScriptBlock $scriptBlock -Once -Delay (New-TimeSpan -Minutes 1) -Priority Low +Register-DbaMaintenanceTask -Name "tempcleanup" -ScriptBlock $scriptBlock -Once -Delay (New-TimeSpan -Minutes 1) -Priority Low \ No newline at end of file diff --git a/internal/maintenance/teppInsertTask.ps1 b/internal/maintenance/teppInsertTask.ps1 index af9e4b4dd7..58fec0825f 100644 --- a/internal/maintenance/teppInsertTask.ps1 +++ b/internal/maintenance/teppInsertTask.ps1 @@ -10,4 +10,4 @@ $scriptBlock = { [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::CalculateTabExpansion() } -Register-DbaMaintenanceTask -Name "teppInsertTask" -ScriptBlock $scriptBlock -Once +Register-DbaMaintenanceTask -Name "teppInsertTask" -ScriptBlock $scriptBlock -Once \ No newline at end of file diff --git a/internal/scripts/cmdlets.ps1 b/internal/scripts/cmdlets.ps1 index bec0d63528..b0dd8e6cc0 100644 --- a/internal/scripts/cmdlets.ps1 +++ b/internal/scripts/cmdlets.ps1 @@ -8,4 +8,4 @@ $commonParam = @{ } Import-DbaCmdlet @commonParam -Name Write-Message -Type ([Sqlcollaborative.Dbatools.Commands.WriteMessageCommand]) -Import-DbaCmdlet @commonParam -Name Select-DbaObject -Type ([Sqlcollaborative.Dbatools.Commands.SelectDbaObjectCommand]) +Import-DbaCmdlet @commonParam -Name Select-DbaObject -Type ([Sqlcollaborative.Dbatools.Commands.SelectDbaObjectCommand]) \ No newline at end of file diff --git a/internal/scripts/dbatools-maintenance.ps1 b/internal/scripts/dbatools-maintenance.ps1 index 200afdcbd2..97a6d47756 100644 --- a/internal/scripts/dbatools-maintenance.ps1 +++ b/internal/scripts/dbatools-maintenance.ps1 @@ -30,12 +30,11 @@ $scriptBlock = { Start-Sleep -Seconds 5 } #endregion Main Execution - } - catch { } + } catch { } finally { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces[$___ScriptName.ToLower()].SignalStopped() } } Register-DbaRunspace -ScriptBlock $scriptBlock -Name "dbatools-maintenance" -Start-DbaRunspace -Name "dbatools-maintenance" +Start-DbaRunspace -Name "dbatools-maintenance" \ No newline at end of file diff --git a/internal/scripts/insertTepp.ps1 b/internal/scripts/insertTepp.ps1 index 00d5ccbb41..ddb2948d0e 100644 --- a/internal/scripts/insertTepp.ps1 +++ b/internal/scripts/insertTepp.ps1 @@ -1,7 +1,6 @@ if (Get-Command TabExpansionPlusPlus\Register-ArgumentCompleter -ErrorAction Ignore) { $script:TEPP = $true -} -else { +} else { $script:TEPP = $false } @@ -79,5 +78,4 @@ Register-DbaTeppArgumentCompleter -Command "Get-DbaProcess", "Stop-DbaProcess" - Register-DbaTeppArgumentCompleter -Command "Get-DbaProcess", "Stop-DbaProcess" -Parameter Spid -Name processSpid Register-DbaTeppArgumentCompleter -Command "Import-DbaXESessionTemplate", "Get-DbaXESessionTemplate", "Export-DbaXESessionTemplate" -Parameter Template -Name xesessiontemplate Register-DbaTeppArgumentCompleter -Command "Import-DbaPfDataCollectorSetTemplate", "Get-DbaPfDataCollectorSetTemplate", "Export-DbaPfDataCollectorSetTemplate" -Parameter Template -Name perfmontemplate -#endregion Explicit TEPP - +#endregion Explicit TEPP \ No newline at end of file diff --git a/internal/scripts/logfilescript.ps1 b/internal/scripts/logfilescript.ps1 index 4105fc5d1c..bfc0062d05 100644 --- a/internal/scripts/logfilescript.ps1 +++ b/internal/scripts/logfilescript.ps1 @@ -78,8 +78,7 @@ $scriptBlock = { $path = [Sqlcollaborative.Dbatools.Message.LogHost]::LoggingPath if (-not (Test-Path $path)) { $root = New-Item $path -ItemType Directory -Force -ErrorAction Stop - } - else { $root = Get-Item -Path $path } + } else { $root = Get-Item -Path $path } try { [int]$num_Error = (Get-ChildItem -Path $root.FullName -Filter "dbatools_$($pid)_error_*.xml" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty Name | Select-String -Pattern "(\d+)" -AllMatches).Matches[1].Value } catch { } @@ -127,12 +126,11 @@ $scriptBlock = { Start-Sleep -Seconds 5 } - } - catch { } + } catch { } finally { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces[$___ScriptName.ToLower()].SignalStopped() } } Register-DbaRunspace -ScriptBlock $scriptBlock -Name "dbatools-logging" -Start-DbaRunspace -Name "dbatools-logging" +Start-DbaRunspace -Name "dbatools-logging" \ No newline at end of file diff --git a/internal/scripts/message-transforms.ps1 b/internal/scripts/message-transforms.ps1 index 90923897b9..9cbee8e2a7 100644 --- a/internal/scripts/message-transforms.ps1 +++ b/internal/scripts/message-transforms.ps1 @@ -7,12 +7,12 @@ Register-DbaMessageTransform -TargetType 'Microsoft.SqlServer.Management.Smo.Ser Register-DbaMessageTransform -ExceptionTypeFilter '*' -ScriptBlock { if ($args[0] -is [System.Data.SqlClient.SqlException]) { return $args[0] } - + $item = $args[0] while ($item.InnerException) { $item = $item.InnerException if ($item -is [System.Data.SqlClient.SqlException]) { return $item } } - + return $args[0] -} +} \ No newline at end of file diff --git a/internal/scripts/smoLibraryImport.ps1 b/internal/scripts/smoLibraryImport.ps1 index 2250e56051..77c908499c 100644 --- a/internal/scripts/smoLibraryImport.ps1 +++ b/internal/scripts/smoLibraryImport.ps1 @@ -217,8 +217,7 @@ Add-Type -Path "$script:PSModuleRoot\bin\smo\Microsoft.SqlServer.MaintenancePlan if ($script:serialImport) { $scriptBlock.Invoke($script:PSModuleRoot, "$script:DllRoot\smo", (-not $script:strictSecurityMode)) -} -else { +} else { $script:smoRunspace = [System.Management.Automation.PowerShell]::Create() if ($script:smoRunspace.Runspace.Name) { try { $script:smoRunspace.Runspace.Name = "dbatools-import-smo" } @@ -226,4 +225,4 @@ else { } $script:smoRunspace.AddScript($scriptBlock).AddArgument($script:PSModuleRoot).AddArgument("$script:DllRoot\smo").AddArgument((-not $script:strictSecurityMode)) $script:smoRunspace.BeginInvoke() -} +} \ No newline at end of file diff --git a/internal/scripts/updateTeppAsync.ps1 b/internal/scripts/updateTeppAsync.ps1 index 3ff964c926..2bb8d42979 100644 --- a/internal/scripts/updateTeppAsync.ps1 +++ b/internal/scripts/updateTeppAsync.ps1 @@ -28,8 +28,7 @@ $scriptBlock = { $server = New-Object Microsoft.SqlServer.Management.Smo.Server($instance.ConnectionObject) try { $server.ConnectionContext.Connect() - } - catch { + } catch { continue } @@ -71,8 +70,7 @@ $scriptBlock = { Start-Sleep -Seconds 5 } #endregion Main Execution - } - catch { } + } catch { } finally { [Sqlcollaborative.Dbatools.Runspace.RunspaceHost]::Runspaces[$___ScriptName.ToLower()].SignalStopped() } @@ -81,5 +79,4 @@ $scriptBlock = { Register-DbaRunspace -ScriptBlock $scriptBlock -Name "dbatools-teppasynccache" if (-not ([Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppAsyncDisabled -or [Sqlcollaborative.Dbatools.TabExpansion.TabExpansionHost]::TeppDisabled)) { Start-DbaRunspace -Name "dbatools-teppasynccache" -} - +} \ No newline at end of file diff --git a/optional/Compress-Archive.ps1 b/optional/Compress-Archive.ps1 index 2c8aa42ea8..7d5d7f5576 100644 --- a/optional/Compress-Archive.ps1 +++ b/optional/Compress-Archive.ps1 @@ -1,14 +1,13 @@ if ($PSVersionTable.PSVersion.Major -lt 5) { -<# + <# Copied from the Microsoft Module: Microsoft.PowerShell.Archive Which ships with PowerShell Version 5 but will run under v3. -#> + #> - function Compress-Archive - { + function Compress-Archive { <# .SYNOPSIS Creates an archive, or zipped file, from specified files and folders. @@ -95,17 +94,17 @@ Which ships with PowerShell Version 5 but will run under v3. $LiteralPath, [parameter (Mandatory, - Position = 1, - ValueFromPipeline = $false, - ValueFromPipelineByPropertyName = $false)] + Position = 1, + ValueFromPipeline = $false, + ValueFromPipelineByPropertyName = $false)] [ValidateNotNullOrEmpty()] [string] $DestinationPath, [parameter ( - mandatory = $false, - ValueFromPipeline = $false, - ValueFromPipelineByPropertyName = $false)] + mandatory = $false, + ValueFromPipeline = $false, + ValueFromPipelineByPropertyName = $false)] [ValidateSet("Optimal", "NoCompression", "Fastest")] [string] $CompressionLevel = "Optimal", @@ -121,8 +120,7 @@ Which ships with PowerShell Version 5 but will run under v3. $Force = $false ) - BEGIN - { + BEGIN { Add-Type -AssemblyName System.IO.Compression -ErrorAction Ignore Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Ignore @@ -151,8 +149,7 @@ Which ships with PowerShell Version 5 but will run under v3. '@ #region Utility Functions - function GetResolvedPathHelper - { + function GetResolvedPathHelper { param ( [string[]] @@ -168,29 +165,21 @@ Which ships with PowerShell Version 5 but will run under v3. $resolvedPaths = @() # null and empty check are are already done on Path parameter at the cmdlet layer. - foreach ($currentPath in $path) - { - try - { - if ($isLiteralPath) - { + foreach ($currentPath in $path) { + try { + if ($isLiteralPath) { $currentResolvedPaths = Resolve-Path -LiteralPath $currentPath -ErrorAction Stop - } - else - { + } else { $currentResolvedPaths = Resolve-Path -Path $currentPath -ErrorAction Stop } - } - catch - { + } catch { $errorMessage = ($LocalizedData.PathNotFoundError -f $currentPath) $exception = New-Object System.InvalidOperationException $errorMessage, $_.Exception $errorRecord = CreateErrorRecordHelper "ArchiveCmdletPathNotFound" $null ([System.Management.Automation.ErrorCategory]::InvalidArgument) $exception $currentPath $callerPSCmdlet.ThrowTerminatingError($errorRecord) } - foreach ($currentResolvedPath in $currentResolvedPaths) - { + foreach ($currentResolvedPath in $currentResolvedPaths) { $resolvedPaths += $currentResolvedPath.ProviderPath } } @@ -198,18 +187,15 @@ Which ships with PowerShell Version 5 but will run under v3. $resolvedPaths } - function Add-CompressionAssemblies - { + function Add-CompressionAssemblies { - if ($PSEdition -eq "Desktop") - { + if ($PSEdition -eq "Desktop") { Add-Type -AssemblyName System.IO.Compression Add-Type -AssemblyName System.IO.Compression.FileSystem } } - function IsValidFileSystemPath - { + function IsValidFileSystemPath { param ( [string[]] @@ -219,10 +205,8 @@ Which ships with PowerShell Version 5 but will run under v3. $result = $true; # null and empty check are are already done on Path parameter at the cmdlet layer. - foreach ($currentPath in $path) - { - if (!([System.IO.File]::Exists($currentPath) -or [System.IO.Directory]::Exists($currentPath))) - { + foreach ($currentPath in $path) { + if (!([System.IO.File]::Exists($currentPath) -or [System.IO.Directory]::Exists($currentPath))) { $errorMessage = ($LocalizedData.PathNotFoundError -f $currentPath) ThrowTerminatingErrorHelper "PathNotFound" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $currentPath } @@ -232,8 +216,7 @@ Which ships with PowerShell Version 5 but will run under v3. } - function ValidateDuplicateFileSystemPath - { + function ValidateDuplicateFileSystemPath { param ( [string] @@ -246,23 +229,18 @@ Which ships with PowerShell Version 5 but will run under v3. $uniqueInputPaths = @() # null and empty check are are already done on Path parameter at the cmdlet layer. - foreach ($currentPath in $path) - { + foreach ($currentPath in $path) { $currentInputPath = $currentPath.ToUpper() - if ($uniqueInputPaths.Contains($currentInputPath)) - { + if ($uniqueInputPaths.Contains($currentInputPath)) { $errorMessage = ($LocalizedData.DuplicatePathFoundError -f $inputParameter, $currentPath, $inputParameter) ThrowTerminatingErrorHelper "DuplicatePathFound" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $currentPath - } - else - { + } else { $uniqueInputPaths += $currentInputPath } } } - function CompressionLevelMapper - { + function CompressionLevelMapper { param ( [string] @@ -272,14 +250,11 @@ Which ships with PowerShell Version 5 but will run under v3. $compressionLevelFormat = [System.IO.Compression.CompressionLevel]::Optimal # CompressionLevel format is already validated at the cmdlet layer. - switch ($compressionLevel.ToString()) - { - "Fastest" - { + switch ($compressionLevel.ToString()) { + "Fastest" { $compressionLevelFormat = [System.IO.Compression.CompressionLevel]::Fastest } - "NoCompression" - { + "NoCompression" { $compressionLevelFormat = [System.IO.Compression.CompressionLevel]::NoCompression } } @@ -287,8 +262,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $compressionLevelFormat } - function CompressArchiveHelper - { + function CompressArchiveHelper { param ( [string[]] @@ -308,26 +282,20 @@ Which ships with PowerShell Version 5 but will run under v3. $sourceFilePaths = @() $sourceDirPaths = @() - foreach ($currentPath in $sourcePath) - { + foreach ($currentPath in $sourcePath) { $result = Test-Path -LiteralPath $currentPath -PathType Leaf - if ($result -eq $true) - { + if ($result -eq $true) { $sourceFilePaths += $currentPath - } - else - { + } else { $sourceDirPaths += $currentPath } } # The Soure Path contains one or more directory (this directory can have files under it) and no files to be compressed. - if ($sourceFilePaths.Count -eq 0 -and $sourceDirPaths.Count -gt 0) - { - $currentSegmentWeight = 100/[double]$sourceDirPaths.Count + if ($sourceFilePaths.Count -eq 0 -and $sourceDirPaths.Count -gt 0) { + $currentSegmentWeight = 100 / [double]$sourceDirPaths.Count $previousSegmentWeight = 0 - foreach ($currentSourceDirPath in $sourceDirPaths) - { + foreach ($currentSourceDirPath in $sourceDirPaths) { $count = CompressSingleDirHelper $currentSourceDirPath $destinationPath $compressionLevel $true $isUpdateMode $previousSegmentWeight $currentSegmentWeight $numberOfItemsArchived += $count $previousSegmentWeight += $currentSegmentWeight @@ -335,8 +303,7 @@ Which ships with PowerShell Version 5 but will run under v3. } # The Soure Path contains only files to be compressed. - elseIf ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -eq 0) - { + elseIf ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -eq 0) { # $previousSegmentWeight is equal to 0 as there are no prior segments. # $currentSegmentWeight is set to 100 as all files have equal weightage. $previousSegmentWeight = 0 @@ -345,14 +312,12 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived = CompressFilesHelper $sourceFilePaths $destinationPath $compressionLevel $isUpdateMode $previousSegmentWeight $currentSegmentWeight } # The Soure Path contains one or more files and one or more directories (this directory can have files under it) to be compressed. - elseif ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -gt 0) - { + elseif ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -gt 0) { # each directory is considered as an individual segments & all the individual files are clubed in to a separate sgemnet. - $currentSegmentWeight = 100/[double]($sourceDirPaths.Count + 1) + $currentSegmentWeight = 100 / [double]($sourceDirPaths.Count + 1) $previousSegmentWeight = 0 - foreach ($currentSourceDirPath in $sourceDirPaths) - { + foreach ($currentSourceDirPath in $sourceDirPaths) { $count = CompressSingleDirHelper $currentSourceDirPath $destinationPath $compressionLevel $true $isUpdateMode $previousSegmentWeight $currentSegmentWeight $numberOfItemsArchived += $count $previousSegmentWeight += $currentSegmentWeight @@ -365,8 +330,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } - function CompressFilesHelper - { + function CompressFilesHelper { param ( [string[]] @@ -393,8 +357,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } - function CompressSingleDirHelper - { + function CompressSingleDirHelper { param ( [string] @@ -421,46 +384,35 @@ Which ships with PowerShell Version 5 but will run under v3. [System.Collections.Generic.List[System.String]]$subDirFiles = @() - if ($useParentDirAsRoot) - { + if ($useParentDirAsRoot) { $sourceDirInfo = New-Object -TypeName System.IO.DirectoryInfo -ArgumentList $sourceDirPath $sourceDirFullName = $sourceDirInfo.Parent.FullName # If the directory is present at the drive level the DirectoryInfo.Parent include '\' example: C:\ # On the other hand if the directory exists at a deper level then DirectoryInfo.Parent # has just the path (without an ending '\'). example C:\source - if ($sourceDirFullName.Length -eq 3) - { + if ($sourceDirFullName.Length -eq 3) { $modifiedSourceDirFullName = $sourceDirFullName - } - else - { + } else { $modifiedSourceDirFullName = $sourceDirFullName + "\" } - } - else - { + } else { $sourceDirFullName = $sourceDirPath $modifiedSourceDirFullName = $sourceDirFullName + "\" } $dirContents = Get-ChildItem -LiteralPath $sourceDirPath -Recurse - foreach ($currentContent in $dirContents) - { + foreach ($currentContent in $dirContents) { $isContainer = $currentContent -is [System.IO.DirectoryInfo] - if (!$isContainer) - { + if (!$isContainer) { $subDirFiles.Add($currentContent.FullName) - } - else - { + } else { # The currentContent points to a directory. # We need to check if the directory is an empty directory, if so such a # directory has to be explictly added to the archive file. # if there are no files in the directory the GetFiles() API returns an empty array. $files = $currentContent.GetFiles() - if ($files.Count -eq 0) - { + if ($files.Count -eq 0) { $subDirFiles.Add($currentContent.FullName + "\") } } @@ -471,8 +423,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } - function ZipArchiveHelper - { + function ZipArchiveHelper { param ( [System.Collections.Generic.List[System.String]] @@ -500,15 +451,13 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived = 0 $fileMode = [System.IO.FileMode]::Create $result = Test-Path -LiteralPath $DestinationPath -PathType Leaf - if ($result -eq $true) - { + if ($result -eq $true) { $fileMode = [System.IO.FileMode]::Open } Add-CompressionAssemblies - try - { + try { # At this point we are sure that the archive file has write access. $archiveFileStreamArgs = @($destinationPath, $fileMode) $archiveFileStream = New-Object -TypeName System.IO.FileStream -ArgumentList $archiveFileStreamArgs @@ -521,23 +470,18 @@ Which ships with PowerShell Version 5 but will run under v3. $bufferSize = 4kb $buffer = New-Object Byte[] $bufferSize - foreach ($currentFilePath in $sourcePaths) - { - if ($modifiedSourceDirFullName -ne $null -and $modifiedSourceDirFullName.Length -gt 0) - { + foreach ($currentFilePath in $sourcePaths) { + if ($modifiedSourceDirFullName -ne $null -and $modifiedSourceDirFullName.Length -gt 0) { $index = $currentFilePath.IndexOf($modifiedSourceDirFullName, [System.StringComparison]::OrdinalIgnoreCase) $currentFilePathSubString = $currentFilePath.Substring($index, $modifiedSourceDirFullName.Length) $relativeFilePath = $currentFilePath.Replace($currentFilePathSubString, "").Trim() - } - else - { + } else { $relativeFilePath = [System.IO.Path]::GetFileName($currentFilePath) } # Update mode is selected. # Check to see if archive file already contains one or more zip files in it. - if ($isUpdateMode -eq $true -and $zipArchive.Entries.Count -gt 0) - { + if ($isUpdateMode -eq $true -and $zipArchive.Entries.Count -gt 0) { $entryToBeUpdated = $null # Check if the file already exists in the archive file. @@ -545,17 +489,14 @@ Which ships with PowerShell Version 5 but will run under v3. # If the file does not exist in the archive file then default to # create mode and create the entry in the archive file. - foreach ($currentArchiveEntry in $zipArchive.Entries) - { - if ($currentArchiveEntry.FullName -eq $relativeFilePath) - { + foreach ($currentArchiveEntry in $zipArchive.Entries) { + if ($currentArchiveEntry.FullName -eq $relativeFilePath) { $entryToBeUpdated = $currentArchiveEntry break } } - if ($entryToBeUpdated -ne $null) - { + if ($entryToBeUpdated -ne $null) { $addItemtoArchiveFileMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentFilePath) $entryToBeUpdated.Delete() } @@ -566,30 +507,23 @@ Which ships with PowerShell Version 5 but will run under v3. # If a directory needs to be added to an archive file, # by convention the .Net API's expect the path of the diretcory # to end with '\' to detect the path as an directory. - if (!$relativeFilePath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) - { - try - { - try - { + if (!$relativeFilePath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) { + try { + try { $currentFileStream = [System.IO.File]::Open($currentFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) - } - catch - { + } catch { # Failed to access the file. Write a non terminating error to the pipeline # and move on with the remaining files. $exception = $_.Exception if ($null -ne $_.Exception -and - $null -ne $_.Exception.InnerException) - { + $null -ne $_.Exception.InnerException) { $exception = $_.Exception.InnerException } $errorRecord = CreateErrorRecordHelper "CompressArchiveUnauthorizedAccessError" $null ([System.Management.Automation.ErrorCategory]::PermissionDenied) $exception $currentFilePath Write-Error -ErrorRecord $errorRecord } - if ($null -ne $currentFileStream) - { + if ($null -ne $currentFileStream) { $srcStream = New-Object System.IO.BinaryReader $currentFileStream $currentArchiveEntry = $zipArchive.CreateEntry($relativeFilePath, $compression) @@ -600,8 +534,7 @@ Which ships with PowerShell Version 5 but will run under v3. $destStream = New-Object System.IO.BinaryWriter $currentArchiveEntry.Open() - while ($numberOfBytesRead = $srcStream.Read($buffer, 0, $bufferSize)) - { + while ($numberOfBytesRead = $srcStream.Read($buffer, 0, $bufferSize)) { $destStream.Write($buffer, 0, $numberOfBytesRead) $destStream.Flush() } @@ -609,48 +542,36 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived += 1 $addItemtoArchiveFileMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentFilePath) } - } - finally - { - If ($null -ne $currentFileStream) - { + } finally { + If ($null -ne $currentFileStream) { $currentFileStream.Dispose() } - If ($null -ne $srcStream) - { + If ($null -ne $srcStream) { $srcStream.Dispose() } - If ($null -ne $destStream) - { + If ($null -ne $destStream) { $destStream.Dispose() } } - } - else - { + } else { $currentArchiveEntry = $zipArchive.CreateEntry("$relativeFilePath", $compression) $numberOfItemsArchived += 1 $addItemtoArchiveFileMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentFilePath) } - if ($null -ne $addItemtoArchiveFileMessage) - { + if ($null -ne $addItemtoArchiveFileMessage) { Write-Verbose $addItemtoArchiveFileMessage } $currentEntryCount += 1 ProgressBarHelper "Compress-Archive" $progressBarStatus $previousSegmentWeight $currentSegmentWeight $sourcePaths.Count $currentEntryCount } - } - finally - { - If ($null -ne $zipArchive) - { + } finally { + If ($null -ne $zipArchive) { $zipArchive.Dispose() } - If ($null -ne $archiveFileStream) - { + If ($null -ne $archiveFileStream) { $archiveFileStream.Dispose() } @@ -661,42 +582,36 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } -<############################################################################################ + <############################################################################################ # ValidateArchivePathHelper: This is a helper function used to validate the archive file # path & its file format. The only supported archive file format is .zip ############################################################################################> - function ValidateArchivePathHelper - { + function ValidateArchivePathHelper { param ( [string] $archiveFile ) - if ([System.IO.File]::Exists($archiveFile)) - { + if ([System.IO.File]::Exists($archiveFile)) { $extension = [system.IO.Path]::GetExtension($archiveFile) # Invalid file extension is specifed for the zip file. - if ($extension -ne $zipFileExtension) - { + if ($extension -ne $zipFileExtension) { $errorMessage = ($LocalizedData.InvalidZipFileExtensionError -f $extension, $zipFileExtension) ThrowTerminatingErrorHelper "NotSupportedArchiveFileExtension" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $extension } - } - else - { + } else { $errorMessage = ($LocalizedData.PathNotFoundError -f $archiveFile) ThrowTerminatingErrorHelper "PathNotFound" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $archiveFile } } -<############################################################################################ + <############################################################################################ # ExpandArchiveHelper: This is a helper function used to expand the archive file contents # to the specified directory. ############################################################################################> - function ExpandArchiveHelper - { + function ExpandArchiveHelper { param ( [string] @@ -720,8 +635,7 @@ Which ships with PowerShell Version 5 but will run under v3. Add-CompressionAssemblies - try - { + try { # The existance of archive file has already been validated by ValidateArchivePathHelper # before calling this helper function. $archiveFileStreamArgs = @($archiveFile, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) @@ -730,8 +644,7 @@ Which ships with PowerShell Version 5 but will run under v3. $zipArchiveArgs = @($archiveFileStream, [System.IO.Compression.ZipArchiveMode]::Read, $false) $zipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -ArgumentList $zipArchiveArgs - if ($zipArchive.Entries.Count -eq 0) - { + if ($zipArchive.Entries.Count -eq 0) { $archiveFileIsEmpty = ($LocalizedData.ArchiveFileIsEmpty -f $archiveFile) Write-Verbose $archiveFileIsEmpty return @@ -741,48 +654,39 @@ Which ships with PowerShell Version 5 but will run under v3. $progressBarStatus = ($LocalizedData.ExpandProgressBarText -f $archiveFile) # The archive entries can either be empty directories or files. - foreach ($currentArchiveEntry in $zipArchive.Entries) - { + foreach ($currentArchiveEntry in $zipArchive.Entries) { $currentArchiveEntryPath = Join-Path -Path $expandedDir -ChildPath $currentArchiveEntry.FullName $extension = [system.IO.Path]::GetExtension($currentArchiveEntryPath) # The current archive entry is an empty directory # The FullName of the Archive Entry representing a directory would end with a trailing '\'. if ($extension -eq [string]::Empty -and - $currentArchiveEntryPath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) - { + $currentArchiveEntryPath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) { $pathExists = Test-Path -LiteralPath $currentArchiveEntryPath # The current archive entry expects an empty directory. # Check if the existing directory is empty. If its not empty # then it means that user has added this directory by other means. - if ($pathExists -eq $false) - { + if ($pathExists -eq $false) { New-Item $currentArchiveEntryPath -ItemType Directory -Confirm:$isConfirm | Out-Null - if (Test-Path -LiteralPath $currentArchiveEntryPath -PathType Container) - { + if (Test-Path -LiteralPath $currentArchiveEntryPath -PathType Container) { $addEmptyDirectorytoExpandedPathMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentArchiveEntryPath) Write-Verbose $addEmptyDirectorytoExpandedPathMessage $expandedItems.Value += $currentArchiveEntryPath } } - } - else - { - try - { + } else { + try { $currentArchiveEntryFileInfo = New-Object -TypeName System.IO.FileInfo -ArgumentList $currentArchiveEntryPath $parentDirExists = Test-Path -LiteralPath $currentArchiveEntryFileInfo.DirectoryName -PathType Container # If the Parent directory of the current entry in the archive file does not exist, then create it. - if ($parentDirExists -eq $false) - { + if ($parentDirExists -eq $false) { New-Item $currentArchiveEntryFileInfo.DirectoryName -ItemType Directory -Confirm:$isConfirm | Out-Null - if (!(Test-Path -LiteralPath $currentArchiveEntryFileInfo.DirectoryName -PathType Container)) - { + if (!(Test-Path -LiteralPath $currentArchiveEntryFileInfo.DirectoryName -PathType Container)) { # The directory referred by $currentArchiveEntryFileInfo.DirectoryName was not successfully created. # This could be because the user has specified -Confirm paramter when Expand-Archive was invoked # and authorization was not provided when confirmation was prompted. In such a scenario, @@ -797,27 +701,21 @@ Which ships with PowerShell Version 5 but will run under v3. # Check if the file in to which the current archive entry contents # would be expanded already exists. - if ($currentArchiveEntryFileInfo.Exists) - { - if ($force) - { + if ($currentArchiveEntryFileInfo.Exists) { + if ($force) { Remove-Item -LiteralPath $currentArchiveEntryFileInfo.FullName -Force -ErrorVariable ev -Verbose:$isVerbose -Confirm:$isConfirm - if ($ev -ne $null) - { + if ($ev -ne $null) { $hasNonTerminatingError = $true } - if (Test-Path -LiteralPath $currentArchiveEntryFileInfo.FullName -PathType Leaf) - { + if (Test-Path -LiteralPath $currentArchiveEntryFileInfo.FullName -PathType Leaf) { # The file referred by $currentArchiveEntryFileInfo.FullName was not successfully removed. # This could be because the user has specified -Confirm paramter when Expand-Archive was invoked # and authorization was not provided when confirmation was prompted. In such a scenario, # we skip the current file in the archive and continue with the remaining archive file contents. Continue } - } - else - { + } else { # Write non-terminating error to the pipeline. $errorMessage = ($LocalizedData.FileExistsError -f $currentArchiveEntryFileInfo.FullName, $archiveFile, $currentArchiveEntryFileInfo.FullName, $currentArchiveEntryFileInfo.FullName) $errorRecord = CreateErrorRecordHelper "ExpandArchiveFileExists" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidOperation) $null $currentArchiveEntryFileInfo.FullName @@ -826,8 +724,7 @@ Which ships with PowerShell Version 5 but will run under v3. } } - if (!$hasNonTerminatingError) - { + if (!$hasNonTerminatingError) { [System.IO.Compression.ZipFileExtensions]::ExtractToFile($currentArchiveEntry, $currentArchiveEntryPath, $false) # Add the expanded file path to the $expandedItems array, @@ -839,16 +736,12 @@ Which ships with PowerShell Version 5 but will run under v3. $addFiletoExpandedPathMessage = ($LocalizedData.CreateFileAtExpandedPath -f $currentArchiveEntryPath) Write-Verbose $addFiletoExpandedPathMessage } - } - finally - { - If ($null -ne $destStream) - { + } finally { + If ($null -ne $destStream) { $destStream.Dispose() } - If ($null -ne $srcStream) - { + If ($null -ne $srcStream) { $srcStream.Dispose() } } @@ -861,16 +754,12 @@ Which ships with PowerShell Version 5 but will run under v3. $currentSegmentWeight = 100 ProgressBarHelper "Expand-Archive" $progressBarStatus $previousSegmentWeight $currentSegmentWeight $zipArchive.Entries.Count $currentEntryCount } - } - finally - { - If ($null -ne $zipArchive) - { + } finally { + If ($null -ne $zipArchive) { $zipArchive.Dispose() } - If ($null -ne $archiveFileStream) - { + If ($null -ne $archiveFileStream) { $archiveFileStream.Dispose() } @@ -879,13 +768,12 @@ Which ships with PowerShell Version 5 but will run under v3. } } -<############################################################################################ + <############################################################################################ # ProgressBarHelper: This is a helper function used to display progress message. # This function is used by both Compress-Archive & Expand-Archive to display archive file # creation/expansion progress. ############################################################################################> - function ProgressBarHelper - { + function ProgressBarHelper { param ( [string] @@ -910,22 +798,20 @@ Which ships with PowerShell Version 5 but will run under v3. if ($currentEntryCount -gt 0 -and $totalNumberofEntries -gt 0 -and $previousSegmentWeight -ge 0 -and - $currentSegmentWeight -gt 0) - { - $entryDefaultWeight = $currentSegmentWeight/[double]$totalNumberofEntries + $currentSegmentWeight -gt 0) { + $entryDefaultWeight = $currentSegmentWeight / [double]$totalNumberofEntries $percentComplete = $previousSegmentWeight + ($entryDefaultWeight * $currentEntryCount) Write-Progress -Activity $cmdletName -Status $status -PercentComplete $percentComplete } } -<############################################################################################ + <############################################################################################ # CSVHelper: This is a helper function used to append comma after each path specifid by # the SourcePath array. This helper function is used to display all the user supplied paths # in the WhatIf message. ############################################################################################> - function CSVHelper - { + function CSVHelper { param ( [string[]] @@ -933,34 +819,26 @@ Which ships with PowerShell Version 5 but will run under v3. ) # SourcePath has already been validated by the calling funcation. - if ($sourcePath.Count -gt 1) - { + if ($sourcePath.Count -gt 1) { $sourcePathInCsvFormat = "`n" - for ($currentIndex = 0; $currentIndex -lt $sourcePath.Count; $currentIndex++) - { - if ($currentIndex -eq $sourcePath.Count - 1) - { + for ($currentIndex = 0; $currentIndex -lt $sourcePath.Count; $currentIndex++) { + if ($currentIndex -eq $sourcePath.Count - 1) { $sourcePathInCsvFormat += $sourcePath[$currentIndex] - } - else - { + } else { $sourcePathInCsvFormat += $sourcePath[$currentIndex] + "`n" } } - } - else - { + } else { $sourcePathInCsvFormat = $sourcePath } return $sourcePathInCsvFormat } -<############################################################################################ + <############################################################################################ # ThrowTerminatingErrorHelper: This is a helper function used to throw terminating error. ############################################################################################> - function ThrowTerminatingErrorHelper - { + function ThrowTerminatingErrorHelper { param ( [string] @@ -979,12 +857,9 @@ Which ships with PowerShell Version 5 but will run under v3. $innerException ) - if ($innerException -eq $null) - { + if ($innerException -eq $null) { $exception = New-object System.IO.IOException $errorMessage - } - else - { + } else { $exception = New-Object System.IO.IOException $errorMessage, $innerException } @@ -993,11 +868,10 @@ Which ships with PowerShell Version 5 but will run under v3. $PSCmdlet.ThrowTerminatingError($errorRecord) } -<############################################################################################ + <############################################################################################ # CreateErrorRecordHelper: This is a helper function used to create an ErrorRecord ############################################################################################> - function CreateErrorRecordHelper - { + function CreateErrorRecordHelper { param ( [string] @@ -1016,8 +890,7 @@ Which ships with PowerShell Version 5 but will run under v3. $targetObject ) - if ($null -eq $exception) - { + if ($null -eq $exception) { $exception = New-Object System.IO.IOException $errorMessage } @@ -1028,22 +901,19 @@ Which ships with PowerShell Version 5 but will run under v3. $inputPaths = @() $destinationParentDir = [system.IO.Path]::GetDirectoryName($DestinationPath) - if ($null -eq $destinationParentDir) - { + if ($null -eq $destinationParentDir) { $errorMessage = ($LocalizedData.InvalidDestinationPath -f $DestinationPath) ThrowTerminatingErrorHelper "InvalidArchiveFilePath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $DestinationPath } - if ($destinationParentDir -eq [string]::Empty) - { + if ($destinationParentDir -eq [string]::Empty) { $destinationParentDir = '.' } $achiveFileName = [system.IO.Path]::GetFileName($DestinationPath) $destinationParentDir = GetResolvedPathHelper $destinationParentDir $false $PSCmdlet - if ($destinationParentDir.Count -gt 1) - { + if ($destinationParentDir.Count -gt 1) { $errorMessage = ($LocalizedData.InvalidArchiveFilePathError -f $DestinationPath, "DestinationPath", "DestinationPath") ThrowTerminatingErrorHelper "InvalidArchiveFilePath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $DestinationPath } @@ -1055,18 +925,14 @@ Which ships with PowerShell Version 5 but will run under v3. $extension = [system.IO.Path]::GetExtension($DestinationPath) # If user does not specify .Zip extension, we append it. - If ($extension -eq [string]::Empty) - { + If ($extension -eq [string]::Empty) { $DestinationPathWithOutExtension = $DestinationPath $DestinationPath = $DestinationPathWithOutExtension + $zipFileExtension $appendArchiveFileExtensionMessage = ($LocalizedData.AppendArchiveFileExtensionMessage -f $DestinationPathWithOutExtension, $DestinationPath) Write-Verbose $appendArchiveFileExtensionMessage - } - else - { + } else { # Invalid file extension is specified for the zip file to be created. - if ($extension -ne $zipFileExtension) - { + if ($extension -ne $zipFileExtension) { $errorMessage = ($LocalizedData.InvalidZipFileExtensionError -f $extension, $zipFileExtension) ThrowTerminatingErrorHelper "NotSupportedArchiveFileExtension" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $extension } @@ -1074,27 +940,23 @@ Which ships with PowerShell Version 5 but will run under v3. $archiveFileExist = Test-Path -LiteralPath $DestinationPath -PathType Leaf - if ($archiveFileExist -and ($Update -eq $false -and $Force -eq $false)) - { + if ($archiveFileExist -and ($Update -eq $false -and $Force -eq $false)) { $errorMessage = ($LocalizedData.ZipFileExistError -f $DestinationPath) ThrowTerminatingErrorHelper "ArchiveFileExists" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $DestinationPath } # If archive file already exists and if -Update is specified, then we check to see # if we have write access permission to update the existing archive file. - if ($archiveFileExist -and $Update -eq $true) - { + if ($archiveFileExist -and $Update -eq $true) { $item = Get-Item -Path $DestinationPath - if ($item.Attributes.ToString().Contains("ReadOnly")) - { + if ($item.Attributes.ToString().Contains("ReadOnly")) { $errorMessage = ($LocalizedData.ArchiveFileIsReadOnly -f $DestinationPath) ThrowTerminatingErrorHelper "ArchiveFileIsReadOnly" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidOperation) $DestinationPath } } $isWhatIf = $psboundparameters.ContainsKey("WhatIf") - if (!$isWhatIf) - { + if (!$isWhatIf) { $preparingToCompressVerboseMessage = ($LocalizedData.PreparingToCompressVerboseMessage) Write-Verbose $preparingToCompressVerboseMessage @@ -1102,29 +964,24 @@ Which ships with PowerShell Version 5 but will run under v3. ProgressBarHelper "Compress-Archive" $progressBarStatus 0 100 100 1 } } - PROCESS - { + PROCESS { if ($PsCmdlet.ParameterSetName -eq "Path" -or $PsCmdlet.ParameterSetName -eq "PathWithForce" -or - $PsCmdlet.ParameterSetName -eq "PathWithUpdate") - { + $PsCmdlet.ParameterSetName -eq "PathWithUpdate") { $inputPaths += $Path } if ($PsCmdlet.ParameterSetName -eq "LiteralPath" -or $PsCmdlet.ParameterSetName -eq "LiteralPathWithForce" -or - $PsCmdlet.ParameterSetName -eq "LiteralPathWithUpdate") - { + $PsCmdlet.ParameterSetName -eq "LiteralPathWithUpdate") { $inputPaths += $LiteralPath } } - END - { + END { # If archive file already exists and if -Force is specified, we delete the # existing artchive file and create a brand new one. if (($PsCmdlet.ParameterSetName -eq "PathWithForce" -or - $PsCmdlet.ParameterSetName -eq "LiteralPathWithForce") -and $archiveFileExist) - { + $PsCmdlet.ParameterSetName -eq "LiteralPathWithForce") -and $archiveFileExist) { Remove-Item -Path $DestinationPath -Force -ErrorAction Stop } @@ -1134,8 +991,7 @@ Which ships with PowerShell Version 5 but will run under v3. $isLiteralPathUsed = $false if ($PsCmdlet.ParameterSetName -eq "LiteralPath" -or $PsCmdlet.ParameterSetName -eq "LiteralPathWithForce" -or - $PsCmdlet.ParameterSetName -eq "LiteralPathWithUpdate") - { + $PsCmdlet.ParameterSetName -eq "LiteralPathWithUpdate") { $isLiteralPathUsed = $true } @@ -1148,10 +1004,8 @@ Which ships with PowerShell Version 5 but will run under v3. # CSVHelper: This is a helper function used to append comma after each path specifid by # the $sourcePath array. The comma saperated paths are displayed in the -WhatIf message. $sourcePathInCsvFormat = CSVHelper $sourcePath - if ($pscmdlet.ShouldProcess($sourcePathInCsvFormat)) - { - try - { + if ($pscmdlet.ShouldProcess($sourcePathInCsvFormat)) { + try { # StopProcessing is not avaliable in Script cmdlets. However the pipleline execution # is terminated when ever 'CTRL + C' is entered by user to terminate the cmdlet execution. # The finally block is executed whenever pipleline is terminated. @@ -1162,22 +1016,18 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived = CompressArchiveHelper $sourcePath $DestinationPath $CompressionLevel $Update $isArchiveFileProcessingComplete = $true - } - finally - { + } finally { # The $isArchiveFileProcessingComplete would be set to $false if user has typed 'CTRL + C' to # terminate the cmdlet execution or if an unhandled exception is thrown. # $numberOfItemsArchived contains the count of number of files or directories add to the archive file. # If the newly created archive file is empty then we delete it as its not usable. if (($isArchiveFileProcessingComplete -eq $false) -or - ($numberOfItemsArchived -eq 0)) - { + ($numberOfItemsArchived -eq 0)) { $DeleteArchiveFileMessage = ($LocalizedData.DeleteArchiveFile -f $DestinationPath) Write-Verbose $DeleteArchiveFileMessage # delete the partial archive file created. - if (Test-Path $DestinationPath) - { + if (Test-Path $DestinationPath) { Remove-Item -LiteralPath $DestinationPath -Force -Recurse -ErrorAction SilentlyContinue } } @@ -1185,4 +1035,4 @@ Which ships with PowerShell Version 5 but will run under v3. } } } -} +} \ No newline at end of file diff --git a/optional/Expand-Archive.ps1 b/optional/Expand-Archive.ps1 index 47197b3126..3533f82088 100644 --- a/optional/Expand-Archive.ps1 +++ b/optional/Expand-Archive.ps1 @@ -1,16 +1,14 @@ -if ($PSVersionTable.PSVersion.Major -lt 5) -{ +if ($PSVersionTable.PSVersion.Major -lt 5) { -<# + <# Copied from the Microsoft Module: Microsoft.PowerShell.Archive Which ships with PowerShell Version 5 but will run under v3. -#> + #> - function Expand-Archive - { + function Expand-Archive { <# .SYNOPSIS Extracts files from a specified archive (zipped) file. @@ -51,47 +49,46 @@ Which ships with PowerShell Version 5 but will run under v3. This command extracts the contents of an existing archive file in the current folder, Draft.zip, into the folder specified by the DestinationPath parameter, C:\Reference. #> [CmdletBinding( - DefaultParameterSetName = "Path", - SupportsShouldProcess = $true, - HelpUri = "http://go.microsoft.com/fwlink/?LinkID=393253")] + DefaultParameterSetName = "Path", + SupportsShouldProcess = $true, + HelpUri = "http://go.microsoft.com/fwlink/?LinkID=393253")] param ( [parameter ( - Mandatory, - Position = 0, - ParameterSetName = "Path", - ValueFromPipeline, - ValueFromPipelineByPropertyName = $true)] + Mandatory, + Position = 0, + ParameterSetName = "Path", + ValueFromPipeline, + ValueFromPipelineByPropertyName = $true)] [ValidateNotNullOrEmpty()] [string] $Path, [parameter ( - Mandatory, - ParameterSetName = "LiteralPath", - ValueFromPipelineByPropertyName = $true)] + Mandatory, + ParameterSetName = "LiteralPath", + ValueFromPipelineByPropertyName = $true)] [ValidateNotNullOrEmpty()] [Alias("PSPath")] [string] $LiteralPath, [parameter (mandatory = $false, - Position = 1, - ValueFromPipeline = $false, - ValueFromPipelineByPropertyName = $false)] + Position = 1, + ValueFromPipeline = $false, + ValueFromPipelineByPropertyName = $false)] [ValidateNotNullOrEmpty()] [string] $DestinationPath, [parameter (mandatory = $false, - ValueFromPipeline = $false, - ValueFromPipelineByPropertyName = $false)] + ValueFromPipeline = $false, + ValueFromPipelineByPropertyName = $false)] [switch] $Force ) - BEGIN - { + BEGIN { Add-Type -AssemblyName System.IO.Compression -ErrorAction Ignore Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Ignore @@ -120,8 +117,7 @@ Which ships with PowerShell Version 5 but will run under v3. '@ #region Utility Functions - function GetResolvedPathHelper - { + function GetResolvedPathHelper { param ( [string[]] @@ -137,29 +133,21 @@ Which ships with PowerShell Version 5 but will run under v3. $resolvedPaths = @() # null and empty check are are already done on Path parameter at the cmdlet layer. - foreach ($currentPath in $path) - { - try - { - if ($isLiteralPath) - { + foreach ($currentPath in $path) { + try { + if ($isLiteralPath) { $currentResolvedPaths = Resolve-Path -LiteralPath $currentPath -ErrorAction Stop - } - else - { + } else { $currentResolvedPaths = Resolve-Path -Path $currentPath -ErrorAction Stop } - } - catch - { + } catch { $errorMessage = ($LocalizedData.PathNotFoundError -f $currentPath) $exception = New-Object System.InvalidOperationException $errorMessage, $_.Exception $errorRecord = CreateErrorRecordHelper "ArchiveCmdletPathNotFound" $null ([System.Management.Automation.ErrorCategory]::InvalidArgument) $exception $currentPath $callerPSCmdlet.ThrowTerminatingError($errorRecord) } - foreach ($currentResolvedPath in $currentResolvedPaths) - { + foreach ($currentResolvedPath in $currentResolvedPaths) { $resolvedPaths += $currentResolvedPath.ProviderPath } } @@ -167,18 +155,15 @@ Which ships with PowerShell Version 5 but will run under v3. $resolvedPaths } - function Add-CompressionAssemblies - { + function Add-CompressionAssemblies { - if ($PSEdition -eq "Desktop") - { + if ($PSEdition -eq "Desktop") { Add-Type -AssemblyName System.IO.Compression Add-Type -AssemblyName System.IO.Compression.FileSystem } } - function IsValidFileSystemPath - { + function IsValidFileSystemPath { param ( [string[]] @@ -188,10 +173,8 @@ Which ships with PowerShell Version 5 but will run under v3. $result = $true; # null and empty check are are already done on Path parameter at the cmdlet layer. - foreach ($currentPath in $path) - { - if (!([System.IO.File]::Exists($currentPath) -or [System.IO.Directory]::Exists($currentPath))) - { + foreach ($currentPath in $path) { + if (!([System.IO.File]::Exists($currentPath) -or [System.IO.Directory]::Exists($currentPath))) { $errorMessage = ($LocalizedData.PathNotFoundError -f $currentPath) ThrowTerminatingErrorHelper "PathNotFound" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $currentPath } @@ -201,8 +184,7 @@ Which ships with PowerShell Version 5 but will run under v3. } - function ValidateDuplicateFileSystemPath - { + function ValidateDuplicateFileSystemPath { param ( [string] @@ -215,23 +197,18 @@ Which ships with PowerShell Version 5 but will run under v3. $uniqueInputPaths = @() # null and empty check are are already done on Path parameter at the cmdlet layer. - foreach ($currentPath in $path) - { + foreach ($currentPath in $path) { $currentInputPath = $currentPath.ToUpper() - if ($uniqueInputPaths.Contains($currentInputPath)) - { + if ($uniqueInputPaths.Contains($currentInputPath)) { $errorMessage = ($LocalizedData.DuplicatePathFoundError -f $inputParameter, $currentPath, $inputParameter) ThrowTerminatingErrorHelper "DuplicatePathFound" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $currentPath - } - else - { + } else { $uniqueInputPaths += $currentInputPath } } } - function CompressionLevelMapper - { + function CompressionLevelMapper { param ( [string] @@ -241,14 +218,11 @@ Which ships with PowerShell Version 5 but will run under v3. $compressionLevelFormat = [System.IO.Compression.CompressionLevel]::Optimal # CompressionLevel format is already validated at the cmdlet layer. - switch ($compressionLevel.ToString()) - { - "Fastest" - { + switch ($compressionLevel.ToString()) { + "Fastest" { $compressionLevelFormat = [System.IO.Compression.CompressionLevel]::Fastest } - "NoCompression" - { + "NoCompression" { $compressionLevelFormat = [System.IO.Compression.CompressionLevel]::NoCompression } } @@ -256,8 +230,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $compressionLevelFormat } - function CompressArchiveHelper - { + function CompressArchiveHelper { param ( [string[]] @@ -277,26 +250,20 @@ Which ships with PowerShell Version 5 but will run under v3. $sourceFilePaths = @() $sourceDirPaths = @() - foreach ($currentPath in $sourcePath) - { + foreach ($currentPath in $sourcePath) { $result = Test-Path -LiteralPath $currentPath -PathType Leaf - if ($result -eq $true) - { + if ($result -eq $true) { $sourceFilePaths += $currentPath - } - else - { + } else { $sourceDirPaths += $currentPath } } # The Soure Path contains one or more directory (this directory can have files under it) and no files to be compressed. - if ($sourceFilePaths.Count -eq 0 -and $sourceDirPaths.Count -gt 0) - { - $currentSegmentWeight = 100/[double]$sourceDirPaths.Count + if ($sourceFilePaths.Count -eq 0 -and $sourceDirPaths.Count -gt 0) { + $currentSegmentWeight = 100 / [double]$sourceDirPaths.Count $previousSegmentWeight = 0 - foreach ($currentSourceDirPath in $sourceDirPaths) - { + foreach ($currentSourceDirPath in $sourceDirPaths) { $count = CompressSingleDirHelper $currentSourceDirPath $destinationPath $compressionLevel $true $isUpdateMode $previousSegmentWeight $currentSegmentWeight $numberOfItemsArchived += $count $previousSegmentWeight += $currentSegmentWeight @@ -304,8 +271,7 @@ Which ships with PowerShell Version 5 but will run under v3. } # The Soure Path contains only files to be compressed. - elseIf ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -eq 0) - { + elseIf ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -eq 0) { # $previousSegmentWeight is equal to 0 as there are no prior segments. # $currentSegmentWeight is set to 100 as all files have equal weightage. $previousSegmentWeight = 0 @@ -314,14 +280,12 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived = CompressFilesHelper $sourceFilePaths $destinationPath $compressionLevel $isUpdateMode $previousSegmentWeight $currentSegmentWeight } # The Soure Path contains one or more files and one or more directories (this directory can have files under it) to be compressed. - elseif ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -gt 0) - { + elseif ($sourceFilePaths.Count -gt 0 -and $sourceDirPaths.Count -gt 0) { # each directory is considered as an individual segments & all the individual files are clubed in to a separate sgemnet. - $currentSegmentWeight = 100/[double]($sourceDirPaths.Count + 1) + $currentSegmentWeight = 100 / [double]($sourceDirPaths.Count + 1) $previousSegmentWeight = 0 - foreach ($currentSourceDirPath in $sourceDirPaths) - { + foreach ($currentSourceDirPath in $sourceDirPaths) { $count = CompressSingleDirHelper $currentSourceDirPath $destinationPath $compressionLevel $true $isUpdateMode $previousSegmentWeight $currentSegmentWeight $numberOfItemsArchived += $count $previousSegmentWeight += $currentSegmentWeight @@ -334,8 +298,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } - function CompressFilesHelper - { + function CompressFilesHelper { param ( [string[]] @@ -362,8 +325,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } - function CompressSingleDirHelper - { + function CompressSingleDirHelper { param ( [string] @@ -390,46 +352,35 @@ Which ships with PowerShell Version 5 but will run under v3. [System.Collections.Generic.List[System.String]]$subDirFiles = @() - if ($useParentDirAsRoot) - { + if ($useParentDirAsRoot) { $sourceDirInfo = New-Object -TypeName System.IO.DirectoryInfo -ArgumentList $sourceDirPath $sourceDirFullName = $sourceDirInfo.Parent.FullName # If the directory is present at the drive level the DirectoryInfo.Parent include '\' example: C:\ # On the other hand if the directory exists at a deper level then DirectoryInfo.Parent # has just the path (without an ending '\'). example C:\source - if ($sourceDirFullName.Length -eq 3) - { + if ($sourceDirFullName.Length -eq 3) { $modifiedSourceDirFullName = $sourceDirFullName - } - else - { + } else { $modifiedSourceDirFullName = $sourceDirFullName + "\" } - } - else - { + } else { $sourceDirFullName = $sourceDirPath $modifiedSourceDirFullName = $sourceDirFullName + "\" } $dirContents = Get-ChildItem -LiteralPath $sourceDirPath -Recurse - foreach ($currentContent in $dirContents) - { + foreach ($currentContent in $dirContents) { $isContainer = $currentContent -is [System.IO.DirectoryInfo] - if (!$isContainer) - { + if (!$isContainer) { $subDirFiles.Add($currentContent.FullName) - } - else - { + } else { # The currentContent points to a directory. # We need to check if the directory is an empty directory, if so such a # directory has to be explictly added to the archive file. # if there are no files in the directory the GetFiles() API returns an empty array. $files = $currentContent.GetFiles() - if ($files.Count -eq 0) - { + if ($files.Count -eq 0) { $subDirFiles.Add($currentContent.FullName + "\") } } @@ -440,8 +391,7 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } - function ZipArchiveHelper - { + function ZipArchiveHelper { param ( [System.Collections.Generic.List[System.String]] @@ -469,15 +419,13 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived = 0 $fileMode = [System.IO.FileMode]::Create $result = Test-Path -LiteralPath $DestinationPath -PathType Leaf - if ($result -eq $true) - { + if ($result -eq $true) { $fileMode = [System.IO.FileMode]::Open } Add-CompressionAssemblies - try - { + try { # At this point we are sure that the archive file has write access. $archiveFileStreamArgs = @($destinationPath, $fileMode) $archiveFileStream = New-Object -TypeName System.IO.FileStream -ArgumentList $archiveFileStreamArgs @@ -490,23 +438,18 @@ Which ships with PowerShell Version 5 but will run under v3. $bufferSize = 4kb $buffer = New-Object Byte[] $bufferSize - foreach ($currentFilePath in $sourcePaths) - { - if ($modifiedSourceDirFullName -ne $null -and $modifiedSourceDirFullName.Length -gt 0) - { + foreach ($currentFilePath in $sourcePaths) { + if ($modifiedSourceDirFullName -ne $null -and $modifiedSourceDirFullName.Length -gt 0) { $index = $currentFilePath.IndexOf($modifiedSourceDirFullName, [System.StringComparison]::OrdinalIgnoreCase) $currentFilePathSubString = $currentFilePath.Substring($index, $modifiedSourceDirFullName.Length) $relativeFilePath = $currentFilePath.Replace($currentFilePathSubString, "").Trim() - } - else - { + } else { $relativeFilePath = [System.IO.Path]::GetFileName($currentFilePath) } # Update mode is selected. # Check to see if archive file already contains one or more zip files in it. - if ($isUpdateMode -eq $true -and $zipArchive.Entries.Count -gt 0) - { + if ($isUpdateMode -eq $true -and $zipArchive.Entries.Count -gt 0) { $entryToBeUpdated = $null # Check if the file already exists in the archive file. @@ -514,17 +457,14 @@ Which ships with PowerShell Version 5 but will run under v3. # If the file does not exist in the archive file then default to # create mode and create the entry in the archive file. - foreach ($currentArchiveEntry in $zipArchive.Entries) - { - if ($currentArchiveEntry.FullName -eq $relativeFilePath) - { + foreach ($currentArchiveEntry in $zipArchive.Entries) { + if ($currentArchiveEntry.FullName -eq $relativeFilePath) { $entryToBeUpdated = $currentArchiveEntry break } } - if ($entryToBeUpdated -ne $null) - { + if ($entryToBeUpdated -ne $null) { $addItemtoArchiveFileMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentFilePath) $entryToBeUpdated.Delete() } @@ -535,30 +475,23 @@ Which ships with PowerShell Version 5 but will run under v3. # If a directory needs to be added to an archive file, # by convention the .Net API's expect the path of the diretcory # to end with '\' to detect the path as an directory. - if (!$relativeFilePath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) - { - try - { - try - { + if (!$relativeFilePath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) { + try { + try { $currentFileStream = [System.IO.File]::Open($currentFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) - } - catch - { + } catch { # Failed to access the file. Write a non terminating error to the pipeline # and move on with the remaining files. $exception = $_.Exception if ($null -ne $_.Exception -and - $null -ne $_.Exception.InnerException) - { + $null -ne $_.Exception.InnerException) { $exception = $_.Exception.InnerException } $errorRecord = CreateErrorRecordHelper "CompressArchiveUnauthorizedAccessError" $null ([System.Management.Automation.ErrorCategory]::PermissionDenied) $exception $currentFilePath Write-Error -ErrorRecord $errorRecord } - if ($null -ne $currentFileStream) - { + if ($null -ne $currentFileStream) { $srcStream = New-Object System.IO.BinaryReader $currentFileStream $currentArchiveEntry = $zipArchive.CreateEntry($relativeFilePath, $compression) @@ -569,8 +502,7 @@ Which ships with PowerShell Version 5 but will run under v3. $destStream = New-Object System.IO.BinaryWriter $currentArchiveEntry.Open() - while ($numberOfBytesRead = $srcStream.Read($buffer, 0, $bufferSize)) - { + while ($numberOfBytesRead = $srcStream.Read($buffer, 0, $bufferSize)) { $destStream.Write($buffer, 0, $numberOfBytesRead) $destStream.Flush() } @@ -578,48 +510,36 @@ Which ships with PowerShell Version 5 but will run under v3. $numberOfItemsArchived += 1 $addItemtoArchiveFileMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentFilePath) } - } - finally - { - If ($null -ne $currentFileStream) - { + } finally { + If ($null -ne $currentFileStream) { $currentFileStream.Dispose() } - If ($null -ne $srcStream) - { + If ($null -ne $srcStream) { $srcStream.Dispose() } - If ($null -ne $destStream) - { + If ($null -ne $destStream) { $destStream.Dispose() } } - } - else - { + } else { $currentArchiveEntry = $zipArchive.CreateEntry("$relativeFilePath", $compression) $numberOfItemsArchived += 1 $addItemtoArchiveFileMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentFilePath) } - if ($null -ne $addItemtoArchiveFileMessage) - { + if ($null -ne $addItemtoArchiveFileMessage) { Write-Verbose $addItemtoArchiveFileMessage } $currentEntryCount += 1 ProgressBarHelper "Compress-Archive" $progressBarStatus $previousSegmentWeight $currentSegmentWeight $sourcePaths.Count $currentEntryCount } - } - finally - { - If ($null -ne $zipArchive) - { + } finally { + If ($null -ne $zipArchive) { $zipArchive.Dispose() } - If ($null -ne $archiveFileStream) - { + If ($null -ne $archiveFileStream) { $archiveFileStream.Dispose() } @@ -630,42 +550,36 @@ Which ships with PowerShell Version 5 but will run under v3. return $numberOfItemsArchived } -<############################################################################################ + <############################################################################################ # ValidateArchivePathHelper: This is a helper function used to validate the archive file # path & its file format. The only supported archive file format is .zip ############################################################################################> - function ValidateArchivePathHelper - { + function ValidateArchivePathHelper { param ( [string] $archiveFile ) - if ([System.IO.File]::Exists($archiveFile)) - { + if ([System.IO.File]::Exists($archiveFile)) { $extension = [system.IO.Path]::GetExtension($archiveFile) # Invalid file extension is specifed for the zip file. - if ($extension -ne $zipFileExtension) - { + if ($extension -ne $zipFileExtension) { $errorMessage = ($LocalizedData.InvalidZipFileExtensionError -f $extension, $zipFileExtension) ThrowTerminatingErrorHelper "NotSupportedArchiveFileExtension" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $extension } - } - else - { + } else { $errorMessage = ($LocalizedData.PathNotFoundError -f $archiveFile) ThrowTerminatingErrorHelper "PathNotFound" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $archiveFile } } -<############################################################################################ + <############################################################################################ # ExpandArchiveHelper: This is a helper function used to expand the archive file contents # to the specified directory. ############################################################################################> - function ExpandArchiveHelper - { + function ExpandArchiveHelper { param ( [string] @@ -689,8 +603,7 @@ Which ships with PowerShell Version 5 but will run under v3. Add-CompressionAssemblies - try - { + try { # The existance of archive file has already been validated by ValidateArchivePathHelper # before calling this helper function. $archiveFileStreamArgs = @($archiveFile, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) @@ -699,8 +612,7 @@ Which ships with PowerShell Version 5 but will run under v3. $zipArchiveArgs = @($archiveFileStream, [System.IO.Compression.ZipArchiveMode]::Read, $false) $zipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -ArgumentList $zipArchiveArgs - if ($zipArchive.Entries.Count -eq 0) - { + if ($zipArchive.Entries.Count -eq 0) { $archiveFileIsEmpty = ($LocalizedData.ArchiveFileIsEmpty -f $archiveFile) Write-Verbose $archiveFileIsEmpty return @@ -710,48 +622,39 @@ Which ships with PowerShell Version 5 but will run under v3. $progressBarStatus = ($LocalizedData.ExpandProgressBarText -f $archiveFile) # The archive entries can either be empty directories or files. - foreach ($currentArchiveEntry in $zipArchive.Entries) - { + foreach ($currentArchiveEntry in $zipArchive.Entries) { $currentArchiveEntryPath = Join-Path -Path $expandedDir -ChildPath $currentArchiveEntry.FullName $extension = [system.IO.Path]::GetExtension($currentArchiveEntryPath) # The current archive entry is an empty directory # The FullName of the Archive Entry representing a directory would end with a trailing '\'. if ($extension -eq [string]::Empty -and - $currentArchiveEntryPath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) - { + $currentArchiveEntryPath.EndsWith("\", [StringComparison]::OrdinalIgnoreCase)) { $pathExists = Test-Path -LiteralPath $currentArchiveEntryPath # The current archive entry expects an empty directory. # Check if the existing directory is empty. If its not empty # then it means that user has added this directory by other means. - if ($pathExists -eq $false) - { + if ($pathExists -eq $false) { New-Item $currentArchiveEntryPath -ItemType Directory -Confirm:$isConfirm | Out-Null - if (Test-Path -LiteralPath $currentArchiveEntryPath -PathType Container) - { + if (Test-Path -LiteralPath $currentArchiveEntryPath -PathType Container) { $addEmptyDirectorytoExpandedPathMessage = ($LocalizedData.AddItemtoArchiveFile -f $currentArchiveEntryPath) Write-Verbose $addEmptyDirectorytoExpandedPathMessage $expandedItems.Value += $currentArchiveEntryPath } } - } - else - { - try - { + } else { + try { $currentArchiveEntryFileInfo = New-Object -TypeName System.IO.FileInfo -ArgumentList $currentArchiveEntryPath $parentDirExists = Test-Path -LiteralPath $currentArchiveEntryFileInfo.DirectoryName -PathType Container # If the Parent directory of the current entry in the archive file does not exist, then create it. - if ($parentDirExists -eq $false) - { + if ($parentDirExists -eq $false) { New-Item $currentArchiveEntryFileInfo.DirectoryName -ItemType Directory -Confirm:$isConfirm | Out-Null - if (!(Test-Path -LiteralPath $currentArchiveEntryFileInfo.DirectoryName -PathType Container)) - { + if (!(Test-Path -LiteralPath $currentArchiveEntryFileInfo.DirectoryName -PathType Container)) { # The directory referred by $currentArchiveEntryFileInfo.DirectoryName was not successfully created. # This could be because the user has specified -Confirm paramter when Expand-Archive was invoked # and authorization was not provided when confirmation was prompted. In such a scenario, @@ -766,27 +669,21 @@ Which ships with PowerShell Version 5 but will run under v3. # Check if the file in to which the current archive entry contents # would be expanded already exists. - if ($currentArchiveEntryFileInfo.Exists) - { - if ($force) - { + if ($currentArchiveEntryFileInfo.Exists) { + if ($force) { Remove-Item -LiteralPath $currentArchiveEntryFileInfo.FullName -Force -ErrorVariable ev -Verbose:$isVerbose -Confirm:$isConfirm - if ($ev -ne $null) - { + if ($ev -ne $null) { $hasNonTerminatingError = $true } - if (Test-Path -LiteralPath $currentArchiveEntryFileInfo.FullName -PathType Leaf) - { + if (Test-Path -LiteralPath $currentArchiveEntryFileInfo.FullName -PathType Leaf) { # The file referred by $currentArchiveEntryFileInfo.FullName was not successfully removed. # This could be because the user has specified -Confirm paramter when Expand-Archive was invoked # and authorization was not provided when confirmation was prompted. In such a scenario, # we skip the current file in the archive and continue with the remaining archive file contents. Continue } - } - else - { + } else { # Write non-terminating error to the pipeline. $errorMessage = ($LocalizedData.FileExistsError -f $currentArchiveEntryFileInfo.FullName, $archiveFile, $currentArchiveEntryFileInfo.FullName, $currentArchiveEntryFileInfo.FullName) $errorRecord = CreateErrorRecordHelper "ExpandArchiveFileExists" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidOperation) $null $currentArchiveEntryFileInfo.FullName @@ -795,8 +692,7 @@ Which ships with PowerShell Version 5 but will run under v3. } } - if (!$hasNonTerminatingError) - { + if (!$hasNonTerminatingError) { [System.IO.Compression.ZipFileExtensions]::ExtractToFile($currentArchiveEntry, $currentArchiveEntryPath, $false) # Add the expanded file path to the $expandedItems array, @@ -808,16 +704,12 @@ Which ships with PowerShell Version 5 but will run under v3. $addFiletoExpandedPathMessage = ($LocalizedData.CreateFileAtExpandedPath -f $currentArchiveEntryPath) Write-Verbose $addFiletoExpandedPathMessage } - } - finally - { - If ($null -ne $destStream) - { + } finally { + If ($null -ne $destStream) { $destStream.Dispose() } - If ($null -ne $srcStream) - { + If ($null -ne $srcStream) { $srcStream.Dispose() } } @@ -830,16 +722,12 @@ Which ships with PowerShell Version 5 but will run under v3. $currentSegmentWeight = 100 ProgressBarHelper "Expand-Archive" $progressBarStatus $previousSegmentWeight $currentSegmentWeight $zipArchive.Entries.Count $currentEntryCount } - } - finally - { - If ($null -ne $zipArchive) - { + } finally { + If ($null -ne $zipArchive) { $zipArchive.Dispose() } - If ($null -ne $archiveFileStream) - { + If ($null -ne $archiveFileStream) { $archiveFileStream.Dispose() } @@ -848,13 +736,12 @@ Which ships with PowerShell Version 5 but will run under v3. } } -<############################################################################################ + <############################################################################################ # ProgressBarHelper: This is a helper function used to display progress message. # This function is used by both Compress-Archive & Expand-Archive to display archive file # creation/expansion progress. ############################################################################################> - function ProgressBarHelper - { + function ProgressBarHelper { param ( [string] @@ -879,22 +766,20 @@ Which ships with PowerShell Version 5 but will run under v3. if ($currentEntryCount -gt 0 -and $totalNumberofEntries -gt 0 -and $previousSegmentWeight -ge 0 -and - $currentSegmentWeight -gt 0) - { - $entryDefaultWeight = $currentSegmentWeight/[double]$totalNumberofEntries + $currentSegmentWeight -gt 0) { + $entryDefaultWeight = $currentSegmentWeight / [double]$totalNumberofEntries $percentComplete = $previousSegmentWeight + ($entryDefaultWeight * $currentEntryCount) Write-Progress -Activity $cmdletName -Status $status -PercentComplete $percentComplete } } -<############################################################################################ + <############################################################################################ # CSVHelper: This is a helper function used to append comma after each path specifid by # the SourcePath array. This helper function is used to display all the user supplied paths # in the WhatIf message. ############################################################################################> - function CSVHelper - { + function CSVHelper { param ( [string[]] @@ -902,34 +787,26 @@ Which ships with PowerShell Version 5 but will run under v3. ) # SourcePath has already been validated by the calling funcation. - if ($sourcePath.Count -gt 1) - { + if ($sourcePath.Count -gt 1) { $sourcePathInCsvFormat = "`n" - for ($currentIndex = 0; $currentIndex -lt $sourcePath.Count; $currentIndex++) - { - if ($currentIndex -eq $sourcePath.Count - 1) - { + for ($currentIndex = 0; $currentIndex -lt $sourcePath.Count; $currentIndex++) { + if ($currentIndex -eq $sourcePath.Count - 1) { $sourcePathInCsvFormat += $sourcePath[$currentIndex] - } - else - { + } else { $sourcePathInCsvFormat += $sourcePath[$currentIndex] + "`n" } } - } - else - { + } else { $sourcePathInCsvFormat = $sourcePath } return $sourcePathInCsvFormat } -<############################################################################################ + <############################################################################################ # ThrowTerminatingErrorHelper: This is a helper function used to throw terminating error. ############################################################################################> - function ThrowTerminatingErrorHelper - { + function ThrowTerminatingErrorHelper { param ( [string] @@ -948,12 +825,9 @@ Which ships with PowerShell Version 5 but will run under v3. $innerException ) - if ($innerException -eq $null) - { + if ($innerException -eq $null) { $exception = New-object System.IO.IOException $errorMessage - } - else - { + } else { $exception = New-Object System.IO.IOException $errorMessage, $innerException } @@ -962,11 +836,10 @@ Which ships with PowerShell Version 5 but will run under v3. $PSCmdlet.ThrowTerminatingError($errorRecord) } -<############################################################################################ + <############################################################################################ # CreateErrorRecordHelper: This is a helper function used to create an ErrorRecord ############################################################################################> - function CreateErrorRecordHelper - { + function CreateErrorRecordHelper { param ( [string] @@ -985,8 +858,7 @@ Which ships with PowerShell Version 5 but will run under v3. $targetObject ) - if ($null -eq $exception) - { + if ($null -eq $exception) { $exception = New-Object System.IO.IOException $errorMessage } @@ -999,19 +871,14 @@ Which ships with PowerShell Version 5 but will run under v3. $isConfirm = $psboundparameters.ContainsKey("Confirm") $isDestinationPathProvided = $true - if ($DestinationPath -eq [string]::Empty) - { + if ($DestinationPath -eq [string]::Empty) { $resolvedDestinationPath = $pwd $isDestinationPathProvided = $false - } - else - { + } else { $destinationPathExists = Test-Path -Path $DestinationPath -PathType Container - if ($destinationPathExists) - { + if ($destinationPathExists) { $resolvedDestinationPath = GetResolvedPathHelper $DestinationPath $false $PSCmdlet - if ($resolvedDestinationPath.Count -gt 1) - { + if ($resolvedDestinationPath.Count -gt 1) { $errorMessage = ($LocalizedData.InvalidExpandedDirPathError -f $DestinationPath) ThrowTerminatingErrorHelper "InvalidDestinationPath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $DestinationPath } @@ -1019,17 +886,13 @@ Which ships with PowerShell Version 5 but will run under v3. # At this point we are sure that the provided path resolves to a valid single path. # Calling Resolve-Path again to get the underlying provider name. $suppliedDestinationPath = Resolve-Path -Path $DestinationPath - if ($suppliedDestinationPath.Provider.Name -ne "FileSystem") - { + if ($suppliedDestinationPath.Provider.Name -ne "FileSystem") { $errorMessage = ($LocalizedData.ExpandArchiveInValidDestinationPath -f $DestinationPath) ThrowTerminatingErrorHelper "InvalidDirectoryPath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $DestinationPath } - } - else - { + } else { $createdItem = New-Item -Path $DestinationPath -ItemType Directory -Confirm:$isConfirm -Verbose:$isVerbose -ErrorAction Stop - if ($createdItem -ne $null -and $createdItem.PSProvider.Name -ne "FileSystem") - { + if ($createdItem -ne $null -and $createdItem.PSProvider.Name -ne "FileSystem") { Remove-Item "$DestinationPath" -Force -Recurse -ErrorAction SilentlyContinue $errorMessage = ($LocalizedData.ExpandArchiveInValidDestinationPath -f $DestinationPath) ThrowTerminatingErrorHelper "InvalidDirectoryPath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $DestinationPath @@ -1040,8 +903,7 @@ Which ships with PowerShell Version 5 but will run under v3. } $isWhatIf = $psboundparameters.ContainsKey("WhatIf") - if (!$isWhatIf) - { + if (!$isWhatIf) { $preparingToExpandVerboseMessage = ($LocalizedData.PreparingToExpandVerboseMessage) Write-Verbose $preparingToExpandVerboseMessage @@ -1049,26 +911,20 @@ Which ships with PowerShell Version 5 but will run under v3. ProgressBarHelper "Expand-Archive" $progressBarStatus 0 100 100 1 } } - PROCESS - { - switch ($PsCmdlet.ParameterSetName) - { - "Path" - { + PROCESS { + switch ($PsCmdlet.ParameterSetName) { + "Path" { $resolvedSourcePaths = GetResolvedPathHelper $Path $false $PSCmdlet - if ($resolvedSourcePaths.Count -gt 1) - { + if ($resolvedSourcePaths.Count -gt 1) { $errorMessage = ($LocalizedData.InvalidArchiveFilePathError -f $Path, $PsCmdlet.ParameterSetName, $PsCmdlet.ParameterSetName) ThrowTerminatingErrorHelper "InvalidArchiveFilePath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $Path } } - "LiteralPath" - { + "LiteralPath" { $resolvedSourcePaths = GetResolvedPathHelper $LiteralPath $true $PSCmdlet - if ($resolvedSourcePaths.Count -gt 1) - { + if ($resolvedSourcePaths.Count -gt 1) { $errorMessage = ($LocalizedData.InvalidArchiveFilePathError -f $LiteralPath, $PsCmdlet.ParameterSetName, $PsCmdlet.ParameterSetName) ThrowTerminatingErrorHelper "InvalidArchiveFilePath" $errorMessage ([System.Management.Automation.ErrorCategory]::InvalidArgument) $LiteralPath } @@ -1077,12 +933,10 @@ Which ships with PowerShell Version 5 but will run under v3. ValidateArchivePathHelper $resolvedSourcePaths - if ($pscmdlet.ShouldProcess($resolvedSourcePaths)) - { + if ($pscmdlet.ShouldProcess($resolvedSourcePaths)) { $expandedItems = @() - try - { + try { # StopProcessing is not avaliable in Script cmdlets. However the pipleline execution # is terminated when ever 'CTRL + C' is entered by user to terminate the cmdlet execution. # The finally block is executed whenever pipleline is terminated. @@ -1094,14 +948,12 @@ Which ships with PowerShell Version 5 but will run under v3. # archive file contents would be expanded. If the path '$pwd\ArchiveFileName' already exists then we use the # Windows default mechanism of appending a counter value at the end of the directory name where the contents # would be expanded. - if (!$isDestinationPathProvided) - { + if (!$isDestinationPathProvided) { $archiveFile = New-Object System.IO.FileInfo $resolvedSourcePaths $resolvedDestinationPath = Join-Path -Path $resolvedDestinationPath -ChildPath $archiveFile.BaseName $destinationPathExists = Test-Path -LiteralPath $resolvedDestinationPath -PathType Container - if (!$destinationPathExists) - { + if (!$destinationPathExists) { New-Item -Path $resolvedDestinationPath -ItemType Directory -Confirm:$isConfirm -Verbose:$isVerbose -ErrorAction Stop | Out-Null } } @@ -1109,15 +961,11 @@ Which ships with PowerShell Version 5 but will run under v3. ExpandArchiveHelper $resolvedSourcePaths $resolvedDestinationPath ([ref]$expandedItems) $Force $isVerbose $isConfirm $isArchiveFileProcessingComplete = $true - } - finally - { + } finally { # The $isArchiveFileProcessingComplete would be set to $false if user has typed 'CTRL + C' to # terminate the cmdlet execution or if an unhandled exception is thrown. - if ($isArchiveFileProcessingComplete -eq $false) - { - if ($expandedItems.Count -gt 0) - { + if ($isArchiveFileProcessingComplete -eq $false) { + if ($expandedItems.Count -gt 0) { # delete the expanded file/directory as the archive # file was not completly expanded. $expandedItems | ForEach-Object { Remove-Item $_ -Force -Recurse } @@ -1127,4 +975,4 @@ Which ships with PowerShell Version 5 but will run under v3. } } } -} +} \ No newline at end of file diff --git a/optional/Get-GenericArgumentCompleter.ps1 b/optional/Get-GenericArgumentCompleter.ps1 index 776e33e67d..a05486e47e 100644 --- a/optional/Get-GenericArgumentCompleter.ps1 +++ b/optional/Get-GenericArgumentCompleter.ps1 @@ -21,5 +21,4 @@ if (-not (Get-Command -Name Register-ArgumentCompleter -ErrorAction Ignore)) { } } } -} - +} \ No newline at end of file diff --git a/optional/TabExpansionPlusPlus.ps1 b/optional/TabExpansionPlusPlus.ps1 index a20e31c3a3..cde9ce82d5 100644 --- a/optional/TabExpansionPlusPlus.ps1 +++ b/optional/TabExpansionPlusPlus.ps1 @@ -1,5 +1,4 @@ -if (-not (Get-Command -Name Register-ArgumentCompleter -ErrorAction Ignore)) -{ +if (-not (Get-Command -Name Register-ArgumentCompleter -ErrorAction Ignore)) { ############################################################################# # @@ -7,7 +6,7 @@ if (-not (Get-Command -Name Register-ArgumentCompleter -ErrorAction Ignore)) # # -<# + <# Copyright (c) 2013, Jason Shirk All rights reserved. @@ -31,7 +30,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#> + #> # Save off the previous tab completion so it can be restored if this module # is removed. @@ -47,8 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Helper function to create a new completion results # - function New-CompletionResult - { + function New-CompletionResult { param ([Parameter(Position = 0, ValueFromPipelineByPropertyName, Mandatory, ValueFromPipeline)] [ValidateNotNullOrEmpty()] [string] @@ -70,8 +68,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $NoQuotes = $false ) - process - { + process { $toolTipToUse = if ($ToolTip -eq '') { $CompletionText } else { $ToolTip } $listItemToUse = if ($ListItemText -eq '') { $CompletionText } @@ -81,8 +78,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # not be included, via the -NoQuotes parameter, # then skip adding quotes. - if ($CompletionResultType -eq [System.Management.Automation.CompletionResultType]::ParameterValue -and -not $NoQuotes) - { + if ($CompletionResultType -eq [System.Management.Automation.CompletionResultType]::ParameterValue -and -not $NoQuotes) { # Add single quotes for the caller in case they are needed. # We use the parser to robustly determine how it will treat # the argument. If we end up with too many tokens, or if @@ -93,8 +89,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $null = [System.Management.Automation.Language.Parser]::ParseInput("echo $CompletionText", [ref]$tokens, [ref]$null) if ($tokens.Length -ne 3 -or ($tokens[1] -is [System.Management.Automation.Language.StringExpandableToken] -and - $tokens[1].Kind -eq [System.Management.Automation.Language.TokenKind]::Generic)) - { + $tokens[1].Kind -eq [System.Management.Automation.Language.TokenKind]::Generic)) { $CompletionText = "'$CompletionText'" } } @@ -111,8 +106,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # This is a simple wrapper of Get-Command gets commands with a given # parameter ignoring commands that use the parameter name as an alias. # - function Get-CommandWithParameter - { + function Get-CommandWithParameter { [CmdletBinding(DefaultParameterSetName = 'AllCommandSet')] param ( [Parameter(ParameterSetName = 'AllCommandSet', Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)] @@ -137,27 +131,23 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [string] ${ParameterName}) - begin - { + begin { $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Get-Command', [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = { & $wrappedCmd @PSBoundParameters | Where-Object { $_.Parameters[$ParameterName] -ne $null } } $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } - process - { + process { $steppablePipeline.Process($_) } - end - { + end { $steppablePipeline.End() } } ############################################################################# # - function Set-CompletionPrivateData - { + function Set-CompletionPrivateData { param ( [ValidateNotNullOrEmpty()] [string] @@ -172,7 +162,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ) $Cache = [PSCustomObject]@{ - Value = $Value + Value = $Value ExpirationTime = (Get-Date).AddSeconds($ExpirationSeconds) } $completionPrivateData[$key] = $Cache @@ -180,8 +170,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ############################################################################# # - function Get-CompletionPrivateData - { + function Get-CompletionPrivateData { param ( [ValidateNotNullOrEmpty()] [string] @@ -191,16 +180,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { return $completionPrivateData } $cacheValue = $completionPrivateData[$key] - if ((Get-Date) -lt $cacheValue.ExpirationTime) - { + if ((Get-Date) -lt $cacheValue.ExpirationTime) { return $cacheValue.Value } } ############################################################################# # - function Get-CompletionWithExtension - { + function Get-CompletionWithExtension { param ([string] $lastWord, @@ -208,7 +195,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $extensions) [System.Management.Automation.CompletionCompleters]::CompleteFilename($lastWord) | - Where-Object { + Where-Object { # Use ListItemText because it won't be quoted, CompletionText might be [System.IO.Path]::GetExtension($_.ListItemText) -in $extensions } @@ -216,8 +203,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ############################################################################# # - function New-CommandTree - { + function New-CommandTree { [CmdletBinding(DefaultParameterSetName = 'Default')] param ( [Parameter(Position = 0, Mandatory, ParameterSetName = 'Default')] @@ -246,13 +232,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ) $actualSubCommands = $null - if ($null -ne $SubCommands) - { + if ($null -ne $SubCommands) { $actualSubCommands = [NativeCommandTreeNode[]](& $SubCommands) } - switch ($PSCmdlet.ParameterSetName) - { + switch ($PSCmdlet.ParameterSetName) { 'Default' { New-Object NativeCommandTreeNode $Completion, $Tooltip, $actualSubCommands break @@ -269,8 +253,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ############################################################################# # - function Get-CommandTreeCompletion - { + function Get-CommandTreeCompletion { param ($wordToComplete, $commandAst, @@ -283,10 +266,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Skip the first command element - it's the command name # Iterate through the remaining elements, stopping early # if we find the element that matches $wordToComplete. - for ($i = 1; $i -lt $commandElements.Count; $i++) - { - if (!($commandElements[$i] -is [System.Management.Automation.Language.StringConstantExpressionAst])) - { + for ($i = 1; $i -lt $commandElements.Count; $i++) { + if (!($commandElements[$i] -is [System.Management.Automation.Language.StringConstantExpressionAst])) { # Ignore arguments that are expressions. In some rare cases this # could cause strange completions because the context is incorrect, e.g.: # $c = 'advfirewall' @@ -296,19 +277,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. continue } - if ($commandElements[$i].Value -eq $wordToComplete) - { + if ($commandElements[$i].Value -eq $wordToComplete) { $CommandTree = $CommandTree | - Where-Object { $_.Command -like "$wordToComplete*" -or $_.CompletionGenerator -ne $null } + Where-Object { $_.Command -like "$wordToComplete*" -or $_.CompletionGenerator -ne $null } break } - foreach ($subCommand in $CommandTree) - { - if ($subCommand.Command -eq $commandElements[$i].Value) - { - if (!$subCommand.Argument) - { + foreach ($subCommand in $CommandTree) { + if ($subCommand.Command -eq $commandElements[$i].Value) { + if (!$subCommand.Argument) { $CommandTree = $subCommand.SubCommands } break @@ -316,17 +293,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } - if ($null -ne $CommandTree) - { + if ($null -ne $CommandTree) { $CommandTree | ForEach-Object { - if ($_.Command) - { + if ($_.Command) { $toolTip = if ($_.Tooltip) { $_.Tooltip } else { $_.Command } New-CompletionResult -CompletionText $_.Command -ToolTip $toolTip - } - else - { + } else { & $_.CompletionGenerator $wordToComplete $commandAst } } @@ -413,8 +386,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # .PARAMETER Description # A description of how the completion can be used. # - function Register-ArgumentCompleter - { + function Register-ArgumentCompleter { [CmdletBinding(DefaultParameterSetName = "PowerShellSet")] param ( [Parameter(ParameterSetName = "NativeSet", Mandatory)] @@ -438,32 +410,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Native) $fnDefn = $ScriptBlock.Ast -as [System.Management.Automation.Language.FunctionDefinitionAst] - if (!$Description) - { + if (!$Description) { # See if the script block is really a function, if so, use the function name. $Description = if ($fnDefn -ne $null) { $fnDefn.Name } else { "" } } - if ($MyInvocation.ScriptName -ne (& { $MyInvocation.ScriptName })) - { + if ($MyInvocation.ScriptName -ne (& { $MyInvocation.ScriptName })) { # Make an unbound copy of the script block so it has access to TabExpansionPlusPlus when invoked. # We can skip this step if we created the script block (Register-ArgumentCompleter was # called internally). - if ($fnDefn -ne $null) - { + if ($fnDefn -ne $null) { $ScriptBlock = $ScriptBlock.Ast.Body.GetScriptBlock() # Don't reparse, just get a new ScriptBlock. - } - else - { + } else { $ScriptBlock = $ScriptBlock.Ast.GetScriptBlock() # Don't reparse, just get a new ScriptBlock. } } - foreach ($command in $CommandName) - { - if ($command -and $ParameterName) - { + foreach ($command in $CommandName) { + if ($command -and $ParameterName) { $command += ":" } @@ -494,35 +459,34 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Test what would be completed if Robocopy / was typed at the prompt # - function Test-ArgumentCompleter - { + function Test-ArgumentCompleter { [CmdletBinding(DefaultParametersetName = 'PS')] param ( [Parameter(Mandatory, Position = 1, ParameterSetName = 'PS')] [string] $CommandName - , + , [Parameter(Mandatory, Position = 2, ParameterSetName = 'PS')] [string] $ParameterName - , + , [Parameter(ParameterSetName = 'PS')] [System.Management.Automation.Language.CommandAst] $commandAst - , + , [Parameter(ParameterSetName = 'PS')] [Hashtable] $FakeBoundParameters = @{ } - , + , [Parameter(Mandatory, Position = 1, ParameterSetName = 'NativeCommand')] [string] $NativeCommand - , + , [Parameter(Position = 2, ParameterSetName = 'NativeCommand')] [Parameter(Position = 3, ParameterSetName = 'PS')] @@ -531,25 +495,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ) - if ($PSCmdlet.ParameterSetName -eq 'NativeCommand') - { + if ($PSCmdlet.ParameterSetName -eq 'NativeCommand') { $Tokens = $null $Errors = $null $ast = [System.Management.Automation.Language.Parser]::ParseInput($NativeCommand, [ref]$Tokens, [ref]$Errors) $commandAst = $ast.EndBlock.Statements[0].PipelineElements[0] $command = $commandAst.GetCommandName() $completer = $tabExpansionOptions.NativeArgumentCompleters[$command] - if (-not $Completer) - { + if (-not $Completer) { throw "No argument completer registered for command '$Command' (from $NativeCommand)" } & $completer $WordToComplete $commandAst - } - else - { + } else { $completer = $tabExpansionOptions.CustomArgumentCompleters["${CommandName}:$ParameterName"] - if (-not $Completer) - { + if (-not $Completer) { throw "No argument completer registered for '${CommandName}:$ParameterName'" } & $completer $CommandName $ParameterName $WordToComplete $commandAst $FakeBoundParameters @@ -568,38 +527,32 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # .EXAMPLE # Get-ArgumentCompleter -Name *Azure*; - function Get-ArgumentCompleter - { + function Get-ArgumentCompleter { [CmdletBinding()] param ([string[]] $Name = '*') - if (!$updatedTypeData) - { + if (!$updatedTypeData) { # Define the default display properties for the objects returned by Get-ArgumentCompleter [string[]]$properties = "Command", "Parameter" Update-TypeData -TypeName 'TabExpansionPlusPlus.ArgumentCompleter' -DefaultDisplayPropertySet $properties -Force $updatedTypeData = $true } - function WriteCompleters - { - function WriteCompleter($command, $parameter, $native, $scriptblock) - { - foreach ($n in $Name) - { - if ($command -like $n) - { + function WriteCompleters { + function WriteCompleter($command, $parameter, $native, $scriptblock) { + foreach ($n in $Name) { + if ($command -like $n) { $c = $command if ($command -and $parameter) { $c += ':' } $description = $tabExpansionDescriptions["${c}${parameter}${native}"] $completer = [pscustomobject]@{ - Command = $command - Parameter = $parameter - Native = $native + Command = $command + Parameter = $parameter + Native = $native Description = $description ScriptBlock = $scriptblock - File = if ($scriptblock.File) { Split-Path -Leaf -Path $scriptblock.File } + File = if ($scriptblock.File) { Split-Path -Leaf -Path $scriptblock.File } } $completer.PSTypeNames.Add('TabExpansionPlusPlus.ArgumentCompleter') @@ -610,15 +563,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } - foreach ($pair in $tabExpansionOptions.CustomArgumentCompleters.GetEnumerator()) - { - if ($pair.Key -match '^(.*):(.*)$') - { + foreach ($pair in $tabExpansionOptions.CustomArgumentCompleters.GetEnumerator()) { + if ($pair.Key -match '^(.*):(.*)$') { $command = $matches[1] $parameter = $matches[2] - } - else - { + } else { $parameter = $pair.Key $command = "" } @@ -626,8 +575,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. WriteCompleter $command $parameter $false $pair.Value } - foreach ($pair in $tabExpansionOptions.NativeArgumentCompleters.GetEnumerator()) - { + foreach ($pair in $tabExpansionOptions.NativeArgumentCompleters.GetEnumerator()) { WriteCompleter $pair.Key '' $true $pair.Value } } @@ -651,14 +599,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # The value to set for Option. Typically this will be $true. # - function Set-TabExpansionOption - { + function Set-TabExpansionOption { param ( [ValidateSet('ExcludeHiddenFiles', - 'RelativePaths', - 'LiteralPaths', - 'IgnoreHiddenShares', - 'AppendBackslash')] + 'RelativePaths', + 'LiteralPaths', + 'IgnoreHiddenShares', + 'AppendBackslash')] [string] $Option, @@ -680,8 +627,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # [Parameter(Po # [CmdletBinding(DefaultPa # - function TryAttributeArgumentCompletion - { + function TryAttributeArgumentCompletion { param ( [System.Management.Automation.Language.Ast] $ast, @@ -693,8 +639,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $results = @() $matchIndex = -1 - try - { + try { # We want to find any NamedAttributeArgumentAst objects where the Ast extent includes $offset $offsetInExtentPredicate = { param ($ast) @@ -709,45 +654,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $replacementLength = 0 $attributeArg = $asts | Where-Object { $_ -is [System.Management.Automation.Language.NamedAttributeArgumentAst] } | Select-Object -First 1 - if ($null -ne $attributeArg) - { + if ($null -ne $attributeArg) { $attributeAst = [System.Management.Automation.Language.AttributeAst]$attributeArg.Parent $attributeType = $attributeAst.TypeName.GetReflectionAttributeType() $attributeArgumentName = $attributeArg.ArgumentName $replacementIndex = $attributeArg.Extent.StartOffset $replacementLength = $attributeArg.ArgumentName.Length - } - else - { + } else { $attributeAst = $asts | Where-Object { $_ -is [System.Management.Automation.Language.AttributeAst] } | Select-Object -First 1 - if ($null -ne $attributeAst) - { + if ($null -ne $attributeAst) { $attributeType = $attributeAst.TypeName.GetReflectionAttributeType() } } - if ($null -ne $attributeType) - { + if ($null -ne $attributeType) { $results = $attributeType.GetProperties('Public,Instance') | - Where-Object { + Where-Object { # Ignore TypeId (all attributes inherit it) $_.Name -like "$attributeArgumentName*" -and $_.Name -ne 'TypeId' } | - Sort-Object -Property Name | - ForEach-Object { + Sort-Object -Property Name | + ForEach-Object { $propType = [Microsoft.PowerShell.ToStringCodeMethods]::Type($_.PropertyType) $propName = $_.Name New-CompletionResult $propName -ToolTip "$propType $propName" -CompletionResultType Property } return [PSCustomObject]@{ - Results = $results - ReplacementIndex = $replacementIndex + Results = $results + ReplacementIndex = $replacementIndex ReplacementLength = $replacementLength } } - } - catch { } + } catch { } } ############################################################################# @@ -756,8 +695,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # works around a bug in PowerShell that causes it to not complete # native command options starting with - or -- # - function TryNativeCommandOptionCompletion - { + function TryNativeCommandOptionCompletion { param ( [System.Management.Automation.Language.Ast] $ast, @@ -769,8 +707,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $results = @() $replacementIndex = $offset $replacementLength = 0 - try - { + try { # We want to find any Command element objects where the Ast extent includes $offset $offsetInOptionExtentPredicate = { param ($ast) @@ -779,31 +716,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $ast.Extent.Text.StartsWith('-') } $option = $ast.Find($offsetInOptionExtentPredicate, $true) - if ($option -ne $null) - { + if ($option -ne $null) { $command = $option.Parent -as [System.Management.Automation.Language.CommandAst] - if ($command -ne $null) - { + if ($command -ne $null) { $nativeCommand = [System.IO.Path]::GetFileNameWithoutExtension($command.CommandElements[0].Value) $nativeCompleter = $tabExpansionOptions.NativeArgumentCompleters[$nativeCommand] - if ($nativeCompleter) - { + if ($nativeCompleter) { $results = @(& $nativeCompleter $option.ToString() $command) - if ($results.Count -gt 0) - { + if ($results.Count -gt 0) { $replacementIndex = $option.Extent.StartOffset $replacementLength = $option.Extent.Text.Length } } } } - } - catch { } + } catch { } return [PSCustomObject]@{ - Results = $results - ReplacementIndex = $replacementIndex + Results = $results + ReplacementIndex = $replacementIndex ReplacementLength = $replacementLength } } @@ -817,8 +749,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # capabilities such as completing attribute arguments and excluding hidden # files from results. # - function global:TabExpansion2 - { + function global:TabExpansion2 { [CmdletBinding(DefaultParameterSetName = 'ScriptInputSet')] param ( [Parameter(ParameterSetName = 'ScriptInputSet', Mandatory, Position = 0)] @@ -847,52 +778,40 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $options = $null ) - if ($null -ne $options) - { + if ($null -ne $options) { $options += $tabExpansionOptions - } - else - { + } else { $options = $tabExpansionOptions } - if ($psCmdlet.ParameterSetName -eq 'ScriptInputSet') - { + if ($psCmdlet.ParameterSetName -eq 'ScriptInputSet') { $results = [System.Management.Automation.CommandCompletion]::CompleteInput( - <#inputScript#> $inputScript, - <#cursorColumn#> $cursorColumn, - <#options#> $options) - } - else - { + <#inputScript#> $inputScript, + <#cursorColumn#> $cursorColumn, + <#options#> $options) + } else { $results = [System.Management.Automation.CommandCompletion]::CompleteInput( - <#ast#> $ast, - <#tokens#> $tokens, - <#positionOfCursor#> $positionOfCursor, - <#options#> $options) + <#ast#> $ast, + <#tokens#> $tokens, + <#positionOfCursor#> $positionOfCursor, + <#options#> $options) } - if ($results.CompletionMatches.Count -eq 0) - { + if ($results.CompletionMatches.Count -eq 0) { # Built-in didn't succeed, try our own completions here. - if ($psCmdlet.ParameterSetName -eq 'ScriptInputSet') - { + if ($psCmdlet.ParameterSetName -eq 'ScriptInputSet') { $ast = [System.Management.Automation.Language.Parser]::ParseInput($inputScript, [ref]$tokens, [ref]$null) - } - else - { + } else { $cursorColumn = $positionOfCursor.Offset } # workaround PowerShell bug that case it to not invoking native completers for - or -- # making it hard to complete options for many commands $nativeCommandResults = TryNativeCommandOptionCompletion -ast $ast -offset $cursorColumn - if ($null -ne $nativeCommandResults) - { + if ($null -ne $nativeCommandResults) { $results.ReplacementIndex = $nativeCommandResults.ReplacementIndex $results.ReplacementLength = $nativeCommandResults.ReplacementLength - if ($results.CompletionMatches.IsReadOnly) - { + if ($results.CompletionMatches.IsReadOnly) { # Workaround where PowerShell returns a readonly collection that we need to add to. $collection = new-object System.Collections.ObjectModel.Collection[System.Management.Automation.CompletionResult] $results.GetType().GetProperty('CompletionMatches').SetValue($results, $collection) @@ -903,12 +822,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } $attributeResults = TryAttributeArgumentCompletion $ast $cursorColumn - if ($null -ne $attributeResults) - { + if ($null -ne $attributeResults) { $results.ReplacementIndex = $attributeResults.ReplacementIndex $results.ReplacementLength = $attributeResults.ReplacementLength - if ($results.CompletionMatches.IsReadOnly) - { + if ($results.CompletionMatches.IsReadOnly) { # Workaround where PowerShell returns a readonly collection that we need to add to. $collection = new-object System.Collections.ObjectModel.Collection[System.Management.Automation.CompletionResult] $results.GetType().GetProperty('CompletionMatches').SetValue($results, $collection) @@ -919,19 +836,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } - if ($options.ExcludeHiddenFiles) - { - foreach ($result in @($results.CompletionMatches)) - { + if ($options.ExcludeHiddenFiles) { + foreach ($result in @($results.CompletionMatches)) { if ($result.ResultType -eq [System.Management.Automation.CompletionResultType]::ProviderItem -or - $result.ResultType -eq [System.Management.Automation.CompletionResultType]::ProviderContainer) - { - try - { + $result.ResultType -eq [System.Management.Automation.CompletionResultType]::ProviderContainer) { + try { $item = Get-Item -LiteralPath $result.CompletionText -ErrorAction Stop - } - catch - { + } catch { # If Get-Item w/o -Force fails, it is probably hidden, so exclude the result $null = $results.CompletionMatches.Remove($result) } @@ -939,32 +850,24 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } if ($options.AppendBackslash -and - $results.CompletionMatches.ResultType -contains [System.Management.Automation.CompletionResultType]::ProviderContainer) - { - foreach ($result in @($results.CompletionMatches)) - { - if ($result.ResultType -eq [System.Management.Automation.CompletionResultType]::ProviderContainer) - { + $results.CompletionMatches.ResultType -contains [System.Management.Automation.CompletionResultType]::ProviderContainer) { + foreach ($result in @($results.CompletionMatches)) { + if ($result.ResultType -eq [System.Management.Automation.CompletionResultType]::ProviderContainer) { $completionText = $result.CompletionText $lastChar = $completionText[-1] $lastIsQuote = ($lastChar -eq '"' -or $lastChar -eq "'") - if ($lastIsQuote) - { + if ($lastIsQuote) { $lastChar = $completionText[-2] } - if ($lastChar -ne '\') - { + if ($lastChar -ne '\') { $null = $results.CompletionMatches.Remove($result) - if ($lastIsQuote) - { + if ($lastIsQuote) { $completionText = $completionText.Substring(0, $completionText.Length - 1) + '\' + $completionText[-1] - } - else - { + } else { $completionText = $completionText + '\' } @@ -976,13 +879,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } - if ($results.CompletionMatches.Count -eq 0) - { + if ($results.CompletionMatches.Count -eq 0) { # No results, if this module has overridden another TabExpansion2 function, call it # but only if it's not the built-in function (which we assume if function isn't # defined in a file. - if ($oldTabExpansion2 -ne $null -and $oldTabExpansion2.File -ne $null) - { + if ($oldTabExpansion2 -ne $null -and $oldTabExpansion2.File -ne $null) { return (& $oldTabExpansion2 @PSBoundParameters) } } @@ -1050,5 +951,4 @@ public class NativeCommandTreeNode $tabExpansionDescriptions = @{ } # And private data for the above completions cached in this hashtable $completionPrivateData = @{ } -} - +} \ No newline at end of file diff --git a/tests/Add-DbaAgDatabase.Tests.ps1 b/tests/Add-DbaAgDatabase.Tests.ps1 index 377fdc4348..b6b48a960e 100644 --- a/tests/Add-DbaAgDatabase.Tests.ps1 +++ b/tests/Add-DbaAgDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Add-DbaAgDatabase).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Database', 'InputObject', 'EnableException' @@ -46,4 +46,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.IsJoined | Should -Be $true } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Add-DbaAgListener.Tests.ps1 b/tests/Add-DbaAgListener.Tests.ps1 index e0fcd40698..f84ff6a501 100644 --- a/tests/Add-DbaAgListener.Tests.ps1 +++ b/tests/Add-DbaAgListener.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Add-DbaAgListener).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'IPAddress', 'SubnetMask', 'Port', 'Dhcp', 'Passthru', 'InputObject', 'EnableException' @@ -35,4 +35,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.PortNumber | Should -Be 1433 } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Add-DbaAgReplica.Tests.ps1 b/tests/Add-DbaAgReplica.Tests.ps1 index f86ff53c27..adcdf39074 100644 --- a/tests/Add-DbaAgReplica.Tests.ps1 +++ b/tests/Add-DbaAgReplica.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Add-DbaAgReplica).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Name', 'AvailabilityMode', 'FailoverMode', 'BackupPriority', 'ConnectionModeInPrimaryRole', 'ConnectionModeInSecondaryRole', 'SeedingMode', 'Endpoint', 'Passthru', 'ReadonlyRoutingConnectionUrl', 'Certificate', 'InputObject', 'EnableException' @@ -29,8 +29,8 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { # the only way to test, really, is to call New-DbaAvailabilityGroup which calls Add-DbaAgReplica $agname = "dbatoolsci_add_replicagroup" $null = New-DbaAvailabilityGroup -Primary $script:instance3 -Name $agname -ClusterType None -FailoverMode Manual -Confirm:$false -Certificate dbatoolsci_AGCert - - + + It "returns results with proper data" { $results = Get-DbaAgReplica -SqlInstance $script:instance3 $results.AvailabilityGroup | Should -Contain $agname @@ -47,4 +47,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.FailoverMode | Should -Be 'Manual' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Add-DbaCmsRegServer.Tests.ps1 b/tests/Add-DbaCmsRegServer.Tests.ps1 index 43fb0b3524..42fbff5fd5 100644 --- a/tests/Add-DbaCmsRegServer.Tests.ps1 +++ b/tests/Add-DbaCmsRegServer.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -54,4 +53,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results2.SqlInstance | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Add-DbaCmsRegServerGroup.Tests.ps1 b/tests/Add-DbaCmsRegServerGroup.Tests.ps1 index a0be0ef352..433fe3c916 100644 --- a/tests/Add-DbaCmsRegServerGroup.Tests.ps1 +++ b/tests/Add-DbaCmsRegServerGroup.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -53,4 +52,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Group | Should -Be 'dbatoolsci-first\dbatoolsci-second\dbatoolsci-third' } } -} +} \ No newline at end of file diff --git a/tests/Add-DbaComputerCertificate.Tests.ps1 b/tests/Add-DbaComputerCertificate.Tests.ps1 index 999d930b18..e49ac6dc47 100644 --- a/tests/Add-DbaComputerCertificate.Tests.ps1 +++ b/tests/Add-DbaComputerCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Add-DbaComputerCertificate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Password','Certificate','Path','Store','Folder','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Password', 'Certificate', 'Path', 'Store', 'Folder', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -31,4 +31,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Remove-DbaComputerCertificate -Thumbprint 29C469578D6C6211076A09CEE5C5797EEA0C2713 -Confirm:$false } -} +} \ No newline at end of file diff --git a/tests/Add-DbaDbMirrorMonitor.Tests.ps1 b/tests/Add-DbaDbMirrorMonitor.Tests.ps1 index 416642ff10..eabde7ca17 100644 --- a/tests/Add-DbaDbMirrorMonitor.Tests.ps1 +++ b/tests/Add-DbaDbMirrorMonitor.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -35,4 +34,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Add-DbaDbMirrorMonitor -SqlInstance $script:instance2 -WarningAction SilentlyContinue $results.MonitorStatus | Should -Be 'Added' } -} +} \ No newline at end of file diff --git a/tests/Add-DbaPfDataCollectorCounter.Tests.ps1 b/tests/Add-DbaPfDataCollectorCounter.Tests.ps1 index 9e5e37f10e..33078ac7da 100644 --- a/tests/Add-DbaPfDataCollectorCounter.Tests.ps1 +++ b/tests/Add-DbaPfDataCollectorCounter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Add-DbaPfDataCollectorCounter).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','Collector','Counter','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'Collector', 'Counter', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,7 +20,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { BeforeEach { $null = Get-DbaPfDataCollectorSetTemplate -Template 'Long Running Queries' | Import-DbaPfDataCollectorSetTemplate | - Get-DbaPfDataCollector | Get-DbaPfDataCollectorCounter -Counter '\LogicalDisk(*)\Avg. Disk Queue Length' | Remove-DbaPfDataCollectorCounter -Confirm:$false + Get-DbaPfDataCollector | Get-DbaPfDataCollectorCounter -Counter '\LogicalDisk(*)\Avg. Disk Queue Length' | Remove-DbaPfDataCollectorCounter -Confirm:$false } AfterAll { $null = Get-DbaPfDataCollectorSet -CollectorSet 'Long Running Queries' | Remove-DbaPfDataCollectorSet -Confirm:$false @@ -32,4 +32,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Be '\LogicalDisk(*)\Avg. Disk Queue Length' } } -} +} \ No newline at end of file diff --git a/tests/Backup-DbaDatabase.Tests.ps1 b/tests/Backup-DbaDatabase.Tests.ps1 index 71866dcc42..3a29ff822b 100644 --- a/tests/Backup-DbaDatabase.Tests.ps1 +++ b/tests/Backup-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 29 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Backup-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','BackupDirectory','BackupFileName','ReplaceInName','CopyOnly','Type','InputObject','CreateFolder','FileCount','CompressBackup','Checksum','Verify','MaxTransferSize','BlockSize','BufferCount','AzureBaseUrl','AzureCredential','NoRecovery','BuildPath','WithFormat','Initialize','SkipTapeHeader','TimeStampFormat','IgnoreFileChecks','OutputScriptOnly','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'BackupDirectory', 'BackupFileName', 'ReplaceInName', 'CopyOnly', 'Type', 'InputObject', 'CreateFolder', 'FileCount', 'CompressBackup', 'Checksum', 'Verify', 'MaxTransferSize', 'BlockSize', 'BufferCount', 'AzureBaseUrl', 'AzureCredential', 'NoRecovery', 'BuildPath', 'WithFormat', 'Initialize', 'SkipTapeHeader', 'TimeStampFormat', 'IgnoreFileChecks', 'OutputScriptOnly', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -71,10 +71,10 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "Should take path and filename" { $results = Backup-DbaDatabase -SqlInstance $script:instance1 -BackupDirectory $DestBackupDir -Database master -BackupFileName 'PesterTest.bak' - It "Should report it has backed up to the path with the correct name"{ + It "Should report it has backed up to the path with the correct name" { $results.Fullname | Should -BeLike "$DestBackupDir*PesterTest.bak" } - It "Should have backed up to the path with the correct name"{ + It "Should have backed up to the path with the correct name" { Test-Path "$DestBackupDir\PesterTest.bak" | Should -Be $true } } @@ -106,7 +106,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $backupPaths = "$DestBackupDir\stripewithdb1", "$DestBackupDir\stripewithdb2" $results = Backup-DbaDatabase -SqlInstance $script:instance1 -Database master -BackupDirectory $backupPaths -CreateFolder It "Should have appended master to all backup paths" { - foreach($path in $results.BackupFolder) { + foreach ($path in $results.BackupFolder) { ($results.BackupFolder | Sort-Object) | Should -Be ($backupPaths | Sort-Object | ForEach-Object { [IO.Path]::Combine($_, 'master') }) } } @@ -115,7 +115,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "A fully qualified path should override a backupfolder" { $results = Backup-DbaDatabase -SqlInstance $script:instance1 -Database master -BackupDirectory c:\temp -BackupFileName "$DestBackupDir\PesterTest2.bak" - It "Should report backed up to $DestBackupDir" { + It "Should report backed up to $DestBackupDir" { $results.FullName | Should -BeLike "$DestBackupDir\PesterTest2.bak" $results.BackupFolder | Should Not Be 'c:\temp' } @@ -139,7 +139,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } It "Should have written files with extensions" { - foreach($path in $results.BackupFile) { + foreach ($path in $results.BackupFile) { [IO.Path]::GetExtension($path) | Should -Be '.bak' } } @@ -158,7 +158,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } It "Should have 1 period in file extension" { - foreach($path in $results.BackupFile) { + foreach ($path in $results.BackupFile) { [IO.Path]::GetExtension($path) | Should -Not -BeLike '*..*' } } @@ -166,10 +166,10 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "Should Backup to default path if none specified" { $results = Backup-DbaDatabase -SqlInstance $script:instance1 -Database master -BackupFileName 'PesterTest.bak' $DefaultPath = (Get-DbaDefaultPath -SqlInstance $script:instance1).Backup - It "Should report it has backed up to the path with the corrrect name"{ + It "Should report it has backed up to the path with the corrrect name" { $results.Fullname | Should -BeLike "$DefaultPath*PesterTest.bak" } - It "Should have backed up to the path with the corrrect name"{ + It "Should have backed up to the path with the corrrect name" { Test-Path "$DefaultPath\PesterTest.bak" | Should -Be $true } } @@ -182,7 +182,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } - Context "Test Backup-DbaDatabase can take pipe input"{ + Context "Test Backup-DbaDatabase can take pipe input" { $results = Get-DbaDatabase -SqlInstance $script:instance1 -Database master | Backup-DbaDatabase -confirm:$false -WarningVariable warnvar It "Should not warn" { '' -eq $warnvar | Should -Be $True @@ -215,7 +215,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "Should handle an encrypted database when compression is specified" { $sqlencrypt = -@" + @" CREATE MASTER KEY ENCRYPTION BY PASSWORD = ''; go CREATE CERTIFICATE MyServerCert WITH SUBJECT = 'My DEK Certificate'; @@ -225,7 +225,7 @@ go "@ $null = Invoke-DbaQuery -SqlInstance $script:instance2 -Query $sqlencrypt -Database Master $createdb = -@" + @" CREATE DATABASE ENCRYPTION KEY WITH ALGORITHM = AES_128 ENCRYPTION BY SERVER CERTIFICATE MyServerCert; @@ -241,7 +241,7 @@ GO } Remove-DbaDatabase -SqlInstance $script:instance2 -Database encrypted -confirm:$false $sqldrop = -@" + @" drop certificate MyServerCert go drop master key @@ -271,7 +271,7 @@ go BeforeAll { Get-DbaDatabase -SqlInstance $script:instance2 -Database "dbatoolsci_azure" | Remove-DbaDatabase -Confirm:$false $server = Connect-DbaInstance -SqlInstance $script:instance2 - if (Get-DbaCredential -SqlInstance $script:instance2 -Name "[$script:azureblob]" ){ + if (Get-DbaCredential -SqlInstance $script:instance2 -Name "[$script:azureblob]" ) { $sql = "DROP CREDENTIAL [$script:azureblob]" $server.Query($sql) } @@ -303,4 +303,4 @@ go } } } -} +} \ No newline at end of file diff --git a/tests/Backup-DbaDbCertificate.Tests.ps1 b/tests/Backup-DbaDbCertificate.Tests.ps1 index d549add136..6d141e69c1 100644 --- a/tests/Backup-DbaDbCertificate.Tests.ps1 +++ b/tests/Backup-DbaDbCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 11 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Backup-DbaDbCertificate).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Certificate','Database','ExcludeDatabase','EncryptionPassword','DecryptionPassword','Path','Suffix','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Certificate', 'Database', 'ExcludeDatabase', 'EncryptionPassword', 'DecryptionPassword', 'Path', 'Suffix', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -39,4 +39,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status -match "Success" } } -} +} \ No newline at end of file diff --git a/tests/Backup-DbaDbMasterKey.Tests.ps1 b/tests/Backup-DbaDbMasterKey.Tests.ps1 index 056c854c30..81d0cf718b 100644 --- a/tests/Backup-DbaDbMasterKey.Tests.ps1 +++ b/tests/Backup-DbaDbMasterKey.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Backup-DbaDbMasterKey).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Credential','Database','ExcludeDatabase','Password','Path','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Credential', 'Database', 'ExcludeDatabase', 'Password', 'Path', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,4 +36,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Status -eq "Success" } } -} +} \ No newline at end of file diff --git a/tests/Clear-DbaConnectionPool.Tests.ps1 b/tests/Clear-DbaConnectionPool.Tests.ps1 index e6cc911971..66f60c7413 100644 --- a/tests/Clear-DbaConnectionPool.Tests.ps1 +++ b/tests/Clear-DbaConnectionPool.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Clear-DbaConnectionPool).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -21,4 +21,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "doesn't throw" { { Clear-DbaConnectionPool } | Should Not Throw } -} +} \ No newline at end of file diff --git a/tests/Clear-DbaLatchStatistics.Tests.ps1 b/tests/Clear-DbaLatchStatistics.Tests.ps1 index efab018ebc..4e4d529fcb 100644 --- a/tests/Clear-DbaLatchStatistics.Tests.ps1 +++ b/tests/Clear-DbaLatchStatistics.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $SupportShouldProcess = $true if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -34,4 +33,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Status -eq 'Success' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Clear-DbaPlanCache.Tests.ps1 b/tests/Clear-DbaPlanCache.Tests.ps1 index 81a7fb09b6..16509deb97 100644 --- a/tests/Clear-DbaPlanCache.Tests.ps1 +++ b/tests/Clear-DbaPlanCache.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Clear-DbaPlanCache).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Threshold','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Threshold', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,4 +32,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status -match 'below' | Should -Be $true } } -} +} \ No newline at end of file diff --git a/tests/Clear-DbaWaitStatistics.Tests.ps1 b/tests/Clear-DbaWaitStatistics.Tests.ps1 index 86aeeb3b0c..6c8e6e1370 100644 --- a/tests/Clear-DbaWaitStatistics.Tests.ps1 +++ b/tests/Clear-DbaWaitStatistics.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Clear-DbaWaitStatistics).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Status -eq 'Success' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Connect-DbaInstance.Tests.ps1 b/tests/Connect-DbaInstance.Tests.ps1 index 116b0ee43c..8d287611b1 100644 --- a/tests/Connect-DbaInstance.Tests.ps1 +++ b/tests/Connect-DbaInstance.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 26 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Connect-DbaInstance).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','Database','AccessToken','ApplicationIntent','BatchSeparator','ClientName','ConnectTimeout','EncryptConnection','FailoverPartner','IsActiveDirectoryUniversalAuth','LockTimeout','MaxPoolSize','MinPoolSize','MultipleActiveResultSets','MultiSubnetFailover','NetworkProtocol','NonPooledConnection','PacketSize','PooledConnectionLifetime','SqlExecutionModes','StatementTimeout','TrustServerCertificate','WorkstationId','AppendConnectionString','SqlConnectionOnly' + $knownParameters = 'SqlInstance', 'Credential', 'Database', 'AccessToken', 'ApplicationIntent', 'BatchSeparator', 'ClientName', 'ConnectTimeout', 'EncryptConnection', 'FailoverPartner', 'IsActiveDirectoryUniversalAuth', 'LockTimeout', 'MaxPoolSize', 'MinPoolSize', 'MultipleActiveResultSets', 'MultiSubnetFailover', 'NetworkProtocol', 'NonPooledConnection', 'PacketSize', 'PooledConnectionLifetime', 'SqlExecutionModes', 'StatementTimeout', 'TrustServerCertificate', 'WorkstationId', 'AppendConnectionString', 'SqlConnectionOnly' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,18 +41,18 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "sets connectioncontext parameters that are provided" { $params = @{ - 'BatchSeparator' = 'GO' - 'ConnectTimeout' = 1 - 'Database' = 'master' - 'LockTimeout' = 1 - 'MaxPoolSize' = 20 - 'MinPoolSize' = 1 - 'NetworkProtocol' = 'TcpIp' - 'PacketSize' = 4096 + 'BatchSeparator' = 'GO' + 'ConnectTimeout' = 1 + 'Database' = 'master' + 'LockTimeout' = 1 + 'MaxPoolSize' = 20 + 'MinPoolSize' = 1 + 'NetworkProtocol' = 'TcpIp' + 'PacketSize' = 4096 'PooledConnectionLifetime' = 600 - 'WorkstationId' = 'MadeUpServer' - 'SqlExecutionModes' = 'ExecuteSql' - 'StatementTimeout' = 0 + 'WorkstationId' = 'MadeUpServer' + 'SqlExecutionModes' = 'ExecuteSql' + 'StatementTimeout' = 0 } $server = Connect-DbaInstance -SqlInstance $script:instance1 @params @@ -68,4 +68,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Connect-SqlInstance.Tests.ps1 b/tests/Connect-SqlInstance.Tests.ps1 index 102f4adf60..1207e0bd6a 100644 --- a/tests/Connect-SqlInstance.Tests.ps1 +++ b/tests/Connect-SqlInstance.Tests.ps1 @@ -50,4 +50,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } $l.Drop() } -} +} \ No newline at end of file diff --git a/tests/Convert-DbaLsn.Tests.ps1 b/tests/Convert-DbaLsn.Tests.ps1 index 5727a9fb88..4c2252c20b 100644 --- a/tests/Convert-DbaLsn.Tests.ps1 +++ b/tests/Convert-DbaLsn.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Convert-DbaLSN).Parameters.Keys - $knownParameters = 'LSN','EnableException' + $knownParameters = 'LSN', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -16,21 +16,21 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } } - Context "Converts Numeric LSN to Hex"{ + Context "Converts Numeric LSN to Hex" { $LSN = '00000000020000000024300001' It "Should convert to 00000014:000000f3:0001" { (Convert-DbaLSN -Lsn $Lsn).Hexadecimal | Should -Be '00000014:000000f3:0001' } } - Context "Converts Numeric LSN to Hex without leading 0s"{ + Context "Converts Numeric LSN to Hex without leading 0s" { $LSN = '20000000024300001' It "Should convert to 00000014:000000f3:0001" { (Convert-DbaLSN -Lsn $Lsn).Hexadecimal | Should -Be '00000014:000000f3:0001' } } - Context "Converts Hex LSN to Numeric"{ + Context "Converts Hex LSN to Numeric" { $LSN = '00000014:000000f3:0001' It "Should convert to 20000000024300001" { (Convert-DbaLSN -Lsn $Lsn).Numeric | Should -Be 20000000024300001 @@ -43,5 +43,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/ConvertTo-DbaDataTable.Tests.ps1 b/tests/ConvertTo-DbaDataTable.Tests.ps1 index 227621b720..233d0a453b 100644 --- a/tests/ConvertTo-DbaDataTable.Tests.ps1 +++ b/tests/ConvertTo-DbaDataTable.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\ConvertTo-DbaDataTable).Parameters.Keys - $knownParameters = 'InputObject','TimeSpanType','SizeType','IgnoreNull','Raw','EnableException' + $knownParameters = 'InputObject', 'TimeSpanType', 'SizeType', 'IgnoreNull', 'Raw', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -270,4 +270,4 @@ Describe "Testing input parameters" { $firstColumns | Should -Be $secondColumns } } -} +} \ No newline at end of file diff --git a/tests/ConvertTo-DbaTimeline.Tests.ps1 b/tests/ConvertTo-DbaTimeline.Tests.ps1 index 812434e986..fa151c0d6b 100644 --- a/tests/ConvertTo-DbaTimeline.Tests.ps1 +++ b/tests/ConvertTo-DbaTimeline.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\ConvertTo-DbaTimeline).Parameters.Keys - $knownParameters = 'InputObject','EnableException' + $knownParameters = 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/ConvertTo-DbaXESession.Tests.ps1 b/tests/ConvertTo-DbaXESession.Tests.ps1 index eab0b72d4d..00044e0b67 100644 --- a/tests/ConvertTo-DbaXESession.Tests.ps1 +++ b/tests/ConvertTo-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\ConvertTo-DbaXESession).Parameters.Keys - $knownParameters = 'InputObject','Name','OutputScriptOnly','EnableException' + $knownParameters = 'InputObject', 'Name', 'OutputScriptOnly', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -113,4 +113,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Targets.Name | Should Be "package0.event_file" } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaAgentAlert.Tests.ps1 b/tests/Copy-DbaAgentAlert.Tests.ps1 index 0d5b5be036..06c1b4272a 100644 --- a/tests/Copy-DbaAgentAlert.Tests.ps1 +++ b/tests/Copy-DbaAgentAlert.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentAlert).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Alert','ExcludeAlert','IncludeDefaults','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Alert', 'ExcludeAlert', 'IncludeDefaults', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -52,4 +52,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Get-DbaAgentAlert -SqlInstance $script:instance2 $results.Name -contains 'dbatoolsci test alert' } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaAgentCategory.Tests.ps1 b/tests/Copy-DbaAgentCategory.Tests.ps1 index 312ca5b81d..5caabc2bee 100644 --- a/tests/Copy-DbaAgentCategory.Tests.ps1 +++ b/tests/Copy-DbaAgentCategory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentCategory).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','CategoryType','JobCategory','AgentCategory','OperatorCategory','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'CategoryType', 'JobCategory', 'AgentCategory', 'OperatorCategory', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -38,4 +38,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status -eq "Skipped" } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaAgentJob.Tests.ps1 b/tests/Copy-DbaAgentJob.Tests.ps1 index bdceab789a..c08e24cf86 100644 --- a/tests/Copy-DbaAgentJob.Tests.ps1 +++ b/tests/Copy-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentJob).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Job','ExcludeJob','DisableOnSource','DisableOnDestination','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Job', 'ExcludeJob', 'DisableOnSource', 'DisableOnDestination', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -47,4 +47,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { (Get-DbaAgentJob -SqlInstance $script:instance3 -Job dbatoolsci_copyjob_disabled).Enabled | Should -Be $false } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaAgentOperator.Tests.ps1 b/tests/Copy-DbaAgentOperator.Tests.ps1 index b6ac589c7b..d73c224162 100644 --- a/tests/Copy-DbaAgentOperator.Tests.ps1 +++ b/tests/Copy-DbaAgentOperator.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentOperator).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Operator','ExcludeOperator','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Operator', 'ExcludeOperator', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -52,4 +52,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status -eq "Skipped" } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaAgentProxyAccount.Tests.ps1 b/tests/Copy-DbaAgentProxyAccount.Tests.ps1 index e4143f675c..5ab0c2a80f 100644 --- a/tests/Copy-DbaAgentProxyAccount.Tests.ps1 +++ b/tests/Copy-DbaAgentProxyAccount.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentProxyAccount).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','ProxyAccount','ExcludeProxyAccount','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'ProxyAccount', 'ExcludeProxyAccount', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaAgentServer.Tests.ps1 b/tests/Copy-DbaAgentServer.Tests.ps1 index a623065527..3daa896aaa 100644 --- a/tests/Copy-DbaAgentServer.Tests.ps1 +++ b/tests/Copy-DbaAgentServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentServer).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','DisableJobsOnDestination','DisableJobsOnSource','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'DisableJobsOnDestination', 'DisableJobsOnSource', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaAgentSharedSchedule.Tests.ps1 b/tests/Copy-DbaAgentSharedSchedule.Tests.ps1 index 41f79b89a2..7cbfda2214 100644 --- a/tests/Copy-DbaAgentSharedSchedule.Tests.ps1 +++ b/tests/Copy-DbaAgentSharedSchedule.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaAgentSharedSchedule).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaBackupDevice.Tests.ps1 b/tests/Copy-DbaBackupDevice.Tests.ps1 index 3e96ca58e5..ea09408a6a 100644 --- a/tests/Copy-DbaBackupDevice.Tests.ps1 +++ b/tests/Copy-DbaBackupDevice.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaBackupDevice).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','BackupDevice','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'BackupDevice', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -33,8 +33,7 @@ if (-not $env:appveyor) { $server1 = Connect-DbaInstance -SqlInstance $script:instance2 try { $server1.Query("EXEC master.dbo.sp_dropdevice @logicalname = N'$devicename'") - } - catch { + } catch { # don't care } } @@ -44,8 +43,7 @@ if (-not $env:appveyor) { It "warns if it has a problem moving (issue for local to local)" { $warn -match "backup device to destination" | Should Be $true } - } - else { + } else { It "should report success" { $results.Status | Should Be "Successful" } @@ -57,4 +55,4 @@ if (-not $env:appveyor) { } } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaCentralManagementServer.Tests.ps1 b/tests/Copy-DbaCentralManagementServer.Tests.ps1 index dcc042b106..4795bb8c01 100644 --- a/tests/Copy-DbaCentralManagementServer.Tests.ps1 +++ b/tests/Copy-DbaCentralManagementServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaCentralManagementServer).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','CMSGroup','SwitchServerName','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'CMSGroup', 'SwitchServerName', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -56,4 +56,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { # Property Comparisons will come later when we have the commands } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaCredential.Tests.ps1 b/tests/Copy-DbaCredential.Tests.ps1 index 0bb2ce4316..edca1f29d2 100644 --- a/tests/Copy-DbaCredential.Tests.ps1 +++ b/tests/Copy-DbaCredential.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 11 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaCredential).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Credential','Destination','DestinationSqlCredential','Name','ExcludeName','Identity','ExcludeIdentity','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Credential', 'Destination', 'DestinationSqlCredential', 'Name', 'ExcludeName', 'Identity', 'ExcludeIdentity', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -74,4 +74,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Status | Should Be "Skipping" } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaCustomError.Tests.ps1 b/tests/Copy-DbaCustomError.Tests.ps1 index a12355fe9b..6dfd5517fc 100644 --- a/tests/Copy-DbaCustomError.Tests.ps1 +++ b/tests/Copy-DbaCustomError.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaCustomError).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','CustomError','ExcludeCustomError','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'CustomError', 'ExcludeCustomError', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -46,4 +46,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Get-DbaCustomError -SqlInstance $script:instance2 $results.ID -contains 60000 } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaDataCollector.Tests.ps1 b/tests/Copy-DbaDataCollector.Tests.ps1 index de720a0e59..41db513cc8 100644 --- a/tests/Copy-DbaDataCollector.Tests.ps1 +++ b/tests/Copy-DbaDataCollector.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaDataCollector).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','CollectionSet','ExcludeCollectionSet','NoServerReconfig','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'CollectionSet', 'ExcludeCollectionSet', 'NoServerReconfig', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaDatabase.Tests.ps1 b/tests/Copy-DbaDatabase.Tests.ps1 index 606d237b54..37850fed33 100644 --- a/tests/Copy-DbaDatabase.Tests.ps1 +++ b/tests/Copy-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 27 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaDatabase).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Database','ExcludeDatabase','AllDatabases','BackupRestore','NetworkShare','WithReplace','NoRecovery','NoBackupCleanup','NumberFiles','DetachAttach','Reattach','SetSourceReadOnly','ReuseSourceFolderStructure','IncludeSupportDbs','UseLastBackups','Continue','InputObject','NoCopyOnly','SetSourceOffline','NewName','Prefix','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Database', 'ExcludeDatabase', 'AllDatabases', 'BackupRestore', 'NetworkShare', 'WithReplace', 'NoRecovery', 'NoBackupCleanup', 'NumberFiles', 'DetachAttach', 'Reattach', 'SetSourceReadOnly', 'ReuseSourceFolderStructure', 'IncludeSupportDbs', 'UseLastBackups', 'Continue', 'InputObject', 'NoCopyOnly', 'SetSourceOffline', 'NewName', 'Prefix', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -49,7 +49,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $db1 = Get-DbaDatabase -SqlInstance $script:instance2 -Database $detachattachdb $db2 = Get-DbaDatabase -SqlInstance $script:instance3 -Database $detachattachdb - It "should not be null" { + It "should not be null" { $db1.Name | Should Be $detachattachdb $db2.Name | Should Be $detachattachdb } @@ -163,12 +163,12 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { Get-DbaProcess -SqlInstance $script:instance2, $script:instance3 -Program 'dbatools PowerShell module - dbatools.io' | Stop-DbaProcess -WarningAction SilentlyContinue Get-DbaDatabase -SqlInstance $script:instance3 -ExcludeAllSystemDb | Remove-DbaDatabase -Confirm:$false } - It "Should have renamed a single db"{ + It "Should have renamed a single db" { $newname = "copy$(Get-Random)" $results = Copy-DbaDatabase -Source $script:instance2 -Destination $script:instance3 -Database $backuprestoredb -BackupRestore -NetworkShare $NetworkPath -NewName $newname $results[0].DestinationDatabase | Should -Be $newname - $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database $newname - ($files.PhysicalName -like "*$newname*").count | Should -Be $files.count + $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database $newname + ($files.PhysicalName -like "*$newname*").count | Should -Be $files.count } It "Should warn if trying to rename and prefix" { @@ -177,12 +177,12 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } - It "Should prefix databasename and files"{ + It "Should prefix databasename and files" { $prefix = "da$(Get-Random)" $results = Copy-DbaDatabase -Source $script:instance2 -Destination $script:instance3 -Database $backuprestoredb -BackupRestore -NetworkShare $NetworkPath -Prefix $prefix $results[0].DestinationDatabase | Should -Be "$prefix$backuprestoredb" - $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database "$prefix$backuprestoredb" - ($files.PhysicalName -like "*$prefix$backuprestoredb*").count | Should -Be $files.count + $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database "$prefix$backuprestoredb" + ($files.PhysicalName -like "*$prefix$backuprestoredb*").count | Should -Be $files.count } } @@ -191,27 +191,27 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { Get-DbaProcess -SqlInstance $script:instance2, $script:instance3 -Program 'dbatools PowerShell module - dbatools.io' | Stop-DbaProcess -WarningAction SilentlyContinue Remove-DbaDatabase -Confirm:$false -SqlInstance $script:instance3 -Database $backuprestoredb } - It "Should have renamed a single db"{ + It "Should have renamed a single db" { $newname = "copy$(Get-Random)" $results = Copy-DbaDatabase -Source $script:instance2 -Destination $script:instance3 -Database $backuprestoredb -DetachAttach -NewName $newname -Reattach $results[0].DestinationDatabase | Should -Be $newname - $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database $newname - ($files.PhysicalName -like "*$newname*").count | Should -Be $files.count + $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database $newname + ($files.PhysicalName -like "*$newname*").count | Should -Be $files.count } - It "Should prefix databasename and files"{ + It "Should prefix databasename and files" { $prefix = "copy$(Get-Random)" $results = Copy-DbaDatabase -Source $script:instance2 -Destination $script:instance3 -Database $backuprestoredb -DetachAttach -Reattach -Prefix $prefix $results[0].DestinationDatabase | Should -Be "$prefix$backuprestoredb" - $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database "$prefix$backuprestoredb" - ($files.PhysicalName -like "*$prefix$backuprestoredb*").count | Should -Be $files.count + $files = Get-DbaDbFile -Sqlinstance $script:instance3 -Database "$prefix$backuprestoredb" + ($files.PhysicalName -like "*$prefix$backuprestoredb*").count | Should -Be $files.count } $null = Restore-DbaDatabase -SqlInstance $script:instance2 -path $script:appveyorlabrepo\RestoreTimeClean -useDestinationDefaultDirectories - It "Should warn and exit if newname and >1 db specified"{ + It "Should warn and exit if newname and >1 db specified" { $prefix = "copy$(Get-Random)" $results = Copy-DbaDatabase -Source $script:instance2 -Destination $script:instance3 -Database $backuprestoredb, RestoreTimeClean -DetachAttach -Reattach -NewName warn -WarningVariable warnvar $Warnvar | Should -BeLike "*Cannot use NewName when copying multiple databases" } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaDbAssembly.Tests.ps1 b/tests/Copy-DbaDbAssembly.Tests.ps1 index 9d24ae1ae6..64a03f2931 100644 --- a/tests/Copy-DbaDbAssembly.Tests.ps1 +++ b/tests/Copy-DbaDbAssembly.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaDbAssembly).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Assembly','ExcludeAssembly','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Assembly', 'ExcludeAssembly', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -52,4 +52,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Get-DbaCustomError -SqlInstance $script:instance2 $results.ID -contains 60000 } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaDbMail.Tests.ps1 b/tests/Copy-DbaDbMail.Tests.ps1 index d41ab737b1..5223b6face 100644 --- a/tests/Copy-DbaDbMail.Tests.ps1 +++ b/tests/Copy-DbaDbMail.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaDbMail).Parameters.Keys - $knownParameters = 'Source','Destination','Type','SourceSqlCredential','DestinationSqlCredential','Force','EnableException' + $knownParameters = 'Source', 'Destination', 'Type', 'SourceSqlCredential', 'DestinationSqlCredential', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaDbTableData.Tests.ps1 b/tests/Copy-DbaDbTableData.Tests.ps1 index afe0954a8e..fe8fea01cf 100644 --- a/tests/Copy-DbaDbTableData.Tests.ps1 +++ b/tests/Copy-DbaDbTableData.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 20 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaDbTableData).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Destination','DestinationSqlCredential','Database','DestinationDatabase','Table','Query','BatchSize','NotifyAfter','DestinationTable','NoTableLock','CheckConstraints','FireTriggers','KeepIdentity','KeepNulls','Truncate','bulkCopyTimeOut','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Destination', 'DestinationSqlCredential', 'Database', 'DestinationDatabase', 'Table', 'Query', 'BatchSize', 'NotifyAfter', 'DestinationTable', 'NoTableLock', 'CheckConstraints', 'FireTriggers', 'KeepIdentity', 'KeepNulls', 'Truncate', 'bulkCopyTimeOut', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -94,5 +94,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $result = Copy-DbaDbTableData -SqlInstance $script:instance1 -Database tempdb -Table dbatoolsci_example -Truncate $result | Should Be $null } -} - +} \ No newline at end of file diff --git a/tests/Copy-DbaEndpoint.Tests.ps1 b/tests/Copy-DbaEndpoint.Tests.ps1 index 9b24ca83c2..1b3dbe5b0e 100644 --- a/tests/Copy-DbaEndpoint.Tests.ps1 +++ b/tests/Copy-DbaEndpoint.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaEndpoint).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Endpoint','ExcludeEndpoint','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Endpoint', 'ExcludeEndpoint', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaExtendedEvent.Tests.ps1 b/tests/Copy-DbaExtendedEvent.Tests.ps1 index 6cc24afc94..62355a410d 100644 --- a/tests/Copy-DbaExtendedEvent.Tests.ps1 +++ b/tests/Copy-DbaExtendedEvent.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaExtendedEvent).Parameters.Keys - $knownParameters = 'Source','Destination','SourceSqlCredential','DestinationSqlCredential','XeSession','ExcludeXeSession','Force','EnableException' + $knownParameters = 'Source', 'Destination', 'SourceSqlCredential', 'DestinationSqlCredential', 'XeSession', 'ExcludeXeSession', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaLinkedServer.Tests.ps1 b/tests/Copy-DbaLinkedServer.Tests.ps1 index 363ff0c366..2bb2c04dd7 100644 --- a/tests/Copy-DbaLinkedServer.Tests.ps1 +++ b/tests/Copy-DbaLinkedServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaLinkedServer).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','LinkedServer','ExcludeLinkedServer','UpgradeSqlClient','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'LinkedServer', 'ExcludeLinkedServer', 'UpgradeSqlClient', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,8 +35,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { try { $server1.Query($dropsql) $server2.Query($dropsql) - } - catch {} + } catch {} } Context "Copy linked server with the same properties" { diff --git a/tests/Copy-DbaLogin.Tests.ps1 b/tests/Copy-DbaLogin.Tests.ps1 index 6929d87ced..3221accbc2 100644 --- a/tests/Copy-DbaLogin.Tests.ps1 +++ b/tests/Copy-DbaLogin.Tests.ps1 @@ -89,4 +89,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Status | Should Be "Successful" } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaPolicyManagement.Tests.ps1 b/tests/Copy-DbaPolicyManagement.Tests.ps1 index bfcf7ae001..b55c956666 100644 --- a/tests/Copy-DbaPolicyManagement.Tests.ps1 +++ b/tests/Copy-DbaPolicyManagement.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaPolicyManagement).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Policy','ExcludePolicy','Condition','ExcludeCondition','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Policy', 'ExcludePolicy', 'Condition', 'ExcludeCondition', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaQueryStoreConfig.Tests.ps1 b/tests/Copy-DbaQueryStoreConfig.Tests.ps1 index 1722dee472..838ec5ac74 100644 --- a/tests/Copy-DbaQueryStoreConfig.Tests.ps1 +++ b/tests/Copy-DbaQueryStoreConfig.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaQueryStoreConfig).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','SourceDatabase','Destination','DestinationSqlCredential','DestinationDatabase','Exclude','AllDatabases','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'SourceDatabase', 'Destination', 'DestinationSqlCredential', 'DestinationDatabase', 'Exclude', 'AllDatabases', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaResourceGovernor.Tests.ps1 b/tests/Copy-DbaResourceGovernor.Tests.ps1 index 7caed48dc5..0a807807ec 100644 --- a/tests/Copy-DbaResourceGovernor.Tests.ps1 +++ b/tests/Copy-DbaResourceGovernor.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaResourceGovernor).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','ResourcePool','ExcludeResourcePool','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'ResourcePool', 'ExcludeResourcePool', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -80,4 +80,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Name | Should -Be 'dbatoolsci_fnRG' } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaServerAudit.Tests.ps1 b/tests/Copy-DbaServerAudit.Tests.ps1 index 543f2f6818..c61b9ca58d 100644 --- a/tests/Copy-DbaServerAudit.Tests.ps1 +++ b/tests/Copy-DbaServerAudit.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaServerAudit).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Audit','ExcludeAudit','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Audit', 'ExcludeAudit', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaServerAuditSpecification.Tests.ps1 b/tests/Copy-DbaServerAuditSpecification.Tests.ps1 index 82ee14141f..16508d38bb 100644 --- a/tests/Copy-DbaServerAuditSpecification.Tests.ps1 +++ b/tests/Copy-DbaServerAuditSpecification.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaServerAuditSpecification).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','AuditSpecification','ExcludeAuditSpecification','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'AuditSpecification', 'ExcludeAuditSpecification', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaServerTrigger.Tests.ps1 b/tests/Copy-DbaServerTrigger.Tests.ps1 index 1190605429..a0b828051e 100644 --- a/tests/Copy-DbaServerTrigger.Tests.ps1 +++ b/tests/Copy-DbaServerTrigger.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaServerTrigger).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','ServerTrigger','ExcludeServerTrigger','Force','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'ServerTrigger', 'ExcludeServerTrigger', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,8 +34,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { try { $server1 = Connect-DbaInstance -SqlInstance $script:instance2 $server1.Query("DROP TRIGGER [$triggername] ON ALL SERVER") - } - catch { + } catch { # don't care } } @@ -47,4 +46,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } # same properties need to be added } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaSpConfigure.Tests.ps1 b/tests/Copy-DbaSpConfigure.Tests.ps1 index c70365fceb..bbe5b6893d 100644 --- a/tests/Copy-DbaSpConfigure.Tests.ps1 +++ b/tests/Copy-DbaSpConfigure.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaSpConfigure).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','ConfigName','ExcludeConfigName','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'ConfigName', 'ExcludeConfigName', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -56,4 +56,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $newconfig -eq $sourceconfig | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Copy-DbaSsisCatalog.Tests.ps1 b/tests/Copy-DbaSsisCatalog.Tests.ps1 index d7e97819dd..7536ed04fe 100644 --- a/tests/Copy-DbaSsisCatalog.Tests.ps1 +++ b/tests/Copy-DbaSsisCatalog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 11 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaSsisCatalog).Parameters.Keys - $knownParameters = 'Source','Destination','SourceSqlCredential','DestinationSqlCredential','Project','Folder','Environment','CreateCatalogPassword','EnableSqlClr','Force','EnableException' + $knownParameters = 'Source', 'Destination', 'SourceSqlCredential', 'DestinationSqlCredential', 'Project', 'Folder', 'Environment', 'CreateCatalogPassword', 'EnableSqlClr', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaSysDbUserObject.Tests.ps1 b/tests/Copy-DbaSysDbUserObject.Tests.ps1 index 663b1bc35a..2236d44e11 100644 --- a/tests/Copy-DbaSysDbUserObject.Tests.ps1 +++ b/tests/Copy-DbaSysDbUserObject.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Copy-DbaSysDbUserObject).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Force','Classic','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Force', 'Classic', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Copy-DbaXESessionTemplate.Tests.ps1 b/tests/Copy-DbaXESessionTemplate.Tests.ps1 index d6303d9886..5fbf6e1b49 100644 --- a/tests/Copy-DbaXESessionTemplate.Tests.ps1 +++ b/tests/Copy-DbaXESessionTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Copy-DbaXESessionTemplate).Parameters.Keys - $knownParameters = 'Path','Destination','EnableException' + $knownParameters = 'Path', 'Destination', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Get-ChildItem "$home\Documents\SQL Server Management Studio\Templates\XEventTemplates" | Where-Object Name -eq $source | Should Not Be Null } } -} +} \ No newline at end of file diff --git a/tests/Disable-DbaAgHadr.Tests.ps1 b/tests/Disable-DbaAgHadr.Tests.ps1 index e59436a0d4..d36044ecd3 100644 --- a/tests/Disable-DbaAgHadr.Tests.ps1 +++ b/tests/Disable-DbaAgHadr.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Disable-DbaAgHadr).Parameters.Keys $knownParameters = 'SqlInstance', 'Credential', 'Force', 'EnableException' @@ -25,10 +25,10 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { BeforeAll { Enable-DbaAgHadr -SqlInstance $script:instance3 -Confirm:$false -Force } - + $results = Disable-DbaAgHadr -SqlInstance $script:instance3 -Confirm:$false -Force - + It "disables hadr" { $results.IsHadrEnabled | Should -Be $false } -} +} \ No newline at end of file diff --git a/tests/Disable-DbaFilestream.Tests.ps1 b/tests/Disable-DbaFilestream.Tests.ps1 index 34035fd729..31f2e133f8 100644 --- a/tests/Disable-DbaFilestream.Tests.ps1 +++ b/tests/Disable-DbaFilestream.Tests.ps1 @@ -11,7 +11,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Disable-DbaFilestream).Parameters.Keys @@ -33,7 +33,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { AfterAll { Set-DbaFilestream -SqlInstance $script:instance1 -FileStreamLevel $OriginalFileStream.InstanceAccessLevel -force } - + Context "Changing FileStream Level" { $NewLevel = ($OriginalFileStream.FileStreamStateId + 1) % 3 #Move it on one, but keep it less than 4 with modulo division $results = Set-DbaFilestream -SqlInstance $script:instance1 -FileStreamLevel $NewLevel -Force -WarningVariable warnvar -WarningAction silentlyContinue -ErrorVariable errvar -Erroraction silentlyContinue @@ -42,4 +42,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } } } -#> +#> \ No newline at end of file diff --git a/tests/Disable-DbaForceNetworkEncryption.Tests.ps1 b/tests/Disable-DbaForceNetworkEncryption.Tests.ps1 index e18ea097e4..47f223586e 100644 --- a/tests/Disable-DbaForceNetworkEncryption.Tests.ps1 +++ b/tests/Disable-DbaForceNetworkEncryption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Disable-DbaForceNetworkEncryption).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,4 +23,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "returns false" { $results.ForceEncryption -eq $false } -} +} \ No newline at end of file diff --git a/tests/Disable-DbaTraceFlag.Tests.ps1 b/tests/Disable-DbaTraceFlag.Tests.ps1 index e96a429671..a42a702aa8 100644 --- a/tests/Disable-DbaTraceFlag.Tests.ps1 +++ b/tests/Disable-DbaTraceFlag.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Disable-DbaTraceFlag).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','TraceFlag','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'TraceFlag', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,4 +41,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.TraceFlag -contains $safetraceflag | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Dismount-DbaDatabase.Tests.ps1 b/tests/Dismount-DbaDatabase.Tests.ps1 index 88fe95f4f7..869de71469 100644 --- a/tests/Dismount-DbaDatabase.Tests.ps1 +++ b/tests/Dismount-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Dismount-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','UpdateStatistics','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'UpdateStatistics', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -103,4 +103,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } } } -#$script:instance2 - to make it show up in appveyor, long story +#$script:instance2 - to make it show up in appveyor, long story \ No newline at end of file diff --git a/tests/Enable-DbaAgHadr.Tests.ps1 b/tests/Enable-DbaAgHadr.Tests.ps1 index cbb0b02c1c..1a406bfa10 100644 --- a/tests/Enable-DbaAgHadr.Tests.ps1 +++ b/tests/Enable-DbaAgHadr.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Enable-DbaAgHadr).Parameters.Keys $knownParameters = 'SqlInstance', 'Credential', 'Force', 'EnableException' @@ -33,10 +33,10 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { Disable-DbaAgHadr -SqlInstance $script:instance3 -Confirm:$false -WarningAction SilentlyContinue -Force } } - + $results = Enable-DbaAgHadr -SqlInstance $script:instance3 -Confirm:$false -Force - + It "enables hadr" { $results.IsHadrEnabled | Should -Be $true } -} +} \ No newline at end of file diff --git a/tests/Enable-DbaFilestream.Tests.ps1 b/tests/Enable-DbaFilestream.Tests.ps1 index 993a3131bf..d5a516503c 100644 --- a/tests/Enable-DbaFilestream.Tests.ps1 +++ b/tests/Enable-DbaFilestream.Tests.ps1 @@ -11,7 +11,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Enable-DbaFilestream).Parameters.Keys @@ -37,7 +37,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { Enable-DbaFilestream -SqlInstance $script:instance1 -FileStreamLevel $OriginalFileStream.InstanceAccessLevel -Confirm:$false } } - + Context "Changing FileStream Level" { $NewLevel = ($OriginalFileStream.FileStreamStateId + 1) % 3 #Move it on one, but keep it less than 4 with modulo division $results = Enable-DbaFilestream -SqlInstance $script:instance1 -FileStreamLevel $NewLevel -Confirm:$false @@ -46,4 +46,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } } } -#> +#> \ No newline at end of file diff --git a/tests/Enable-DbaForceNetworkEncryption.Tests.ps1 b/tests/Enable-DbaForceNetworkEncryption.Tests.ps1 index ed53ba10f9..5f7dbd33f4 100644 --- a/tests/Enable-DbaForceNetworkEncryption.Tests.ps1 +++ b/tests/Enable-DbaForceNetworkEncryption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Enable-DbaForceNetworkEncryption).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,4 +23,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "returns true" { $results.ForceEncryption -eq $true } -} +} \ No newline at end of file diff --git a/tests/Enable-DbaTraceFlag.Tests.ps1 b/tests/Enable-DbaTraceFlag.Tests.ps1 index 61755d4ecf..e2699c937a 100644 --- a/tests/Enable-DbaTraceFlag.Tests.ps1 +++ b/tests/Enable-DbaTraceFlag.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Enable-DbaTraceFlag).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','TraceFlag','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'TraceFlag', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.TraceFlag -contains $safetraceflag | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Expand-DbaTLogResponsibly.Tests.ps1 b/tests/Expand-DbaTLogResponsibly.Tests.ps1 index 87962b9162..1d8c9af21b 100644 --- a/tests/Expand-DbaTLogResponsibly.Tests.ps1 +++ b/tests/Expand-DbaTLogResponsibly.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 12 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Expand-DbaTLogResponsibly).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','TargetLogSize','IncrementSize','LogFileId','ShrinkLogFile','ShrinkSize','BackupDirectory','ExcludeDiskSpaceValidation','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'TargetLogSize', 'IncrementSize', 'LogFileId', 'ShrinkLogFile', 'ShrinkSize', 'BackupDirectory', 'ExcludeDiskSpaceValidation', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -45,4 +45,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $result.InitialSize -gt $result.CurrentSize } } -} +} \ No newline at end of file diff --git a/tests/Export-DbaAvailabilityGroup.Tests.ps1 b/tests/Export-DbaAvailabilityGroup.Tests.ps1 index 12c5327b27..e14f805cf6 100644 --- a/tests/Export-DbaAvailabilityGroup.Tests.ps1 +++ b/tests/Export-DbaAvailabilityGroup.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Export-DbaAvailabilityGroup).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','AvailabilityGroup','ExcludeAvailabilityGroup','Path','NoClobber','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'ExcludeAvailabilityGroup', 'Path', 'NoClobber', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -28,8 +28,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $servicename = $server.ServiceName if ($servicename -eq 'MSSQLSERVER') { $instancename = "$computername" - } - else { + } else { $instancename = "$computername\$servicename" } $server.Query("create database $dbname") @@ -53,8 +52,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { Get-DbaDatabase -SqlInstance $script:instance3 -Database $dbname | Remove-DbaDatabase -Confirm:$false $server.Query("DROP ENDPOINT dbatoolsci_AGEndpoint") $server.Query("DROP CERTIFICATE dbatoolsci_AGCert") - } - catch { + } catch { # don't care } } @@ -81,4 +79,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results | Remove-Item -ErrorAction SilentlyContinue } } -# $script:instance2 - to make it appear in the proper place on appveyor +# $script:instance2 - to make it appear in the proper place on appveyor \ No newline at end of file diff --git a/tests/Export-DbaCmsRegServer.Tests.ps1 b/tests/Export-DbaCmsRegServer.Tests.ps1 index 7bcbdded75..fc34bc0f90 100644 --- a/tests/Export-DbaCmsRegServer.Tests.ps1 +++ b/tests/Export-DbaCmsRegServer.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -75,4 +74,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results4.ServerName | Should -Be $newServer3.ServerName $results4.Description | Should -Be $newServer3.Description } -} +} \ No newline at end of file diff --git a/tests/Export-DbaCredential.Tests.ps1 b/tests/Export-DbaCredential.Tests.ps1 index 5d27a4c7f2..09d1d7452d 100644 --- a/tests/Export-DbaCredential.Tests.ps1 +++ b/tests/Export-DbaCredential.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaCredential).Parameters.Keys - $knownParameters = 'SqlInstance','Identity','SqlCredential','Credential','Path','ExcludePassword','Append','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'Identity', 'SqlCredential', 'Credential', 'Path', 'ExcludePassword', 'Append', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaDacPackage.Tests.ps1 b/tests/Export-DbaDacPackage.Tests.ps1 index ec473b140b..f700dc2c97 100644 --- a/tests/Export-DbaDacPackage.Tests.ps1 +++ b/tests/Export-DbaDacPackage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 12 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaDacPackage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','AllUserDatabases','Path','ExtendedParameters','ExtendedProperties','EnableException', 'Type', 'DacOption', 'Table' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'AllUserDatabases', 'Path', 'ExtendedParameters', 'ExtendedProperties', 'EnableException', 'Type', 'DacOption', 'Table' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -28,8 +28,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { INSERT dbo.example SELECT top 100 object_id FROM sys.objects") - } - catch { } # No idea why appveyor can't handle this + } catch { } # No idea why appveyor can't handle this $testFolder = 'C:\Temp\dacpacs' } @@ -123,4 +122,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Export-DbaDiagnosticQuery.Tests.ps1 b/tests/Export-DbaDiagnosticQuery.Tests.ps1 index bfe3f9d245..e1894c725e 100644 --- a/tests/Export-DbaDiagnosticQuery.Tests.ps1 +++ b/tests/Export-DbaDiagnosticQuery.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaDiagnosticQuery).Parameters.Keys - $knownParameters = 'InputObject','ConvertTo','Path','Suffix','NoPlanExport','NoQueryExport','EnableException' + $knownParameters = 'InputObject', 'ConvertTo', 'Path', 'Suffix', 'NoPlanExport', 'NoQueryExport', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -27,4 +27,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { (Get-ChildItem "$env:temp\dbatoolsci").Count | Should Be 1 } } -} +} \ No newline at end of file diff --git a/tests/Export-DbaExecutionPlan.Tests.ps1 b/tests/Export-DbaExecutionPlan.Tests.ps1 index 215aa710a8..41e44a14f7 100644 --- a/tests/Export-DbaExecutionPlan.Tests.ps1 +++ b/tests/Export-DbaExecutionPlan.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Export-DbaExecutionPlan).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Path','SinceCreation','SinceLastExecution','PipedObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Path', 'SinceCreation', 'SinceLastExecution', 'PipedObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaInstance.Tests.ps1 b/tests/Export-DbaInstance.Tests.ps1 index 20b711bc7e..a50cfcfe14 100644 --- a/tests/Export-DbaInstance.Tests.ps1 +++ b/tests/Export-DbaInstance.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaInstance).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Credential','Path','NoRecovery','IncludeDbMasterKey','Exclude','BatchSeparator','ScriptingOption','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Credential', 'Path', 'NoRecovery', 'IncludeDbMasterKey', 'Exclude', 'BatchSeparator', 'ScriptingOption', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaLinkedServer.Tests.ps1 b/tests/Export-DbaLinkedServer.Tests.ps1 index 28f0368dac..51ceb9d7df 100644 --- a/tests/Export-DbaLinkedServer.Tests.ps1 +++ b/tests/Export-DbaLinkedServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaLinkedServer).Parameters.Keys - $knownParameters = 'SqlInstance','LinkedServer','SqlCredential','Credential','Path','ExcludePassword','Append','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'LinkedServer', 'SqlCredential', 'Credential', 'Path', 'ExcludePassword', 'Append', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaLogin.Tests.ps1 b/tests/Export-DbaLogin.Tests.ps1 index f3c2fb4afd..ef6833069b 100644 --- a/tests/Export-DbaLogin.Tests.ps1 +++ b/tests/Export-DbaLogin.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Export-DbaLogin).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Login','ExcludeLogin','Database','Path','NoClobber','Append','NoDatabases','NoJobs','EnableException','ExcludeGoBatchSeparator','DestinationVersion' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'ExcludeLogin', 'Database', 'Path', 'NoClobber', 'Append', 'NoDatabases', 'NoJobs', 'EnableException', 'ExcludeGoBatchSeparator', 'DestinationVersion' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -47,8 +47,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } $null = $server.Query("GRANT SELECT ON sys.databases TO [$login2] WITH GRANT OPTION") $server.Databases[$dbname2].ExecuteNonQuery("CREATE USER [$user2] FOR LOGIN [$login2]") - } - catch { } # No idea why appveyor can't handle this + } catch { } # No idea why appveyor can't handle this } AfterAll { Remove-DbaDatabase -SqlInstance $script:instance1 -Database $dbname1 -Confirm:$false @@ -98,4 +97,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Test-Path -Path $outputFile | Should Be $true } -} +} \ No newline at end of file diff --git a/tests/Export-DbaPfDataCollectorSetTemplate.Tests.ps1 b/tests/Export-DbaPfDataCollectorSetTemplate.Tests.ps1 index 7b9db2a34d..944768492f 100644 --- a/tests/Export-DbaPfDataCollectorSetTemplate.Tests.ps1 +++ b/tests/Export-DbaPfDataCollectorSetTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaPfDataCollectorSetTemplate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','Path','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'Path', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.BaseName | Should Be 'Long Running Queries' } } -} +} \ No newline at end of file diff --git a/tests/Export-DbaRepServerSetting.Tests.ps1 b/tests/Export-DbaRepServerSetting.Tests.ps1 index 41d491be26..13dca33d07 100644 --- a/tests/Export-DbaRepServerSetting.Tests.ps1 +++ b/tests/Export-DbaRepServerSetting.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaRepServerSetting).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','ScriptOption','InputObject','Encoding','Passthru','NoClobber','Append','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'ScriptOption', 'InputObject', 'Encoding', 'Passthru', 'NoClobber', 'Append', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaScript.Tests.ps1 b/tests/Export-DbaScript.Tests.ps1 index f3532f7d57..8de587df6b 100644 --- a/tests/Export-DbaScript.Tests.ps1 +++ b/tests/Export-DbaScript.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Export-DbaScript).Parameters.Keys - $knownParameters = 'InputObject','ScriptingOptionsObject','Path','Encoding','BatchSeparator','NoPrefix','Passthru','NoClobber','Append','EnableException' + $knownParameters = 'InputObject', 'ScriptingOptionsObject', 'Path', 'Encoding', 'BatchSeparator', 'NoPrefix', 'Passthru', 'NoClobber', 'Append', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaSpConfigure.Tests.ps1 b/tests/Export-DbaSpConfigure.Tests.ps1 index d21a4d89d4..44df8019fd 100644 --- a/tests/Export-DbaSpConfigure.Tests.ps1 +++ b/tests/Export-DbaSpConfigure.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaSpConfigure).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaUser.Tests.ps1 b/tests/Export-DbaUser.Tests.ps1 index 95da257498..839fb7912b 100644 --- a/tests/Export-DbaUser.Tests.ps1 +++ b/tests/Export-DbaUser.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 12 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaUser).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','User','DestinationVersion','Path','NoClobber','Append','EnableException','ScriptingOptionsObject','ExcludeGoBatchSeparator' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'User', 'DestinationVersion', 'Path', 'NoClobber', 'Append', 'EnableException', 'ScriptingOptionsObject', 'ExcludeGoBatchSeparator' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,8 +32,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $db = Get-DbaDatabase -SqlInstance $script:instance1 -Database $dbname $null = $db.Query("CREATE USER [$user] FOR LOGIN [$login]") - } - catch { } # No idea why appveyor can't handle this + } catch { } # No idea why appveyor can't handle this } AfterAll { Remove-DbaDatabase -SqlInstance $script:instance1 -Database $dbname -Confirm:$false @@ -52,4 +51,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Export-DbaXECsv.Tests.ps1 b/tests/Export-DbaXECsv.Tests.ps1 index 1c3def8e36..c3a258c224 100644 --- a/tests/Export-DbaXECsv.Tests.ps1 +++ b/tests/Export-DbaXECsv.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaXECsv).Parameters.Keys - $knownParameters = 'InputObject','Path','EnableException' + $knownParameters = 'InputObject', 'Path', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Export-DbaXESessionTemplate.Tests.ps1 b/tests/Export-DbaXESessionTemplate.Tests.ps1 index 4374fc5c23..9100cfc6e4 100644 --- a/tests/Export-DbaXESessionTemplate.Tests.ps1 +++ b/tests/Export-DbaXESessionTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Export-DbaXESessionTemplate).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','Path','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'Path', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -29,4 +29,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Be 'Profiler TSQL Duration.xml' } } -} +} \ No newline at end of file diff --git a/tests/Find-DbaAgentJob.Tests.ps1 b/tests/Find-DbaAgentJob.Tests.ps1 index cdae330226..c251948288 100644 --- a/tests/Find-DbaAgentJob.Tests.ps1 +++ b/tests/Find-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 14 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaAgentJob).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','JobName','ExcludeJobName','StepName','LastUsed','IsDisabled','IsFailed','IsNotScheduled','IsNoEmailNotification','Category','Owner','Since','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'JobName', 'ExcludeJobName', 'StepName', 'LastUsed', 'IsDisabled', 'IsFailed', 'IsNotScheduled', 'IsNoEmailNotification', 'Category', 'Owner', 'Since', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaBackup.Tests.ps1 b/tests/Find-DbaBackup.Tests.ps1 index bebadf4432..ba2e3b9008 100644 --- a/tests/Find-DbaBackup.Tests.ps1 +++ b/tests/Find-DbaBackup.Tests.ps1 @@ -128,5 +128,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Length | Should Be 5 } } -} - +} \ No newline at end of file diff --git a/tests/Find-DbaCommand.Tests.ps1 b/tests/Find-DbaCommand.Tests.ps1 index 4dc36b9484..750f57da67 100644 --- a/tests/Find-DbaCommand.Tests.ps1 +++ b/tests/Find-DbaCommand.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Find-DbaCommand).Parameters.Keys - $knownParameters = 'Pattern','Tag','Author','MinimumVersion','MaximumVersion','Rebuild','EnableException' + $knownParameters = 'Pattern', 'Tag', 'Author', 'MinimumVersion', 'MaximumVersion', 'Rebuild', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaDatabase.Tests.ps1 b/tests/Find-DbaDatabase.Tests.ps1 index d6906cbc60..a9395005a1 100644 --- a/tests/Find-DbaDatabase.Tests.ps1 +++ b/tests/Find-DbaDatabase.Tests.ps1 @@ -55,5 +55,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.ServiceBrokerGuid | Should BeLike '*-0000-0000-000000000000' } } -} - +} \ No newline at end of file diff --git a/tests/Find-DbaDbGrowthEvent.Tests.ps1 b/tests/Find-DbaDbGrowthEvent.Tests.ps1 index 6584b17d45..2440852534 100644 --- a/tests/Find-DbaDbGrowthEvent.Tests.ps1 +++ b/tests/Find-DbaDbGrowthEvent.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaDbGrowthEvent).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EventType','FileType','UseLocalTime','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EventType', 'FileType', 'UseLocalTime', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaDisabledIndex.Tests.ps1 b/tests/Find-DbaDisabledIndex.Tests.ps1 index 8ce5add84f..d1443dae2a 100644 --- a/tests/Find-DbaDisabledIndex.Tests.ps1 +++ b/tests/Find-DbaDisabledIndex.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Find-DbaDisabledIndex).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'NoClobber', 'Append','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'NoClobber', 'Append', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -27,11 +27,11 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $sql = "create table $tableName (col1 int) create index $indexName on $tableName (col1) ALTER INDEX $indexName ON $tableName DISABLE;" - $null = $server.Query($sql,'tempdb') + $null = $server.Query($sql, 'tempdb') } AfterAll { - $sql = "drop table $tableName;" - $null = $server.Query($sql,'tempdb') + $sql = "drop table $tableName;" + $null = $server.Query($sql, 'tempdb') } It "Should find disabled index: $indexName" { @@ -47,4 +47,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.DatabaseName -contains 'tempdb' | Should Be $false } } -} +} \ No newline at end of file diff --git a/tests/Find-DbaDuplicateIndex.Tests.ps1 b/tests/Find-DbaDuplicateIndex.Tests.ps1 index 7e6b1f85a0..6df8025dda 100644 --- a/tests/Find-DbaDuplicateIndex.Tests.ps1 +++ b/tests/Find-DbaDuplicateIndex.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaDuplicateIndex).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','IncludeOverlapping','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'IncludeOverlapping', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -60,4 +60,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Count -ge 2 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Find-DbaInstance.Tests.ps1 b/tests/Find-DbaInstance.Tests.ps1 index 9ee31ae1ff..b6a56057ab 100644 --- a/tests/Find-DbaInstance.Tests.ps1 +++ b/tests/Find-DbaInstance.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaInstance).Parameters.Keys - $knownParameters = 'ComputerName','DiscoveryType','Credential','SqlCredential','ScanType','IpAddress','DomainController','TCPPort','MinimumConfidence','EnableException' + $knownParameters = 'ComputerName', 'DiscoveryType', 'Credential', 'SqlCredential', 'ScanType', 'IpAddress', 'DomainController', 'TCPPort', 'MinimumConfidence', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -33,4 +33,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.InstanceName -contains 'SQL2017' | Should -Be $true } } -} +} \ No newline at end of file diff --git a/tests/Find-DbaLoginInGroup.Tests.ps1 b/tests/Find-DbaLoginInGroup.Tests.ps1 index a5d93da8f5..8c6f627e5a 100644 --- a/tests/Find-DbaLoginInGroup.Tests.ps1 +++ b/tests/Find-DbaLoginInGroup.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaLoginInGroup).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Login','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaOrphanedFile.Tests.ps1 b/tests/Find-DbaOrphanedFile.Tests.ps1 index 6d1fa30eb8..6692a9e9fd 100644 --- a/tests/Find-DbaOrphanedFile.Tests.ps1 +++ b/tests/Find-DbaOrphanedFile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaOrphanedFile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','FileType','LocalOnly','RemoteOnly','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'FileType', 'LocalOnly', 'RemoteOnly', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -57,4 +57,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Count | Should Be 0 } } -} +} \ No newline at end of file diff --git a/tests/Find-DbaSimilarTable.Tests.ps1 b/tests/Find-DbaSimilarTable.Tests.ps1 index 4a353e8ac3..238e080cd8 100644 --- a/tests/Find-DbaSimilarTable.Tests.ps1 +++ b/tests/Find-DbaSimilarTable.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaSimilarTable).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','SchemaName','TableName','ExcludeViews','IncludeSystemDatabases','MatchPercentThreshold','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'SchemaName', 'TableName', 'ExcludeViews', 'IncludeSystemDatabases', 'MatchPercentThreshold', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,4 +41,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Find-DbaStoredProcedure.Tests.ps1 b/tests/Find-DbaStoredProcedure.Tests.ps1 index 6bdbc4b9a7..abca884fcc 100644 --- a/tests/Find-DbaStoredProcedure.Tests.ps1 +++ b/tests/Find-DbaStoredProcedure.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaStoredProcedure).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Pattern','IncludeSystemObjects','IncludeSystemDatabases','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Pattern', 'IncludeSystemObjects', 'IncludeSystemDatabases', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaTrigger.Tests.ps1 b/tests/Find-DbaTrigger.Tests.ps1 index 438742517a..e64f24e55a 100644 --- a/tests/Find-DbaTrigger.Tests.ps1 +++ b/tests/Find-DbaTrigger.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaTrigger).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Pattern','TriggerLevel','IncludeSystemObjects','IncludeSystemDatabases','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Pattern', 'TriggerLevel', 'IncludeSystemObjects', 'IncludeSystemDatabases', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaUserObject.Tests.ps1 b/tests/Find-DbaUserObject.Tests.ps1 index 517a875c97..3bd5e4f0b3 100644 --- a/tests/Find-DbaUserObject.Tests.ps1 +++ b/tests/Find-DbaUserObject.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaUserObject).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Pattern','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Pattern', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Find-DbaView.Tests.ps1 b/tests/Find-DbaView.Tests.ps1 index c04cc3c02c..bb10c78875 100644 --- a/tests/Find-DbaView.Tests.ps1 +++ b/tests/Find-DbaView.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Find-DbaView).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Pattern','IncludeSystemObjects','IncludeSystemDatabases','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Pattern', 'IncludeSystemObjects', 'IncludeSystemDatabases', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Format-DbaBackupInformation.Tests.ps1 b/tests/Format-DbaBackupInformation.Tests.ps1 index 584b4476f4..6ad605bdad 100644 --- a/tests/Format-DbaBackupInformation.Tests.ps1 +++ b/tests/Format-DbaBackupInformation.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 14 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Format-DbaBackupInformation).Parameters.Keys - $knownParameters = 'BackupHistory','ReplaceDatabaseName','ReplaceDbNameInFile','DataFileDirectory','LogFileDirectory','DestinationFileStreamDirectory','DatabaseNamePrefix','DatabaseFilePrefix','DatabaseFileSuffix','RebaseBackupFolder','Continue','FileMapping','PathSep','EnableException' + $knownParameters = 'BackupHistory', 'ReplaceDatabaseName', 'ReplaceDbNameInFile', 'DataFileDirectory', 'LogFileDirectory', 'DestinationFileStreamDirectory', 'DatabaseNamePrefix', 'DatabaseFilePrefix', 'DatabaseFileSuffix', 'RebaseBackupFolder', 'Continue', 'FileMapping', 'PathSep', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -146,16 +146,16 @@ Describe "$CommandName Integration Tests" -Tags 'IntegrationTests' { $History = Get-DbaBackupInformation -Import -Path $PSScriptRoot\..\tests\ObjectDefinitions\BackupRestore\RawInput\ContinuePointTest.xml $History += Get-DbaBackupInformation -Import -Path $PSScriptRoot\..\tests\ObjectDefinitions\BackupRestore\RawInput\RestoreTimeClean.xml $Output = Format-DbaBackupInformation -BackupHistory $History -RebaseBackupFolder 'c:\backups' - It "Should not have changed the default path separator" { + It "Should not have changed the default path separator" { ($Output | Select-Object -ExpandProperty FullName | split-path | Where-Object {$_ -eq 'c:\backups'}).count | Should Be $History.count } - $Output = Format-DbaBackupInformation -BackupHistory $History -RebaseBackupFolder 'c:\backups' -PathSep '\' - It "Should not have changed the default path separator even when passed explicitely" { + $Output = Format-DbaBackupInformation -BackupHistory $History -RebaseBackupFolder 'c:\backups' -PathSep '\' + It "Should not have changed the default path separator even when passed explicitely" { ($Output | Select-Object -ExpandProperty FullName | split-path | Where-Object {$_ -eq 'c:\backups'}).count | Should Be $History.count } - $Output = Format-DbaBackupInformation -BackupHistory $History -RebaseBackupFolder '/opt/mssql/backups' -PathSep '/' - It "Should have changed the path separator as instructed" { - $result = $Output | Select-Object -ExpandProperty FullName | ForEach-Object { $all=$_.Split('/'); $all[0..($all.Length-2)] -Join '/'} + $Output = Format-DbaBackupInformation -BackupHistory $History -RebaseBackupFolder '/opt/mssql/backups' -PathSep '/' + It "Should have changed the path separator as instructed" { + $result = $Output | Select-Object -ExpandProperty FullName | ForEach-Object { $all = $_.Split('/'); $all[0..($all.Length - 2)] -Join '/'} ($result | Where-Object {$_ -eq '/opt/mssql/backups'}).count | Should Be $History.count } } @@ -180,4 +180,4 @@ Describe "$CommandName Integration Tests" -Tags 'IntegrationTests' { } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgDatabase.Tests.ps1 b/tests/Get-DbaAgDatabase.Tests.ps1 index 15350c7774..b9729f9b1d 100644 --- a/tests/Get-DbaAgDatabase.Tests.ps1 +++ b/tests/Get-DbaAgDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgDatabase).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Database', 'InputObject', 'EnableException' @@ -44,4 +44,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Replica | Should -Not -Be $null } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Get-DbaAgHadr.Tests.ps1 b/tests/Get-DbaAgHadr.Tests.ps1 index 0d3a0576f2..833dd01895 100644 --- a/tests/Get-DbaAgHadr.Tests.ps1 +++ b/tests/Get-DbaAgHadr.Tests.ps1 @@ -24,4 +24,4 @@ Describe "$CommandName Integration Test" -Tag "IntegrationTests" { $results.IsHadrEnabled | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgListener.Tests.ps1 b/tests/Get-DbaAgListener.Tests.ps1 index 314f8cfc2f..2c2a18d60d 100644 --- a/tests/Get-DbaAgListener.Tests.ps1 +++ b/tests/Get-DbaAgListener.Tests.ps1 @@ -7,10 +7,10 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgListener).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Listener','InputObject', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Listener', 'InputObject', 'EnableException' $paramCount = $knownParameters.Count It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -25,7 +25,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { BeforeAll { $agname = "dbatoolsci_ag_listener" $ag = New-DbaAvailabilityGroup -Primary $script:instance3 -Name $agname -ClusterType None -FailoverMode Manual -Confirm:$false -Certificate dbatoolsci_AGCert | - Add-DbaAgListener -IPAddress 127.0.20.1 -Confirm:$false + Add-DbaAgListener -IPAddress 127.0.20.1 -Confirm:$false } AfterAll { $null = Remove-DbaAvailabilityGroup -SqlInstance $server -AvailabilityGroup $agname -Confirm:$false @@ -36,4 +36,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.PortNumber | Should -Contain 1433 } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Get-DbaAgReplica.Tests.ps1 b/tests/Get-DbaAgReplica.Tests.ps1 index d136222046..5bcbf34145 100644 --- a/tests/Get-DbaAgReplica.Tests.ps1 +++ b/tests/Get-DbaAgReplica.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgReplica).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Replica', 'EnableException', 'InputObject' @@ -44,4 +44,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.AvailabilityMode | Should -Be 'SynchronousCommit' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Get-DbaAgentAlert.Tests.ps1 b/tests/Get-DbaAgentAlert.Tests.ps1 index 52fa18991c..46d37c6f2f 100644 --- a/tests/Get-DbaAgentAlert.Tests.ps1 +++ b/tests/Get-DbaAgentAlert.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgentAlert).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -31,4 +31,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "gets the newly created alert" { $results.Name -contains 'dbatoolsci test alert' } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgentJob.Tests.ps1 b/tests/Get-DbaAgentJob.Tests.ps1 index 2f89072dce..067824a85a 100644 --- a/tests/Get-DbaAgentJob.Tests.ps1 +++ b/tests/Get-DbaAgentJob.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "Should get a specific job" { $results.name | Should Be "dbatoolsci_testjob" } - + } Context "Command gets no disabled jobs" { BeforeAll { @@ -62,4 +62,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.name -contains "dbatoolsci_testjob" | Should Be $False } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgentJobCategory.Tests.ps1 b/tests/Get-DbaAgentJobCategory.Tests.ps1 index 6b6271ae44..c56a520eb0 100644 --- a/tests/Get-DbaAgentJobCategory.Tests.ps1 +++ b/tests/Get-DbaAgentJobCategory.Tests.ps1 @@ -38,4 +38,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.count | Should BeGreaterThan 1 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgentJobHistory.Tests.ps1 b/tests/Get-DbaAgentJobHistory.Tests.ps1 index c1c8f3a48b..c310b9e8fa 100644 --- a/tests/Get-DbaAgentJobHistory.Tests.ps1 +++ b/tests/Get-DbaAgentJobHistory.Tests.ps1 @@ -24,7 +24,7 @@ Describe "$CommandName Unittests" -Tag 'UnitTests' { # Thanks @Fred $obj = [PSCustomObject]@{ Name = 'BASEName' - ComputerName = 'BASEComputerName' + ComputerName = 'BASEComputerName' InstanceName = 'BASEInstanceName' DomainInstanceName = 'BASEDomainInstanceName' InstallDataDirectory = 'BASEInstallDataDirectory' @@ -400,5 +400,4 @@ Describe "$CommandName Unittests" -Tag 'UnitTests' { } } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaAgentJobOutputFile.Tests.ps1 b/tests/Get-DbaAgentJobOutputFile.Tests.ps1 index 3879d8f02d..e2102d83f8 100644 --- a/tests/Get-DbaAgentJobOutputFile.Tests.ps1 +++ b/tests/Get-DbaAgentJobOutputFile.Tests.ps1 @@ -22,9 +22,9 @@ Describe "$CommandName Unittests" -Tag 'UnitTests' { Context "Return values" { Mock Connect-SQLInstance -MockWith { [object]@{ - Name = 'SQLServerName' - ComputerName = 'SQLServerName' - JobServer = @{ + Name = 'SQLServerName' + ComputerName = 'SQLServerName' + JobServer = @{ Jobs = @( @{ Name = 'Job1' @@ -103,6 +103,4 @@ Describe "$CommandName Unittests" -Tag 'UnitTests' { } } } -} - - +} \ No newline at end of file diff --git a/tests/Get-DbaAgentJobStep.Tests.ps1 b/tests/Get-DbaAgentJobStep.Tests.ps1 index 146a193899..fed01b6955 100644 --- a/tests/Get-DbaAgentJobStep.Tests.ps1 +++ b/tests/Get-DbaAgentJobStep.Tests.ps1 @@ -81,6 +81,4 @@ Describe "$CommandName Unittests" -Tag 'UnitTests' { } } } -} - - +} \ No newline at end of file diff --git a/tests/Get-DbaAgentLog.Tests.ps1 b/tests/Get-DbaAgentLog.Tests.ps1 index 1fb572666e..09a440f38b 100644 --- a/tests/Get-DbaAgentLog.Tests.ps1 +++ b/tests/Get-DbaAgentLog.Tests.ps1 @@ -36,4 +36,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results | Should Not Be $Null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgentOperator.Tests.ps1 b/tests/Get-DbaAgentOperator.Tests.ps1 index c1e4f96d36..429abbccb5 100644 --- a/tests/Get-DbaAgentOperator.Tests.ps1 +++ b/tests/Get-DbaAgentOperator.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgentOperator).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Operator','ExcludeOperator','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Operator', 'ExcludeOperator', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,4 +41,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Count | Should Be 1 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaAgentProxy.Tests.ps1 b/tests/Get-DbaAgentProxy.Tests.ps1 index 074c6edde7..4df5bf9839 100644 --- a/tests/Get-DbaAgentProxy.Tests.ps1 +++ b/tests/Get-DbaAgentProxy.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgentProxy).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Proxy','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Proxy', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaAgentSchedule.Tests.ps1 b/tests/Get-DbaAgentSchedule.Tests.ps1 index 07d4428fee..88b5b58800 100644 --- a/tests/Get-DbaAgentSchedule.Tests.ps1 +++ b/tests/Get-DbaAgentSchedule.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAgentSchedule).Parameters.Keys - $knownParameters = 'SqlInstance','Schedule','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'Schedule', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaAvailabilityGroup.Tests.ps1 b/tests/Get-DbaAvailabilityGroup.Tests.ps1 index 3293998004..7e058fa452 100644 --- a/tests/Get-DbaAvailabilityGroup.Tests.ps1 +++ b/tests/Get-DbaAvailabilityGroup.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAvailabilityGroup).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'IsPrimary', 'EnableException' @@ -34,7 +34,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Get-DbaAvailabilityGroup -SqlInstance $script:instance3 $results.AvailabilityGroup | Should -Contain $agname } - + It "returns a single result" { $results = Get-DbaAvailabilityGroup -SqlInstance $script:instance3 -AvailabilityGroup $agname $results.AvailabilityGroup | Should -Be $agname diff --git a/tests/Get-DbaAvailableCollation.Tests.ps1 b/tests/Get-DbaAvailableCollation.Tests.ps1 index a46ebec80a..4c312017aa 100644 --- a/tests/Get-DbaAvailableCollation.Tests.ps1 +++ b/tests/Get-DbaAvailableCollation.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaAvailableCollation).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results.Name -match 'Slovenian').Count -gt 10 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaBackupDevice.Tests.ps1 b/tests/Get-DbaBackupDevice.Tests.ps1 index 5d5488eb78..1d80f59fbc 100644 --- a/tests/Get-DbaBackupDevice.Tests.ps1 +++ b/tests/Get-DbaBackupDevice.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaBackupDevice).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaBackupHistory.Tests.ps1 b/tests/Get-DbaBackupHistory.Tests.ps1 index 7713333182..922df8d174 100644 --- a/tests/Get-DbaBackupHistory.Tests.ps1 +++ b/tests/Get-DbaBackupHistory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 17 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaBackupHistory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','IncludeCopyOnly','Force','Since','Last','LastFull','LastDiff','LastLog','DeviceType','Raw','LastLsn','Type','EnableException','RecoveryFork' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeCopyOnly', 'Force', 'Since', 'Last', 'LastFull', 'LastDiff', 'LastLog', 'DeviceType', 'Raw', 'LastLsn', 'Type', 'EnableException', 'RecoveryFork' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -94,4 +94,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { ($historyObject.TotalSize.Byte)| Should -Be 1000000000000000 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaBackupInformation.Tests.ps1 b/tests/Get-DbaBackupInformation.Tests.ps1 index a9e390b9ab..3313ea1908 100644 --- a/tests/Get-DbaBackupInformation.Tests.ps1 +++ b/tests/Get-DbaBackupInformation.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 16 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaBackupInformation).Parameters.Keys - $knownParameters = 'Path','SqlInstance','SqlCredential','DatabaseName','SourceInstance','NoXpDirTree','DirectoryRecurse','EnableException','MaintenanceSolution','IgnoreLogBackup','ExportPath','AzureCredential','Import','Anonymise','NoClobber','PassThru' + $knownParameters = 'Path', 'SqlInstance', 'SqlCredential', 'DatabaseName', 'SourceInstance', 'NoXpDirTree', 'DirectoryRecurse', 'EnableException', 'MaintenanceSolution', 'IgnoreLogBackup', 'ExportPath', 'AzureCredential', 'Import', 'Anonymise', 'NoClobber', 'PassThru' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,8 +23,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $DestBackupDir = 'C:\Temp\GetBackups' if (-Not(Test-Path $DestBackupDir)) { New-Item -Type Container -Path $DestBackupDir - } - else { + } else { Remove-Item $DestBackupDir\* } $random = Get-Random @@ -50,8 +49,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { New-Item -Type Container -Path $DestBackupDirOla\FULL New-Item -Type Container -Path $DestBackupDirOla\DIFF New-Item -Type Container -Path $DestBackupDirOla\LOG - } - else { + } else { Remove-Item $DestBackupDirOla\FULL\* Remove-Item $DestBackupDirOla\DIFF\* Remove-Item $DestBackupDirOla\LOG\* @@ -144,4 +142,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $resultsSanLog.count | Should Be 3 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaBuildReference.Tests.ps1 b/tests/Get-DbaBuildReference.Tests.ps1 index ec09f4e2e7..a7515b8e14 100644 --- a/tests/Get-DbaBuildReference.Tests.ps1 +++ b/tests/Get-DbaBuildReference.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaBuildReference).Parameters.Keys - $knownParameters = 'Build','SqlInstance','SqlCredential','Update','EnableException' + $knownParameters = 'Build', 'SqlInstance', 'SqlCredential', 'Update', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -65,8 +65,7 @@ Describe "$CommandName Unit Test" -Tags Unittest { } try { $splitted | Foreach-Object { [convert]::ToInt32($_) } - } - catch { + } catch { # I know. But someone can find a method to output a custom message ? $splitted -join '.' | Should Be "Composed by integers" } @@ -156,4 +155,4 @@ Describe "$commandname Integration Tests" -Tags 'IntegrationTests' { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaClientAlias.Tests.ps1 b/tests/Get-DbaClientAlias.Tests.ps1 index 68226c9eef..1d2fcde39b 100644 --- a/tests/Get-DbaClientAlias.Tests.ps1 +++ b/tests/Get-DbaClientAlias.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaClientAlias).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -31,4 +31,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.AliasName -contains 'dbatoolscialias' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaClientProtocol.Tests.ps1 b/tests/Get-DbaClientProtocol.Tests.ps1 index 67acc87495..902e2e55e0 100644 --- a/tests/Get-DbaClientProtocol.Tests.ps1 +++ b/tests/Get-DbaClientProtocol.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaClientProtocol).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results | Where-Object { $_.ProtocolDisplayName -eq 'TCP/IP' } | Should Not Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaClusterAvailableDisk.Tests.ps1 b/tests/Get-DbaClusterAvailableDisk.Tests.ps1 index 68cd72ea7f..da493e5b98 100644 --- a/tests/Get-DbaClusterAvailableDisk.Tests.ps1 +++ b/tests/Get-DbaClusterAvailableDisk.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcAvailableDisk).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaCmConnection.Tests.ps1 b/tests/Get-DbaCmConnection.Tests.ps1 index 152cc0eb84..54d38d6038 100644 --- a/tests/Get-DbaCmConnection.Tests.ps1 +++ b/tests/Get-DbaCmConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaCmConnection).Parameters.Keys - $knownParameters = 'ComputerName','UserName','EnableException' + $knownParameters = 'ComputerName', 'UserName', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaCmObject.Tests.ps1 b/tests/Get-DbaCmObject.Tests.ps1 index 20f4c2cde7..8174c0c9e7 100644 --- a/tests/Get-DbaCmObject.Tests.ps1 +++ b/tests/Get-DbaCmObject.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaCmObject).Parameters.Keys - $knownParameters = 'ClassName','Query','ComputerName','Credential','Namespace','DoNotUse','Force','SilentlyContinue','EnableException' + $knownParameters = 'ClassName', 'Query', 'ComputerName', 'Credential', 'Namespace', 'DoNotUse', 'Force', 'SilentlyContinue', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,4 +23,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { (Get-DbaCmObject -ClassName Win32_TimeZone).Bias -is [int] } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaCmsRegServer.Tests.ps1 b/tests/Get-DbaCmsRegServer.Tests.ps1 index 97127a3f0f..002ed83c30 100644 --- a/tests/Get-DbaCmsRegServer.Tests.ps1 +++ b/tests/Get-DbaCmsRegServer.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SqlInstance','SqlCredential','Name','ServerName','Group','ExcludeGroup','Id','IncludeSelf','ExcludeCmsServer','ResolveNetworkName','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'ServerName', 'Group', 'ExcludeGroup', 'Id', 'IncludeSelf', 'ExcludeCmsServer', 'ResolveNetworkName', 'EnableException' $SupportShouldProcess = $false $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -38,7 +37,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $regSrvName = "dbatoolsci-server12" $regSrvDesc = "dbatoolsci-server123" - <# Create that first group #> + <# Create that first group #> $newGroup = New-Object Microsoft.SqlServer.Management.RegisteredServers.ServerGroup($dbStore, $group) $newGroup.Create() $dbStore.Refresh() @@ -93,5 +92,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { # Property Comparisons will come later when we have the commands } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaCmsRegServerGroup.Tests.ps1 b/tests/Get-DbaCmsRegServerGroup.Tests.ps1 index a64b9ed890..7b2621c141 100644 --- a/tests/Get-DbaCmsRegServerGroup.Tests.ps1 +++ b/tests/Get-DbaCmsRegServerGroup.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SqlInstance','SqlCredential','Group','ExcludeGroup','Id','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Group', 'ExcludeGroup', 'Id', 'EnableException' $SupportShouldProcess = $false $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -38,7 +37,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $regSrvName = "dbatoolsci-server12" $regSrvDesc = "dbatoolsci-server123" - <# Create that first group #> + <# Create that first group #> $newGroup = New-Object Microsoft.SqlServer.Management.RegisteredServers.ServerGroup($dbStore, $group) $newGroup.Create() $dbStore.Refresh() @@ -81,4 +80,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { # Property Comparisons will come later when we have the commands } -} +} \ No newline at end of file diff --git a/tests/Get-DbaCmsRegServerStore.Tests.ps1 b/tests/Get-DbaCmsRegServerStore.Tests.ps1 index f01f10ee6b..5086e32a71 100644 --- a/tests/Get-DbaCmsRegServerStore.Tests.ps1 +++ b/tests/Get-DbaCmsRegServerStore.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -34,4 +33,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.DisplayName | Should -Be "Central Management Servers" } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaComputerCertificate.Tests.ps1 b/tests/Get-DbaComputerCertificate.Tests.ps1 index e16e7cb381..3d63ed219d 100644 --- a/tests/Get-DbaComputerCertificate.Tests.ps1 +++ b/tests/Get-DbaComputerCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaComputerCertificate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Store','Folder','Path','Thumbprint','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Store', 'Folder', 'Path', 'Thumbprint', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { "$($cert.EnhancedKeyUsageList)" -match '1\.3\.6\.1\.5\.5\.7\.3\.1' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaComputerSystem.Tests.ps1 b/tests/Get-DbaComputerSystem.Tests.ps1 index 16bb5ff73e..cf93081b2d 100644 --- a/tests/Get-DbaComputerSystem.Tests.ps1 +++ b/tests/Get-DbaComputerSystem.Tests.ps1 @@ -41,4 +41,4 @@ Describe "Get-DbaComputerSystem Integration Test" -Tag "IntegrationTests" { $result | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaConnection.Tests.ps1 b/tests/Get-DbaConnection.Tests.ps1 index 8717de52a7..24f23b00b5 100644 --- a/tests/Get-DbaConnection.Tests.ps1 +++ b/tests/Get-DbaConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaConnection).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -26,4 +26,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaCpuRingBuffer.Tests.ps1 b/tests/Get-DbaCpuRingBuffer.Tests.ps1 index be42129742..ae9f5e3260 100644 --- a/tests/Get-DbaCpuRingBuffer.Tests.ps1 +++ b/tests/Get-DbaCpuRingBuffer.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $SupportShouldProcess = $false if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -34,4 +33,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Count -gt 0 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaCpuUsage.Tests.ps1 b/tests/Get-DbaCpuUsage.Tests.ps1 index ff6602efe7..6f44d64807 100644 --- a/tests/Get-DbaCpuUsage.Tests.ps1 +++ b/tests/Get-DbaCpuUsage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaCpuUsage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Credential','Threshold','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Credential', 'Threshold', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaCredential.Tests.ps1 b/tests/Get-DbaCredential.Tests.ps1 index 1f2a724e48..c14bdc7ba3 100644 --- a/tests/Get-DbaCredential.Tests.ps1 +++ b/tests/Get-DbaCredential.Tests.ps1 @@ -9,7 +9,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaCredential).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Name','ExcludeName','Identity','ExcludeIdentity','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'ExcludeName', 'Identity', 'ExcludeIdentity', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,8 +36,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { AfterAll { try { (Get-DbaCredential -SqlInstance $script:instance2 -Identity dbatoolsci_thor, dbatoolsci_thorsmomma -ErrorAction Stop -WarningAction SilentlyContinue).Drop() - } - catch { } + } catch { } foreach ($login in $logins) { $null = Invoke-Command2 -ScriptBlock { net user $args /delete *>&1 } -ArgumentList $login -ComputerName $script:instance2 @@ -61,4 +60,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.count -gt 1 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaCustomError.Tests.ps1 b/tests/Get-DbaCustomError.Tests.ps1 index d97b84bba2..7c008f92a9 100644 --- a/tests/Get-DbaCustomError.Tests.ps1 +++ b/tests/Get-DbaCustomError.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaCustomError).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDatabase.Tests.ps1 b/tests/Get-DbaDatabase.Tests.ps1 index 55bb28592c..4a3e5bf301 100644 --- a/tests/Get-DbaDatabase.Tests.ps1 +++ b/tests/Get-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 18 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ExcludeAllUserDb','ExcludeAllSystemDb','Owner','Encrypted','Status','Access','RecoveryModel','NoFullBackup','NoFullBackupSince','NoLogBackup','NoLogBackupSince','EnableException','IncludeLastUsed','OnlyAccessible' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ExcludeAllUserDb', 'ExcludeAllSystemDb', 'Owner', 'Encrypted', 'Status', 'Access', 'RecoveryModel', 'NoFullBackup', 'NoFullBackupSince', 'NoLogBackup', 'NoLogBackupSince', 'EnableException', 'IncludeLastUsed', 'OnlyAccessible' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -72,7 +72,7 @@ Describe "$commandname Unit Tests" -Tags "UnitTests", Get-DBADatabase { Mock Invoke-QueryRawDatabases -MockWith { [object]@( @{ - name = 'db1' + name = 'db1' state = 0 Owner = 'sa' } @@ -106,15 +106,15 @@ Describe "$commandname Unit Tests" -Tags "UnitTests", Get-DBADatabase { [object]@{ Name = 'SQLServerName' Databases = @( - @{ - Name = 'db1' - Status = 'Normal' - ReadOnly = 'false' - IsSystemObject = 'false' - RecoveryModel = 'Full' - Owner = 'sa' - IsAccessible = $true - } + @{ + Name = 'db1' + Status = 'Normal' + ReadOnly = 'false' + IsSystemObject = 'false' + RecoveryModel = 'Full' + Owner = 'sa' + IsAccessible = $true + } ) } #object } -ModuleName dbatools #mock connect-sqlserver @@ -159,4 +159,4 @@ Describe "$commandname Unit Tests" -Tags "UnitTests", Get-DBADatabase { Assert-MockCalled @assertMockParams } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbAssembly.Tests.ps1 b/tests/Get-DbaDbAssembly.Tests.ps1 index 3f14e94592..f77ed318c4 100644 --- a/tests/Get-DbaDbAssembly.Tests.ps1 +++ b/tests/Get-DbaDbAssembly.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbAssembly).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbCertificate.Tests.ps1 b/tests/Get-DbaDbCertificate.Tests.ps1 index 82870b6fa6..c0ac19d301 100644 --- a/tests/Get-DbaDbCertificate.Tests.ps1 +++ b/tests/Get-DbaDbCertificate.Tests.ps1 @@ -53,4 +53,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbCheckConstraint.Tests.ps1 b/tests/Get-DbaDbCheckConstraint.Tests.ps1 index 83c57eb27b..20f5034ab7 100644 --- a/tests/Get-DbaDbCheckConstraint.Tests.ps1 +++ b/tests/Get-DbaDbCheckConstraint.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbCheckConstraint).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ExcludeSystemTable','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ExcludeSystemTable', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -53,4 +53,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { ($results | Where-Object Name -eq 'spt_fallback_db') | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbCompression.Tests.ps1 b/tests/Get-DbaDbCompression.Tests.ps1 index e4ebdc13ba..861bda9fbb 100644 --- a/tests/Get-DbaDbCompression.Tests.ps1 +++ b/tests/Get-DbaDbCompression.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbCompression).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,8 +25,8 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $null = $server.Query("select * into syscols from sys.all_columns select * into sysallparams from sys.all_parameters create clustered index CL_sysallparams on sysallparams (object_id) - create nonclustered index NC_syscols on syscols (precision) include (collation_name)",$dbname) - } + create nonclustered index NC_syscols on syscols (precision) include (collation_name)", $dbname) + } AfterAll { Get-DbaProcess -SqlInstance $script:instance2 -Database $dbname | Stop-DbaProcess -WarningAction SilentlyContinue Remove-DbaDatabase -SqlInstance $script:instance2 -Database $dbname -Confirm:$false @@ -39,7 +39,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } Foreach ($row in $results | Where-Object {$_.IndexId -le 1}) { It "Should return compression level for object $($row.TableName)" { - $row.DataCompression | Should BeIn ('None','Row','Page') + $row.DataCompression | Should BeIn ('None', 'Row', 'Page') } } } @@ -49,7 +49,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } Foreach ($row in $results | Where-Object {$_.IndexId -gt 1}) { It "Should return compression level for nonclustered index $($row.IndexName)" { - $row.DataCompression | Should BeIn ('None','Row','Page') + $row.DataCompression | Should BeIn ('None', 'Row', 'Page') } } } @@ -59,5 +59,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $(Get-DbaDbCompression -SqlInstance $script:instance2 -Database $dbname -ExcludeDatabase $dbname) | Should not Match $dbname } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaDbEncryption.Tests.ps1 b/tests/Get-DbaDbEncryption.Tests.ps1 index 7292e600a6..69322f2cac 100644 --- a/tests/Get-DbaDbEncryption.Tests.ps1 +++ b/tests/Get-DbaDbEncryption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbEncryption).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','IncludeSystemDBs','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeSystemDBs', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -37,4 +37,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { ($results.Name -match 'dbatoolsci').Count -gt 0 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbExtentDiff.Tests.ps1 b/tests/Get-DbaDbExtentDiff.Tests.ps1 index 8682a4f78e..d9cc345c5e 100644 --- a/tests/Get-DbaDbExtentDiff.Tests.ps1 +++ b/tests/Get-DbaDbExtentDiff.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbExtentDiff).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbFeatureUsage.Tests.ps1 b/tests/Get-DbaDbFeatureUsage.Tests.ps1 index d3c8fa03de..345b8d752e 100644 --- a/tests/Get-DbaDbFeatureUsage.Tests.ps1 +++ b/tests/Get-DbaDbFeatureUsage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbFeatureUsage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbFile.Tests.ps1 b/tests/Get-DbaDbFile.Tests.ps1 index 1009d54e56..176ffe6068 100644 --- a/tests/Get-DbaDbFile.Tests.ps1 +++ b/tests/Get-DbaDbFile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbFile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -52,4 +52,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $result.PhysicalName -match 'mastlog.ldf' | Should -Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbForeignKey.Tests.ps1 b/tests/Get-DbaDbForeignKey.Tests.ps1 index ae0c441f08..25f8f5c12d 100644 --- a/tests/Get-DbaDbForeignKey.Tests.ps1 +++ b/tests/Get-DbaDbForeignKey.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbForeignKey).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ExcludeSystemTable','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ExcludeSystemTable', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -53,4 +53,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { ($results | Where-Object Name -eq 'spt_fallback_db') | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbLogShipError.Tests.ps1 b/tests/Get-DbaDbLogShipError.Tests.ps1 index b40cd8d885..50c7e2cbfe 100644 --- a/tests/Get-DbaDbLogShipError.Tests.ps1 +++ b/tests/Get-DbaDbLogShipError.Tests.ps1 @@ -21,4 +21,4 @@ Describe "$CommandName Unittests" -Tag 'UnitTests' { $Results.Count | Should Be 0 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbMail.Tests.ps1 b/tests/Get-DbaDbMail.Tests.ps1 index 364adec2ce..af1a8dffe1 100644 --- a/tests/Get-DbaDbMail.Tests.ps1 +++ b/tests/Get-DbaDbMail.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMail).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMailAccount.Tests.ps1 b/tests/Get-DbaDbMailAccount.Tests.ps1 index f730c0cd17..6adca83829 100644 --- a/tests/Get-DbaDbMailAccount.Tests.ps1 +++ b/tests/Get-DbaDbMailAccount.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMailAccount).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Account','ExcludeAccount','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Account', 'ExcludeAccount', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMailConfig.Tests.ps1 b/tests/Get-DbaDbMailConfig.Tests.ps1 index d3c88e5c33..fd9933c5fe 100644 --- a/tests/Get-DbaDbMailConfig.Tests.ps1 +++ b/tests/Get-DbaDbMailConfig.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMailConfig).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Name','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMailHistory.Tests.ps1 b/tests/Get-DbaDbMailHistory.Tests.ps1 index f9cb776632..541d6c2b07 100644 --- a/tests/Get-DbaDbMailHistory.Tests.ps1 +++ b/tests/Get-DbaDbMailHistory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMailHistory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Since','Status','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Since', 'Status', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMailLog.Tests.ps1 b/tests/Get-DbaDbMailLog.Tests.ps1 index e84946595f..4f6b4f6884 100644 --- a/tests/Get-DbaDbMailLog.Tests.ps1 +++ b/tests/Get-DbaDbMailLog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMailLog).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Since','Type','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Since', 'Type', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMailProfile.Tests.ps1 b/tests/Get-DbaDbMailProfile.Tests.ps1 index 1172edf26c..2cd1b1342b 100644 --- a/tests/Get-DbaDbMailProfile.Tests.ps1 +++ b/tests/Get-DbaDbMailProfile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMailProfile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Profile','ExcludeProfile','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Profile', 'ExcludeProfile', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMailServer.Tests.ps1 b/tests/Get-DbaDbMailServer.Tests.ps1 index a86354bde5..d5a414e65b 100644 --- a/tests/Get-DbaDbMailServer.Tests.ps1 +++ b/tests/Get-DbaDbMailServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMailServer).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Server','Account','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Server', 'Account', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMasterKey.Tests.ps1 b/tests/Get-DbaDbMasterKey.Tests.ps1 index 2a24dd9fe8..01c38d2283 100644 --- a/tests/Get-DbaDbMasterKey.Tests.ps1 +++ b/tests/Get-DbaDbMasterKey.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMemoryUsage.Tests.ps1 b/tests/Get-DbaDbMemoryUsage.Tests.ps1 index 7349d19af6..38008fc0aa 100644 --- a/tests/Get-DbaDbMemoryUsage.Tests.ps1 +++ b/tests/Get-DbaDbMemoryUsage.Tests.ps1 @@ -45,4 +45,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $uniqueDbs | Should -Contain 'master' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbMirror.Tests.ps1 b/tests/Get-DbaDbMirror.Tests.ps1 index 8a34ca7187..e6ee1f99f3 100644 --- a/tests/Get-DbaDbMirror.Tests.ps1 +++ b/tests/Get-DbaDbMirror.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMirror).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbMirrorMonitor.Tests.ps1 b/tests/Get-DbaDbMirrorMonitor.Tests.ps1 index 27adfff79b..4e15f418ff 100644 --- a/tests/Get-DbaDbMirrorMonitor.Tests.ps1 +++ b/tests/Get-DbaDbMirrorMonitor.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbMirrorMonitor).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','Update','LimitResults','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'Update', 'LimitResults', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbPageInfo.Tests.ps1 b/tests/Get-DbaDbPageInfo.Tests.ps1 index 064c313425..531a477ba4 100644 --- a/tests/Get-DbaDbPageInfo.Tests.ps1 +++ b/tests/Get-DbaDbPageInfo.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbPageInfo).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Schema','Table','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Schema', 'Table', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -50,4 +50,4 @@ Describe "$CommandName Integration Test" -Tag "IntegrationTests" { ($result | Where-Object { $_.IsAllocated -eq $true }).Count | Should -Be 4 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbPartitionFunction.Tests.ps1 b/tests/Get-DbaDbPartitionFunction.Tests.ps1 index 82ed6414c2..25e884a74b 100644 --- a/tests/Get-DbaDbPartitionFunction.Tests.ps1 +++ b/tests/Get-DbaDbPartitionFunction.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbPartitionFunction).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -18,13 +18,13 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { - BeforeAll{ + BeforeAll { $tempguid = [guid]::newguid(); $PFName = "dbatoolssci_$($tempguid.guid)" $CreateTestPartitionFunction = "CREATE PARTITION FUNCTION [$PFName] (int) AS RANGE LEFT FOR VALUES (1, 100, 1000, 10000, 100000);" Invoke-DbaQuery -SqlInstance $script:instance2 -Query $CreateTestPartitionFunction -Database master } - AfterAll{ + AfterAll { $DropTestPartitionFunction = "DROP PARTITION FUNCTION [$PFName];" Invoke-DbaQuery -SqlInstance $script:instance2 -Query $DropTestPartitionFunction -Database master } @@ -33,11 +33,11 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results1 = Get-DbaDbPartitionFunction -SqlInstance $script:instance2 -Database master | Select-Object * $results2 = Get-DbaDbPartitionFunction -SqlInstance $script:instance2 - It "Should execute and return results"{ + It "Should execute and return results" { $results2 | Should -Not -Be $null } - It "Should execute against Master and return results"{ + It "Should execute against Master and return results" { $results1 | Should -Not -Be $null } @@ -57,4 +57,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { {Get-DbaDbPartitionFunction -SqlInstance $script:instance2 -ExcludeDatabase master } | Should -not -Throw } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbPartitionScheme.Tests.ps1 b/tests/Get-DbaDbPartitionScheme.Tests.ps1 index 710ce59ed5..13a8ddf9fc 100644 --- a/tests/Get-DbaDbPartitionScheme.Tests.ps1 +++ b/tests/Get-DbaDbPartitionScheme.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbPartitionScheme).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -18,10 +18,10 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { - BeforeAll{ + BeforeAll { $tempguid = [guid]::newguid(); $PFName = "dbatoolssci_$($tempguid.guid)" - $PFScheme = "dbatoolssci_PFScheme" + $PFScheme = "dbatoolssci_PFScheme" $CreateTestPartitionScheme = @" CREATE PARTITION FUNCTION [$PFName] (int) AS RANGE LEFT FOR VALUES (1, 100, 1000, 10000, 100000); @@ -31,7 +31,7 @@ CREATE PARTITION SCHEME $PFScheme AS PARTITION [$PFName] ALL TO ( [PRIMARY] ); Invoke-DbaQuery -SqlInstance $script:instance2 -Query $CreateTestPartitionScheme -Database master } - AfterAll{ + AfterAll { $DropTestPartitionScheme = @" DROP PARTITION SCHEME [$PFScheme]; GO @@ -44,11 +44,11 @@ DROP PARTITION FUNCTION [$PFName]; $results1 = Get-DbaDbPartitionScheme -SqlInstance $script:instance2 -Database master | Select-Object * $results2 = Get-DbaDbPartitionScheme -SqlInstance $script:instance2 - It "Should execute and return results"{ + It "Should execute and return results" { $results2 | Should -Not -Be $null } - It "Should execute against Master and return results"{ + It "Should execute against Master and return results" { $results1 | Should -Not -Be $null } diff --git a/tests/Get-DbaDbQueryStoreOption.Tests.ps1 b/tests/Get-DbaDbQueryStoreOption.Tests.ps1 index 2291d0070c..5fd3dacf9b 100644 --- a/tests/Get-DbaDbQueryStoreOption.Tests.ps1 +++ b/tests/Get-DbaDbQueryStoreOption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbQueryStoreOption).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbRecoveryModel.Tests.ps1 b/tests/Get-DbaDbRecoveryModel.Tests.ps1 index c5fc1acd52..b41a62f756 100644 --- a/tests/Get-DbaDbRecoveryModel.Tests.ps1 +++ b/tests/Get-DbaDbRecoveryModel.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbRecoveryModel).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','RecoveryModel','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'RecoveryModel', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -55,4 +55,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name -contains $dbname | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbRestoreHistory.Tests.ps1 b/tests/Get-DbaDbRestoreHistory.Tests.ps1 index ef1e982dd5..6e41bd7410 100644 --- a/tests/Get-DbaDbRestoreHistory.Tests.ps1 +++ b/tests/Get-DbaDbRestoreHistory.Tests.ps1 @@ -86,4 +86,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { ($result.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedPropsDefault | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbRoleMember.Tests.ps1 b/tests/Get-DbaDbRoleMember.Tests.ps1 index 26766fde5e..31adbac8a4 100644 --- a/tests/Get-DbaDbRoleMember.Tests.ps1 +++ b/tests/Get-DbaDbRoleMember.Tests.ps1 @@ -78,4 +78,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $result.Role | Select-Object -Unique | Should -Not -Contain 'db_owner' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbSharePoint.Tests.ps1 b/tests/Get-DbaDbSharePoint.Tests.ps1 index d7440ee94f..9542985096 100644 --- a/tests/Get-DbaDbSharePoint.Tests.ps1 +++ b/tests/Get-DbaDbSharePoint.Tests.ps1 @@ -42,4 +42,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbSnapshot.Tests.ps1 b/tests/Get-DbaDbSnapshot.Tests.ps1 index badc5efb82..bef24a7ae6 100644 --- a/tests/Get-DbaDbSnapshot.Tests.ps1 +++ b/tests/Get-DbaDbSnapshot.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbSnapshot).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Snapshot','ExcludeSnapshot','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Snapshot', 'ExcludeSnapshot', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -71,4 +71,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { ($result.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedPropsDefault | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbSpace.Tests.ps1 b/tests/Get-DbaDbSpace.Tests.ps1 index d7a75b8eb4..cb30f83bb1 100644 --- a/tests/Get-DbaDbSpace.Tests.ps1 +++ b/tests/Get-DbaDbSpace.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbSpace).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','IncludeSystemDBs','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeSystemDBs', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbState.Tests.ps1 b/tests/Get-DbaDbState.Tests.ps1 index 2d4fad43a9..584b29114a 100644 --- a/tests/Get-DbaDbState.Tests.ps1 +++ b/tests/Get-DbaDbState.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbState).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -123,4 +123,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbStoredProcedure.Tests.ps1 b/tests/Get-DbaDbStoredProcedure.Tests.ps1 index 1ef8f86170..9fe41c4f78 100644 --- a/tests/Get-DbaDbStoredProcedure.Tests.ps1 +++ b/tests/Get-DbaDbStoredProcedure.Tests.ps1 @@ -58,4 +58,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results | Where-Object Name -eq 'sp_helpdb') | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbTable.Tests.ps1 b/tests/Get-DbaDbTable.Tests.ps1 index d88234fade..4de7fa8b7f 100644 --- a/tests/Get-DbaDbTable.Tests.ps1 +++ b/tests/Get-DbaDbTable.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbTable).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','IncludeSystemDBs','Table','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeSystemDBs', 'Table', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbTrigger.Tests.ps1 b/tests/Get-DbaDbTrigger.Tests.ps1 index 566898641c..1111d9712c 100644 --- a/tests/Get-DbaDbTrigger.Tests.ps1 +++ b/tests/Get-DbaDbTrigger.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbTrigger).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDbUdf.Tests.ps1 b/tests/Get-DbaDbUdf.Tests.ps1 index 6ee502f958..57d3b00f64 100644 --- a/tests/Get-DbaDbUdf.Tests.ps1 +++ b/tests/Get-DbaDbUdf.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbUdf).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ExcludeSystemUdf','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ExcludeSystemUdf', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -18,10 +18,10 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { - BeforeAll{ -#Test Function adapted from examples at: -#https://docs.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-2017#examples -$CreateTestUDFunction = @" + BeforeAll { + #Test Function adapted from examples at: + #https://docs.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-2017#examples + $CreateTestUDFunction = @" CREATE FUNCTION dbo.dbatoolssci_ISOweek (@DATE datetime) RETURNS int WITH EXECUTE AS CALLER @@ -43,7 +43,7 @@ END; "@ Invoke-DbaQuery -SqlInstance $script:instance2 -Query $CreateTestUDFunction -Database master } - AfterAll{ + AfterAll { $DropTestUDFunction = "DROP FUNCTION dbo.dbatoolssci_ISOweek;" Invoke-DbaQuery -SqlInstance $script:instance2 -Query $DropTestUDFunction -Database master } @@ -52,11 +52,11 @@ END; $results1 = Get-DbaDbUdf -SqlInstance $script:instance2 -Database master | Where-object {$_.name -eq 'dbatoolssci_ISOweek'} | Select-Object * $results2 = Get-DbaDbUdf -SqlInstance $script:instance2 - It "Should execute and return results"{ + It "Should execute and return results" { $results2 | Should -Not -Be $null } - It "Should execute against Master and return results"{ + It "Should execute against Master and return results" { $results1 | Should -Not -Be $null } @@ -77,4 +77,4 @@ END; {Get-DbaDbUdf -SqlInstance $script:instance2 -ExcludeDatabase master -ExcludeSystemUdf } | Should -not -Throw } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbUser.Tests.ps1 b/tests/Get-DbaDbUser.Tests.ps1 index fff17700b1..b9d04c5664 100644 --- a/tests/Get-DbaDbUser.Tests.ps1 +++ b/tests/Get-DbaDbUser.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbUser).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ExcludeSystemUser','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ExcludeSystemUser', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -18,10 +18,10 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { - BeforeAll{ + BeforeAll { $tempguid = [guid]::newguid(); $DBUserName = "dbatoolssci_$($tempguid.guid)" -$CreateTestUser = @" + $CreateTestUser = @" CREATE LOGIN [$DBUserName] WITH PASSWORD = '$($tempguid.guid)'; USE Master; @@ -30,7 +30,7 @@ CREATE USER [$DBUserName] FOR LOGIN [$DBUserName] "@ Invoke-DbaQuery -SqlInstance $script:instance2 -Query $CreateTestUser -Database master } - AfterAll{ + AfterAll { $DropTestUser = "DROP User [$DBUserName];" Invoke-DbaQuery -SqlInstance $script:instance2 -Query $DropTestUser -Database master } @@ -39,11 +39,11 @@ CREATE USER [$DBUserName] FOR LOGIN [$DBUserName] $results1 = Get-DbaDbUser -SqlInstance $script:instance2 -Database master | Where-object {$_.name -eq "$DBUserName"} | Select-Object * $results2 = Get-DbaDbUser -SqlInstance $script:instance2 - It "Should execute and return results"{ + It "Should execute and return results" { $results2 | Should -Not -Be $null } - It "Should execute against Master and return results"{ + It "Should execute against Master and return results" { $results1 | Should -Not -Be $null } @@ -68,4 +68,4 @@ CREATE USER [$DBUserName] FOR LOGIN [$DBUserName] {Get-DbaDbUser -SqlInstance $script:instance2 -ExcludeDatabase master -ExcludeSystemUser } | Should -not -Throw } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDbView.Tests.ps1 b/tests/Get-DbaDbView.Tests.ps1 index b51fdba491..50e764fdf4 100644 --- a/tests/Get-DbaDbView.Tests.ps1 +++ b/tests/Get-DbaDbView.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDbView).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ExcludeSystemView','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ExcludeSystemView', 'EnableException' it "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -45,8 +45,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } It "Should exclude system views" { $results = Get-DbaDbView -SqlInstance $script:instance2 -ExcludeSystemView | Select-Object Name, IsSystemObject - $results.IsSystemObject | Should Not Contain $true + $results.IsSystemObject | Should Not Contain $true } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaDbVirtualLogFile.Tests.ps1 b/tests/Get-DbaDbVirtualLogFile.Tests.ps1 index 10e73cc254..10245db746 100644 --- a/tests/Get-DbaDbVirtualLogFile.Tests.ps1 +++ b/tests/Get-DbaDbVirtualLogFile.Tests.ps1 @@ -60,5 +60,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaDefaultPath.Tests.ps1 b/tests/Get-DbaDefaultPath.Tests.ps1 index e43e4e5483..9eab937ed0 100644 --- a/tests/Get-DbaDefaultPath.Tests.ps1 +++ b/tests/Get-DbaDefaultPath.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDefaultPath).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -33,4 +33,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.ErrorLog -match "\:\\" } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDependency.Tests.ps1 b/tests/Get-DbaDependency.Tests.ps1 index d750e4d2e6..a342d08a5c 100644 --- a/tests/Get-DbaDependency.Tests.ps1 +++ b/tests/Get-DbaDependency.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDependency).Parameters.Keys - $knownParameters = 'InputObject','AllowSystemObjects','Parents','IncludeSelf','EnableException' + $knownParameters = 'InputObject', 'AllowSystemObjects', 'Parents', 'IncludeSelf', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDeprecatedFeature.Tests.ps1 b/tests/Get-DbaDeprecatedFeature.Tests.ps1 index 3f92285ecb..129be66960 100644 --- a/tests/Get-DbaDeprecatedFeature.Tests.ps1 +++ b/tests/Get-DbaDeprecatedFeature.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDeprecatedFeature).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDetachedDatabaseInfo.Tests.ps1 b/tests/Get-DbaDetachedDatabaseInfo.Tests.ps1 index db9d2f4de9..4c62c4cd50 100644 --- a/tests/Get-DbaDetachedDatabaseInfo.Tests.ps1 +++ b/tests/Get-DbaDetachedDatabaseInfo.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDetachedDatabaseInfo).Parameters.Keys - $knownParameters = 'SqlInstance','Path','SqlCredential' + $knownParameters = 'SqlInstance', 'Path', 'SqlCredential' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaDiskSpace.Tests.ps1 b/tests/Get-DbaDiskSpace.Tests.ps1 index 8b0fe49baf..c765c53285 100644 --- a/tests/Get-DbaDiskSpace.Tests.ps1 +++ b/tests/Get-DbaDiskSpace.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDiskSpace).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Unit','CheckForSql','SqlCredential','ExcludeDrive','CheckFragmentation','Force','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Unit', 'CheckForSql', 'SqlCredential', 'ExcludeDrive', 'CheckFragmentation', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -50,23 +50,23 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { return @( @{ ComputerName = 'MadeUpServer' - ServiceName = 'MSSQLSERVER' - ServiceType = 'Engine' + ServiceName = 'MSSQLSERVER' + ServiceType = 'Engine' InstanceName = 'MSSQLSERVER' - DisplayName = 'SQL Server (MSSQLSERVER)' - StartName = 'FAKEDOMAIN\FAKEUSER' - State = 'Running' - StartMode = 'Automatic' + DisplayName = 'SQL Server (MSSQLSERVER)' + StartName = 'FAKEDOMAIN\FAKEUSER' + State = 'Running' + StartMode = 'Automatic' }, @{ ComputerName = 'MadeUpServer' - ServiceName = 'MSSQLSERVER$MADEUPINSTANCE' - ServiceType = 'Engine' + ServiceName = 'MSSQLSERVER$MADEUPINSTANCE' + ServiceType = 'Engine' InstanceName = 'MadeUpInstance' - DisplayName = 'SQL Server (MSSQLSERVER)' - StartName = 'FAKEDOMAIN\FAKEUSER' - State = 'Running' - StartMode = 'Automatic' + DisplayName = 'SQL Server (MSSQLSERVER)' + StartName = 'FAKEDOMAIN\FAKEUSER' + State = 'Running' + StartMode = 'Automatic' } ) } @@ -74,23 +74,23 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Mock -ModuleName 'dbatools' -CommandName 'Get-DbaCmObject' -ParameterFilter { $ComputerName::InputObject -eq 'MadeUpServer' -and $Query -like '*Win32_Volume*' } -MockWith { return @( @{ - Name = 'D:\Data\' - Label = 'Log' - Capacity = 32209043456 - Freespace = 11653545984 - BlockSize = 65536 - FileSystem = 'NTFS' - DriveType = 3 + Name = 'D:\Data\' + Label = 'Log' + Capacity = 32209043456 + Freespace = 11653545984 + BlockSize = 65536 + FileSystem = 'NTFS' + DriveType = 3 DriveLetter = '' }, @{ - Name = 'C:\' - Label = 'OS' - Capacity = 32209043456 - Freespace = 11653545984 - BlockSize = 4096 - FileSystem = 'NTFS' - DriveType = 2 + Name = 'C:\' + Label = 'OS' + Capacity = 32209043456 + Freespace = 11653545984 + BlockSize = 4096 + FileSystem = 'NTFS' + DriveType = 2 DriveLetter = 'C:' } ) @@ -110,33 +110,33 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Mock -ModuleName 'dbatools' -CommandName 'Get-DbaCmObject' -ParameterFilter { $Query -like '*Win32_Volume*' } -MockWith { return @( @{ - Name = 'D:\Data\' - Label = 'Log' - Capacity = 32209043456 - Freespace = 11653545984 - BlockSize = 65536 - FileSystem = 'NTFS' - DriveType = 3 + Name = 'D:\Data\' + Label = 'Log' + Capacity = 32209043456 + Freespace = 11653545984 + BlockSize = 65536 + FileSystem = 'NTFS' + DriveType = 3 DriveLetter = '' }, @{ - Name = 'C:\' - Label = 'OS' - Capacity = 32209043456 - Freespace = 11653545984 - BlockSize = 4096 - FileSystem = 'NTFS' - DriveType = 2 + Name = 'C:\' + Label = 'OS' + Capacity = 32209043456 + Freespace = 11653545984 + BlockSize = 4096 + FileSystem = 'NTFS' + DriveType = 2 DriveLetter = 'C:' }, @{ - Name = 'T:\' - Label = 'Data' - Capacity = 32209043456 - Freespace = 11653545984 - BlockSize = 4096 - FileSystem = 'NTFS' - DriveType = 2 + Name = 'T:\' + Label = 'Data' + Capacity = 32209043456 + Freespace = 11653545984 + BlockSize = 4096 + FileSystem = 'NTFS' + DriveType = 2 DriveLetter = 'T:' } ) @@ -147,4 +147,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $false | Should BeIn $results.IsSqlDisk } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaDump.Tests.ps1 b/tests/Get-DbaDump.Tests.ps1 index 6e991d4d06..156afd8e3d 100644 --- a/tests/Get-DbaDump.Tests.ps1 +++ b/tests/Get-DbaDump.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaDump).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,4 +32,4 @@ if (-not $env:appveyor) { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaEndpoint.Tests.ps1 b/tests/Get-DbaEndpoint.Tests.ps1 index 6f512f4492..ec860fc852 100644 --- a/tests/Get-DbaEndpoint.Tests.ps1 +++ b/tests/Get-DbaEndpoint.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaEndpoint).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Endpoint','EnableException', 'Type' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Endpoint', 'EnableException', 'Type' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -28,4 +28,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Name | Should -Be 'TSQL Default TCP' $results.Count | Should -Be 1 } -} +} \ No newline at end of file diff --git a/tests/Get-DbaErrorLog.Tests.ps1 b/tests/Get-DbaErrorLog.Tests.ps1 index e4f1845220..136e064690 100644 --- a/tests/Get-DbaErrorLog.Tests.ps1 +++ b/tests/Get-DbaErrorLog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaErrorLog).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','LogNumber','Source','Text','After','Before','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'LogNumber', 'Source', 'Text', 'After', 'Before', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -38,8 +38,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $sqlCred = New-Object System.Management.Automation.PSCredential($login, $pwd) try { Connect-DbaInstance -SqlInstance $script:instance1 -Credential $sqlCred -ErrorVariable $whatever - } - catch {} + } catch {} } It "Has the correct default properties" { $expectedProps = 'ComputerName,InstanceName,SqlInstance,LogDate,Source,Text'.Split(',') @@ -84,4 +83,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { {$results[-1].LogDate -le $beforeFilter} | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaErrorLogConfig.Tests.ps1 b/tests/Get-DbaErrorLogConfig.Tests.ps1 index 82e6e7473f..361086ec1e 100644 --- a/tests/Get-DbaErrorLogConfig.Tests.ps1 +++ b/tests/Get-DbaErrorLogConfig.Tests.ps1 @@ -28,4 +28,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaEstimatedCompletionTime.Tests.ps1 b/tests/Get-DbaEstimatedCompletionTime.Tests.ps1 index db57b18acb..4b4a8d3784 100644 --- a/tests/Get-DbaEstimatedCompletionTime.Tests.ps1 +++ b/tests/Get-DbaEstimatedCompletionTime.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaEstimatedCompletionTime).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaExecutionPlan.Tests.ps1 b/tests/Get-DbaExecutionPlan.Tests.ps1 index ae93533548..60e9714d5c 100644 --- a/tests/Get-DbaExecutionPlan.Tests.ps1 +++ b/tests/Get-DbaExecutionPlan.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaExecutionPlan).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','SinceCreation','SinceLastExecution','ExcludeEmptyQueryPlan','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'SinceCreation', 'SinceLastExecution', 'ExcludeEmptyQueryPlan', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaFeature.Tests.ps1 b/tests/Get-DbaFeature.Tests.ps1 index 789e2730a1..b02cc68ce3 100644 --- a/tests/Get-DbaFeature.Tests.ps1 +++ b/tests/Get-DbaFeature.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaFeature).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.ComputerName | Should Be $env:COMPUTERNAME } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaFile.Tests.ps1 b/tests/Get-DbaFile.Tests.ps1 index 74e23142f2..447b1b9e1a 100644 --- a/tests/Get-DbaFile.Tests.ps1 +++ b/tests/Get-DbaFile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaFile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','FileType','Depth','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'FileType', 'Depth', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -45,4 +45,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Filename -match 'master.mdf' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaFilestream.Tests.ps1 b/tests/Get-DbaFilestream.Tests.ps1 index c44b801d1d..008e9ad467 100644 --- a/tests/Get-DbaFilestream.Tests.ps1 +++ b/tests/Get-DbaFilestream.Tests.ps1 @@ -37,4 +37,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.InstanceAccess | Should -BeIn 'Disabled', 'T-SQL access enabled', 'Full access enabled' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaForceNetworkEncryption.Tests.ps1 b/tests/Get-DbaForceNetworkEncryption.Tests.ps1 index 5dcd428c02..a7ca310188 100644 --- a/tests/Get-DbaForceNetworkEncryption.Tests.ps1 +++ b/tests/Get-DbaForceNetworkEncryption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaForceNetworkEncryption).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ if (-not $env:appveyor) { $results.ForceEncryption -ne $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaHelpIndex.Tests.ps1 b/tests/Get-DbaHelpIndex.Tests.ps1 index 19bc318424..3444e95e8f 100644 --- a/tests/Get-DbaHelpIndex.Tests.ps1 +++ b/tests/Get-DbaHelpIndex.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 11 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\$CommandName).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'InputObject', 'ObjectName', 'IncludeStats','IncludeDataTypes','Raw','IncludeFragmentation','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'InputObject', 'ObjectName', 'IncludeStats', 'IncludeDataTypes', 'Raw', 'IncludeFragmentation', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -22,8 +22,8 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $random = Get-Random $dbname = "dbatoolsci_$random" $server.Query("CREATE DATABASE $dbname") - $server.Query("Create Table Test (col1 varchar(50) PRIMARY KEY, col2 int)",$dbname) - $server.Query("Insert into test values ('value1',1),('value2',2)",$dbname) + $server.Query("Create Table Test (col1 varchar(50) PRIMARY KEY, col2 int)", $dbname) + $server.Query("Insert into test values ('value1',1),('value2',2)", $dbname) $server.Query("create statistics dbatools_stats on test (col2)", $dbname) $server.Query("select * from test", $dbname) } @@ -88,4 +88,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.IndexFragInPercent | Should BeOfType 'Double' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaInstanceProperty.Tests.ps1 b/tests/Get-DbaInstanceProperty.Tests.ps1 index 6c5386435f..a997d68382 100644 --- a/tests/Get-DbaInstanceProperty.Tests.ps1 +++ b/tests/Get-DbaInstanceProperty.Tests.ps1 @@ -50,4 +50,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $(Get-DbaInstanceProperty -SqlInstance $script:instance1, $script:instance2 | Select-Object -unique SqlInstance).count | Should Be 2 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaInstanceUserOption.Tests.ps1 b/tests/Get-DbaInstanceUserOption.Tests.ps1 index 388fb6a341..a681f3452b 100644 --- a/tests/Get-DbaInstanceUserOption.Tests.ps1 +++ b/tests/Get-DbaInstanceUserOption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaInstanceUserOption).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaIoLatency.Tests.ps1 b/tests/Get-DbaIoLatency.Tests.ps1 index 28643347f8..da24067eb1 100644 --- a/tests/Get-DbaIoLatency.Tests.ps1 +++ b/tests/Get-DbaIoLatency.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $SupportShouldProcess = $false if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -34,4 +33,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Count -gt 0 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaLastBackup.Tests.ps1 b/tests/Get-DbaLastBackup.Tests.ps1 index 9841613521..6b0d1fc505 100644 --- a/tests/Get-DbaLastBackup.Tests.ps1 +++ b/tests/Get-DbaLastBackup.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaLastBackup).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -72,4 +72,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.LastFullBackup.GetType().Name | Should be "DbaDateTime" } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaLastGoodCheckDb.Tests.ps1 b/tests/Get-DbaLastGoodCheckDb.Tests.ps1 index a41c63926f..6bb7bd8ddb 100644 --- a/tests/Get-DbaLastGoodCheckDb.Tests.ps1 +++ b/tests/Get-DbaLastGoodCheckDb.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaLastGoodCheckDb).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -33,4 +33,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "returns more than 3 results" { ($results).Count -gt 3 } -} +} \ No newline at end of file diff --git a/tests/Get-DbaLatchStatistic.Tests.ps1 b/tests/Get-DbaLatchStatistic.Tests.ps1 index abb4dd1129..8f9f8bae3b 100644 --- a/tests/Get-DbaLatchStatistic.Tests.ps1 +++ b/tests/Get-DbaLatchStatistic.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $SupportShouldProcess = $false if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -40,4 +39,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaLinkedServer.Tests.ps1 b/tests/Get-DbaLinkedServer.Tests.ps1 index 3ecafdeb50..08737dfbe7 100644 --- a/tests/Get-DbaLinkedServer.Tests.ps1 +++ b/tests/Get-DbaLinkedServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaLinkedServer).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','LinkedServer','ExcludeLinkedServer','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'LinkedServer', 'ExcludeLinkedServer', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaLocaleSetting.Tests.ps1 b/tests/Get-DbaLocaleSetting.Tests.ps1 index f48c3df535..6c1593f7dc 100644 --- a/tests/Get-DbaLocaleSetting.Tests.ps1 +++ b/tests/Get-DbaLocaleSetting.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaLocaleSetting).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaLogin.Tests.ps1 b/tests/Get-DbaLogin.Tests.ps1 index 6017ca44aa..0d02dcd037 100644 --- a/tests/Get-DbaLogin.Tests.ps1 +++ b/tests/Get-DbaLogin.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaLogin).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Login','IncludeFilter','ExcludeLogin','ExcludeFilter','NoSystem','SQLLogins','WindowsLogins','HasAccess','Locked','Disabled','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'IncludeFilter', 'ExcludeLogin', 'ExcludeFilter', 'NoSystem', 'SQLLogins', 'WindowsLogins', 'HasAccess', 'Locked', 'Disabled', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -82,4 +82,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.IsDisabled | Should Be "False" } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaMaintenanceSolutionLog.Tests.ps1 b/tests/Get-DbaMaintenanceSolutionLog.Tests.ps1 index 38a4b051ab..2708ab155b 100644 --- a/tests/Get-DbaMaintenanceSolutionLog.Tests.ps1 +++ b/tests/Get-DbaMaintenanceSolutionLog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaMaintenanceSolutionLog).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','LogType','Since','Path','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'LogType', 'Since', 'Path', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaManagementObject.Tests.ps1 b/tests/Get-DbaManagementObject.Tests.ps1 index 2f3718ed62..6333452dd5 100644 --- a/tests/Get-DbaManagementObject.Tests.ps1 +++ b/tests/Get-DbaManagementObject.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaManagementObject).Parameters.Keys - $knownParameters = 'ComputerName','Credential','VersionNumber','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'VersionNumber', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -42,5 +42,4 @@ Describe "Get-DbaManagementObject Integration Test" -Tag "IntegrationTests" { $result = Get-DbaManagementObject -ComputerName 'Melton5312' -WarningAction SilentlyContinue $result | Should Be $null } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaMaxMemory.Tests.ps1 b/tests/Get-DbaMaxMemory.Tests.ps1 index d5c20fcc14..3ebde64f97 100644 --- a/tests/Get-DbaMaxMemory.Tests.ps1 +++ b/tests/Get-DbaMaxMemory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaMaxMemory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } diff --git a/tests/Get-DbaMemoryUsage.Tests.ps1 b/tests/Get-DbaMemoryUsage.Tests.ps1 index c4c9f788bc..ac2be511e5 100644 --- a/tests/Get-DbaMemoryUsage.Tests.ps1 +++ b/tests/Get-DbaMemoryUsage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaMemoryUsage).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Simple','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Simple', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } diff --git a/tests/Get-DbaModule.Tests.ps1 b/tests/Get-DbaModule.Tests.ps1 index 06ee65c532..fe686ed77a 100644 --- a/tests/Get-DbaModule.Tests.ps1 +++ b/tests/Get-DbaModule.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaModule).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','ModifiedSince','Type','NoSystemDb','NoSystemObjects','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'ModifiedSince', 'Type', 'NoSystemDb', 'NoSystemObjects', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,4 +36,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results | Select -Unique Type | Measure-Object).Count | Should Be 1 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaMsdtc.Tests.ps1 b/tests/Get-DbaMsdtc.Tests.ps1 index 62e906686b..227d6fef73 100644 --- a/tests/Get-DbaMsdtc.Tests.ps1 +++ b/tests/Get-DbaMsdtc.Tests.ps1 @@ -29,4 +29,4 @@ Describe "Get-DbaMsdtc Integration Test" -Tag "IntegrationTests" { $results.DTCServiceName | Should Not Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaNetworkActivity.Tests.ps1 b/tests/Get-DbaNetworkActivity.Tests.ps1 index 0857d309cf..f33bd0ba8b 100644 --- a/tests/Get-DbaNetworkActivity.Tests.ps1 +++ b/tests/Get-DbaNetworkActivity.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaNetworkActivity).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaNetworkCertificate.Tests.ps1 b/tests/Get-DbaNetworkCertificate.Tests.ps1 index e00765d587..f45790231f 100644 --- a/tests/Get-DbaNetworkCertificate.Tests.ps1 +++ b/tests/Get-DbaNetworkCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaNetworkCertificate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaOpenTransaction.Tests.ps1 b/tests/Get-DbaOpenTransaction.Tests.ps1 index 954b1beb7d..2ac103204b 100644 --- a/tests/Get-DbaOpenTransaction.Tests.ps1 +++ b/tests/Get-DbaOpenTransaction.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaOpenTransaction).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -21,4 +21,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { It "doesn't throw" { { Get-DbaOpenTransaction -SqlInstance $script:instance1 } | Should Not Throw } -} +} \ No newline at end of file diff --git a/tests/Get-DbaOperatingSystem.Tests.ps1 b/tests/Get-DbaOperatingSystem.Tests.ps1 index 2550207fd6..aa3e513b5b 100644 --- a/tests/Get-DbaOperatingSystem.Tests.ps1 +++ b/tests/Get-DbaOperatingSystem.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $SupportShouldProcess = $false if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -36,10 +35,10 @@ Describe "Get-DbaOperatingSystem Integration Test" -Tag "IntegrationTests" { $props = 'ComputerName', 'Manufacturer', 'Organization', 'Architecture', 'Build', 'Version', 'InstallDate', 'LastBootTime', 'LocalDateTime', 'BootDevice', 'TimeZone', 'TimeZoneDaylight', 'TimeZoneStandard', 'TotalVisibleMemory', - 'OSVersion', 'SPVersion', 'PowerShellVersion', 'SystemDevice', 'SystemDrive','WindowsDirectory', - 'PagingFileSize','FreePhysicalMemory','TotalVirtualMemory','FreeVirtualMemory','ActivePowerPlan', - 'Status','Language','LanguageId','LanguageKeyboardLayoutId','LanguageTwoLetter','LanguageThreeLetter' - 'LanguageAlias','LanguageNative','CodeSet','CountryCode','Locale','IsWsfc' + 'OSVersion', 'SPVersion', 'PowerShellVersion', 'SystemDevice', 'SystemDrive', 'WindowsDirectory', + 'PagingFileSize', 'FreePhysicalMemory', 'TotalVirtualMemory', 'FreeVirtualMemory', 'ActivePowerPlan', + 'Status', 'Language', 'LanguageId', 'LanguageKeyboardLayoutId', 'LanguageTwoLetter', 'LanguageThreeLetter' + 'LanguageAlias', 'LanguageNative', 'CodeSet', 'CountryCode', 'Locale', 'IsWsfc' <# FreePhysicalMemory: units = KB @@ -47,7 +46,7 @@ Describe "Get-DbaOperatingSystem Integration Test" -Tag "IntegrationTests" { TimeZoneStandard: StandardName from win32_timezone TimeZoneDaylight: DaylightName from win32_timezone TimeZone: Caption from win32_timezone - #> + #> Context "Validate standard output" { foreach ($prop in $props) { $p = $result.PSObject.Properties[$prop] @@ -61,5 +60,4 @@ Describe "Get-DbaOperatingSystem Integration Test" -Tag "IntegrationTests" { $result | Should Be $null } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaOrphanUser.Tests.ps1 b/tests/Get-DbaOrphanUser.Tests.ps1 index dfe004ec25..8da6902d8e 100644 --- a/tests/Get-DbaOrphanUser.Tests.ps1 +++ b/tests/Get-DbaOrphanUser.Tests.ps1 @@ -60,6 +60,4 @@ CREATE USER [dbatoolsci_orphan3] FROM LOGIN [dbatoolsci_orphan3]; $ExpectedProps = 'ComputerName,InstanceName,SqlInstance,DatabaseName,User'.Split(',') ($result.PsObject.Properties.Name | Sort-Object) | Should Be ($ExpectedProps | Sort-Object) } -} - - +} \ No newline at end of file diff --git a/tests/Get-DbaPageFileSetting.Tests.ps1 b/tests/Get-DbaPageFileSetting.Tests.ps1 index e6665f9c7a..e2ac5fd846 100644 --- a/tests/Get-DbaPageFileSetting.Tests.ps1 +++ b/tests/Get-DbaPageFileSetting.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPageFileSetting).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaPbmCategory.Tests.ps1 b/tests/Get-DbaPbmCategory.Tests.ps1 index b3513dc652..fcd15d4c62 100644 --- a/tests/Get-DbaPbmCategory.Tests.ps1 +++ b/tests/Get-DbaPbmCategory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPbmCategory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Category','InputObject','ExcludeSystemObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Category', 'InputObject', 'ExcludeSystemObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaPbmCategorySubscription.Tests.ps1 b/tests/Get-DbaPbmCategorySubscription.Tests.ps1 index 75b3f5f6ef..06c879fdb4 100644 --- a/tests/Get-DbaPbmCategorySubscription.Tests.ps1 +++ b/tests/Get-DbaPbmCategorySubscription.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPbmCategorySubscription).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaPbmCondition.Tests.ps1 b/tests/Get-DbaPbmCondition.Tests.ps1 index 45a14bac01..0a11689636 100644 --- a/tests/Get-DbaPbmCondition.Tests.ps1 +++ b/tests/Get-DbaPbmCondition.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPbmCondition).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Condition','InputObject','IncludeSystemObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Condition', 'InputObject', 'IncludeSystemObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaPbmObjectSet.Tests.ps1 b/tests/Get-DbaPbmObjectSet.Tests.ps1 index 4fa942b09f..bf8521dc39 100644 --- a/tests/Get-DbaPbmObjectSet.Tests.ps1 +++ b/tests/Get-DbaPbmObjectSet.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPbmObjectSet).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','ObjectSet','InputObject','IncludeSystemObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'ObjectSet', 'InputObject', 'IncludeSystemObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaPbmPolicy.Tests.ps1 b/tests/Get-DbaPbmPolicy.Tests.ps1 index 42ecaddcd5..26f4bc112c 100644 --- a/tests/Get-DbaPbmPolicy.Tests.ps1 +++ b/tests/Get-DbaPbmPolicy.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPbmPolicy).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Policy','Category','InputObject','IncludeSystemObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Policy', 'Category', 'InputObject', 'IncludeSystemObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -79,4 +79,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Condition -eq 'dbatoolsci_Condition' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPbmStore.Tests.ps1 b/tests/Get-DbaPbmStore.Tests.ps1 index c5649c618c..3ef078730c 100644 --- a/tests/Get-DbaPbmStore.Tests.ps1 +++ b/tests/Get-DbaPbmStore.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPbmStore).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaPermission.Tests.ps1 b/tests/Get-DbaPermission.Tests.ps1 index 0831f04cc9..9f2b25b79a 100644 --- a/tests/Get-DbaPermission.Tests.ps1 +++ b/tests/Get-DbaPermission.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPermission).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','IncludeServerLevel','NoSystemObjects','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeServerLevel', 'NoSystemObjects', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { {Get-DbaComputerSystem -ComputerName 'DoesNotExist142' -WarningAction Stop 3> $null} | Should Throw } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPfAvailableCounter.Tests.ps1 b/tests/Get-DbaPfAvailableCounter.Tests.ps1 index 329e024dc7..15ec00f9d9 100644 --- a/tests/Get-DbaPfAvailableCounter.Tests.ps1 +++ b/tests/Get-DbaPfAvailableCounter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPfAvailableCounter).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Pattern','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Pattern', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,4 +36,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPfDataCollector.Tests.ps1 b/tests/Get-DbaPfDataCollector.Tests.ps1 index 2d4ea3f876..03d014c89c 100644 --- a/tests/Get-DbaPfDataCollector.Tests.ps1 +++ b/tests/Get-DbaPfDataCollector.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPfDataCollector).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','Collector','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'Collector', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Not Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPfDataCollectorCounter.Tests.ps1 b/tests/Get-DbaPfDataCollectorCounter.Tests.ps1 index ae44ed3543..5cb5754223 100644 --- a/tests/Get-DbaPfDataCollectorCounter.Tests.ps1 +++ b/tests/Get-DbaPfDataCollectorCounter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPfDataCollectorCounter).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','Collector','Counter','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'Collector', 'Counter', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Not Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPfDataCollectorCounterSample.Tests.ps1 b/tests/Get-DbaPfDataCollectorCounterSample.Tests.ps1 index 923cf52280..fc87d9f6f0 100644 --- a/tests/Get-DbaPfDataCollectorCounterSample.Tests.ps1 +++ b/tests/Get-DbaPfDataCollectorCounterSample.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 11 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPfDataCollectorCounterSample).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','Collector','Counter','Continuous','ListSet','MaxSamples','SampleInterval','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'Collector', 'Counter', 'Continuous', 'ListSet', 'MaxSamples', 'SampleInterval', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -28,5 +28,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Not Be $null } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaPfDataCollectorSet.Tests.ps1 b/tests/Get-DbaPfDataCollectorSet.Tests.ps1 index 38c4b66d73..834552d119 100644 --- a/tests/Get-DbaPfDataCollectorSet.Tests.ps1 +++ b/tests/Get-DbaPfDataCollectorSet.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPfDataCollectorSet).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Not Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPfDataCollectorSetTemplate.Tests.ps1 b/tests/Get-DbaPfDataCollectorSetTemplate.Tests.ps1 index a5e5a4c610..8fe4162051 100644 --- a/tests/Get-DbaPfDataCollectorSetTemplate.Tests.ps1 +++ b/tests/Get-DbaPfDataCollectorSetTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPfDataCollectorSetTemplate).Parameters.Keys - $knownParameters = 'Path','Pattern','Template','EnableException' + $knownParameters = 'Path', 'Pattern', 'Template', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -33,4 +33,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Be 'Long Running Queries' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPlanCache.Tests.ps1 b/tests/Get-DbaPlanCache.Tests.ps1 index c9faceb15a..00b33ae17c 100644 --- a/tests/Get-DbaPlanCache.Tests.ps1 +++ b/tests/Get-DbaPlanCache.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPlanCache).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Size -is [dbasize] | Should -Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaPrivilege.Tests.ps1 b/tests/Get-DbaPrivilege.Tests.ps1 index 423bfed2e7..74bdf7568c 100644 --- a/tests/Get-DbaPrivilege.Tests.ps1 +++ b/tests/Get-DbaPrivilege.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaPrivilege).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaProcess.Tests.ps1 b/tests/Get-DbaProcess.Tests.ps1 index 143cc7eb20..eed5accd0d 100644 --- a/tests/Get-DbaProcess.Tests.ps1 +++ b/tests/Get-DbaProcess.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaProcess).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Spid','ExcludeSpid','Database','Login','Hostname','Program','NoSystemSpid','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Spid', 'ExcludeSpid', 'Database', 'Login', 'Hostname', 'Program', 'NoSystemSpid', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaProductKey.Tests.ps1 b/tests/Get-DbaProductKey.Tests.ps1 index bc1ae972e2..f823e7d3b7 100644 --- a/tests/Get-DbaProductKey.Tests.ps1 +++ b/tests/Get-DbaProductKey.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaProductKey).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','SqlCms','ServersFromFile','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'SqlCms', 'ServersFromFile', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaQueryExecutionTime.Tests.ps1 b/tests/Get-DbaQueryExecutionTime.Tests.ps1 index af9efb2a16..7b6a83be90 100644 --- a/tests/Get-DbaQueryExecutionTime.Tests.ps1 +++ b/tests/Get-DbaQueryExecutionTime.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaQueryExecutionTime).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','MaxResultsPerDb','MinExecs','MinExecMs','NoSystemDb','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'MaxResultsPerDb', 'MinExecs', 'MinExecMs', 'NoSystemDb', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaRegistryRoot.Tests.ps1 b/tests/Get-DbaRegistryRoot.Tests.ps1 index 6599f3be16..04c4bdca31 100644 --- a/tests/Get-DbaRegistryRoot.Tests.ps1 +++ b/tests/Get-DbaRegistryRoot.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaRegistryRoot).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaRepDistributor.Tests.ps1 b/tests/Get-DbaRepDistributor.Tests.ps1 index 0182a6ea8a..a3490ff08b 100644 --- a/tests/Get-DbaRepDistributor.Tests.ps1 +++ b/tests/Get-DbaRepDistributor.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaRepDistributor).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.DistributorInstalled | Should Be $false } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaRepPublication.Tests.ps1 b/tests/Get-DbaRepPublication.Tests.ps1 index 28cb0a7702..e0f7421ec0 100644 --- a/tests/Get-DbaRepPublication.Tests.ps1 +++ b/tests/Get-DbaRepPublication.Tests.ps1 @@ -28,7 +28,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { Mock Connect-ReplicationDB -MockWith { [object]@{ - Name = 'TestDB' + Name = 'TestDB' TransPublications = @{ Name = 'TestDB_pub' Type = 'Transactional' @@ -39,18 +39,18 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { Mock Connect-SqlInstance -MockWith { [object]@{ - Name = "MockServerName" - ComputerName = 'MockComputerName' - Databases = @{ - Name = 'TestDB' - #state - #status - ID = 5 - ReplicationOptions = 'Published' - } + Name = "MockServerName" + ComputerName = 'MockComputerName' + Databases = @{ + Name = 'TestDB' + #state + #status + ID = 5 + ReplicationOptions = 'Published' + } ConnectionContext = @{ - SqlConnectionObject = 'FakeConnectionContext' - } + SqlConnectionObject = 'FakeConnectionContext' + } } } @@ -68,7 +68,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { Mock Connect-ReplicationDB -MockWith { [object]@{ - Name = 'TestDB' + Name = 'TestDB' TransPublications = @{ Name = 'TestDB_pub' Type = 'Snapshot' @@ -82,11 +82,11 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } It "Stops if the SqlInstance does not exist" { - + Mock Connect-SqlInstance -MockWith { Throw } - + { Get-DbaRepPublication -sqlinstance MockServerName -EnableException} | should Throw - + } It "Stops if validate set for PublicationType is not met" { @@ -96,5 +96,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaRepServer.Tests.ps1 b/tests/Get-DbaRepServer.Tests.ps1 index ab67974c35..47b0afc303 100644 --- a/tests/Get-DbaRepServer.Tests.ps1 +++ b/tests/Get-DbaRepServer.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaRepServer).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaResourceGovernor.Tests.ps1 b/tests/Get-DbaResourceGovernor.Tests.ps1 index ebb4dade9f..a1671a33ba 100644 --- a/tests/Get-DbaResourceGovernor.Tests.ps1 +++ b/tests/Get-DbaResourceGovernor.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaResourceGovernor).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaRgClassifierFunction.Tests.ps1 b/tests/Get-DbaRgClassifierFunction.Tests.ps1 index ea8cf2d335..46b70e4273 100644 --- a/tests/Get-DbaRgClassifierFunction.Tests.ps1 +++ b/tests/Get-DbaRgClassifierFunction.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaRgClassifierFunction).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,4 +41,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Name | Should -Be 'dbatoolsci_fnRG' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaRgResourcePool.Tests.ps1 b/tests/Get-DbaRgResourcePool.Tests.ps1 index 43463bbee6..756c4c757c 100644 --- a/tests/Get-DbaRgResourcePool.Tests.ps1 +++ b/tests/Get-DbaRgResourcePool.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaRgResourcePool).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Type','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Type', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaRgWorkloadGroup.Tests.ps1 b/tests/Get-DbaRgWorkloadGroup.Tests.ps1 index 15a9351d5b..bdddb7ec51 100644 --- a/tests/Get-DbaRgWorkloadGroup.Tests.ps1 +++ b/tests/Get-DbaRgWorkloadGroup.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaRgWorkloadGroup).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaRunningJob.Tests.ps1 b/tests/Get-DbaRunningJob.Tests.ps1 index 947b66be8d..081d85f1b7 100644 --- a/tests/Get-DbaRunningJob.Tests.ps1 +++ b/tests/Get-DbaRunningJob.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaSchemaChangeHistory.Tests.ps1 b/tests/Get-DbaSchemaChangeHistory.Tests.ps1 index 79e64406f5..561256c456 100644 --- a/tests/Get-DbaSchemaChangeHistory.Tests.ps1 +++ b/tests/Get-DbaSchemaChangeHistory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaSchemaChangeHistory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Since','Object','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Since', 'Object', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Object -match 'dbatoolsci_schemachange' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaServerAudit.Tests.ps1 b/tests/Get-DbaServerAudit.Tests.ps1 index 92d2594e04..8eef49eac9 100644 --- a/tests/Get-DbaServerAudit.Tests.ps1 +++ b/tests/Get-DbaServerAudit.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaServerAudit).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Audit','ExcludeAudit','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Audit', 'ExcludeAudit', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -48,4 +48,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Enabled | Should -Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaServerAuditSpecification.Tests.ps1 b/tests/Get-DbaServerAuditSpecification.Tests.ps1 index 443da0740d..aac1c93ca0 100644 --- a/tests/Get-DbaServerAuditSpecification.Tests.ps1 +++ b/tests/Get-DbaServerAuditSpecification.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaServerAuditSpecification).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaServerInstallDate.Tests.ps1 b/tests/Get-DbaServerInstallDate.Tests.ps1 index f87c831306..73a8fb8316 100644 --- a/tests/Get-DbaServerInstallDate.Tests.ps1 +++ b/tests/Get-DbaServerInstallDate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaServerInstallDate).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Credential','IncludeWindows','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Credential', 'IncludeWindows', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaServerProtocol.Tests.ps1 b/tests/Get-DbaServerProtocol.Tests.ps1 index 3ec29a1109..485a689fbd 100644 --- a/tests/Get-DbaServerProtocol.Tests.ps1 +++ b/tests/Get-DbaServerProtocol.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaServerProtocol).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -33,4 +33,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaServerRole.Tests.ps1 b/tests/Get-DbaServerRole.Tests.ps1 index 7bdd7ecc58..c8f3f0ab66 100644 --- a/tests/Get-DbaServerRole.Tests.ps1 +++ b/tests/Get-DbaServerRole.Tests.ps1 @@ -72,5 +72,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaServerRoleMember.Tests.ps1 b/tests/Get-DbaServerRoleMember.Tests.ps1 index 0231008191..c21544165e 100644 --- a/tests/Get-DbaServerRoleMember.Tests.ps1 +++ b/tests/Get-DbaServerRoleMember.Tests.ps1 @@ -71,4 +71,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { AfterAll { Remove-DbaLogin -SqlInstance $instance -Login $testLogin -Force -Confirm:$false } -} +} \ No newline at end of file diff --git a/tests/Get-DbaServerTrigger.Tests.ps1 b/tests/Get-DbaServerTrigger.Tests.ps1 index bfee0a2c71..1d55767002 100644 --- a/tests/Get-DbaServerTrigger.Tests.ps1 +++ b/tests/Get-DbaServerTrigger.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaServerTrigger).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaService.Tests.ps1 b/tests/Get-DbaService.Tests.ps1 index 2493551c32..f349029b38 100644 --- a/tests/Get-DbaService.Tests.ps1 +++ b/tests/Get-DbaService.Tests.ps1 @@ -10,8 +10,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $SupportShouldProcess = $false if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } [object[]]$params = (Get-ChildItem function:\Get-DbaService).Parameters.Keys @@ -85,4 +84,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.StartMode | Should Be 'Automatic' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaSpConfigure.Tests.ps1 b/tests/Get-DbaSpConfigure.Tests.ps1 index b6423f76ce..7e3430a356 100644 --- a/tests/Get-DbaSpConfigure.Tests.ps1 +++ b/tests/Get-DbaSpConfigure.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaSpConfigure).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential','Name','ExcludeName','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'ExcludeName', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,7 +35,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "returns two results less than all data" { $results = Get-DbaSpConfigure -SqlInstance $script:instance1 -ExcludeName "remote query timeout (s)", AllowUpdates - $results.Count -eq $configs.count -2 + $results.Count -eq $configs.count - 2 } It "matches the output of sp_configure " { @@ -44,4 +44,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.RunningValue -eq $remotequerytimeout.run_value | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaSpinLockStatistic.Tests.ps1 b/tests/Get-DbaSpinLockStatistic.Tests.ps1 index 283440c54e..938d4a80f1 100644 --- a/tests/Get-DbaSpinLockStatistic.Tests.ps1 +++ b/tests/Get-DbaSpinLockStatistic.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $SupportShouldProcess = $false if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -34,4 +33,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Count -gt 0 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaSpn.Tests.ps1 b/tests/Get-DbaSpn.Tests.ps1 index 4fd2376ce1..6955490218 100644 --- a/tests/Get-DbaSpn.Tests.ps1 +++ b/tests/Get-DbaSpn.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaSpn).Parameters.Keys - $knownParameters = 'ComputerName','AccountName','Credential','EnableException' + $knownParameters = 'ComputerName', 'AccountName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaSsisEnvironmentVariable.Tests.ps1 b/tests/Get-DbaSsisEnvironmentVariable.Tests.ps1 index 40cbfeb7df..445d34c366 100644 --- a/tests/Get-DbaSsisEnvironmentVariable.Tests.ps1 +++ b/tests/Get-DbaSsisEnvironmentVariable.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaSsisEnvironmentVariable).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Environment','EnvironmentExclude','Folder','FolderExclude','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Environment', 'EnvironmentExclude', 'Folder', 'FolderExclude', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaSsisExecutionHistory.Tests.ps1 b/tests/Get-DbaSsisExecutionHistory.Tests.ps1 index 11aaafd67f..1720d33dcc 100644 --- a/tests/Get-DbaSsisExecutionHistory.Tests.ps1 +++ b/tests/Get-DbaSsisExecutionHistory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaSsisExecutionHistory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Since','Status','Project','Folder','Environment','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Since', 'Status', 'Project', 'Folder', 'Environment', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaStartupParameter.Tests.ps1 b/tests/Get-DbaStartupParameter.Tests.ps1 index 4264b6da0f..3873ff85bb 100644 --- a/tests/Get-DbaStartupParameter.Tests.ps1 +++ b/tests/Get-DbaStartupParameter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaStartupParameter).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','Simple','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'Simple', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaSuspectPage.Tests.ps1 b/tests/Get-DbaSuspectPage.Tests.ps1 index 386645725f..14b91b45f2 100644 --- a/tests/Get-DbaSuspectPage.Tests.ps1 +++ b/tests/Get-DbaSuspectPage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaSuspectPage).Parameters.Keys - $knownParameters = 'SqlInstance','Database','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'Database', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,20 +41,18 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $null = $db.Query("select top 100 from example") $null = $server.Query("ALTER DATABASE $dbname SET PAGE_VERIFY CHECKSUM WITH NO_WAIT") $null = Start-DbccCheck -Server $Server -dbname $dbname -WarningAction SilentlyContinue - } - catch {} # should fail + } catch {} # should fail try { $null = Invoke-DbaDbCorruption -SqlInstance $script:instance2 -Database $dbname -Confirm:$false $null = $db.Query("select top 100 from example") $null = $server.Query("ALTER DATABASE $dbname SET PAGE_VERIFY CHECKSUM WITH NO_WAIT") $null = Start-DbccCheck -Server $Server -dbname $dbname -WarningAction SilentlyContinue - } - catch { } # should fail + } catch { } # should fail $results = Get-DbaSuspectPage -SqlInstance $server It "function should find at least one record in suspect_pages table" { $results.Database -contains $dbname | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaTcpPort.Tests.ps1 b/tests/Get-DbaTcpPort.Tests.ps1 index 2d65fd5fdf..89777d6ee9 100644 --- a/tests/Get-DbaTcpPort.Tests.ps1 +++ b/tests/Get-DbaTcpPort.Tests.ps1 @@ -10,7 +10,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaTcpPort).Parameters.Keys @@ -47,4 +47,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $resultsAll.Count - $resultsIpv6.Count | Should -BeGreaterThan 0 } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaTempdbUsage.Tests.ps1 b/tests/Get-DbaTempdbUsage.Tests.ps1 index dfd29307ba..87fb48b1d4 100644 --- a/tests/Get-DbaTempdbUsage.Tests.ps1 +++ b/tests/Get-DbaTempdbUsage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaTempdbUsage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaTopResourceUsage.Tests.ps1 b/tests/Get-DbaTopResourceUsage.Tests.ps1 index 56c09370e3..dcc99f215b 100644 --- a/tests/Get-DbaTopResourceUsage.Tests.ps1 +++ b/tests/Get-DbaTopResourceUsage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaTopResourceUsage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Type','Limit','EnableException','ExcludeSystem' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Type', 'Limit', 'EnableException', 'ExcludeSystem' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -37,4 +37,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results[0].PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedProps | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaTrace.Tests.ps1 b/tests/Get-DbaTrace.Tests.ps1 index 0eb38777aa..8e3cc3a831 100644 --- a/tests/Get-DbaTrace.Tests.ps1 +++ b/tests/Get-DbaTrace.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaTrace).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Id','Default','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Id', 'Default', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -49,4 +49,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Id.Count -gt 0 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaTraceFlag.Tests.ps1 b/tests/Get-DbaTraceFlag.Tests.ps1 index 1442000054..313c605f06 100644 --- a/tests/Get-DbaTraceFlag.Tests.ps1 +++ b/tests/Get-DbaTraceFlag.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaTraceFlag).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','TraceFlag','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'TraceFlag', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -51,4 +51,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.TraceFlag.Count | Should Be $startingtfscount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaUpTime.Tests.ps1 b/tests/Get-DbaUpTime.Tests.ps1 index 85bc0c677d..da78af0ce2 100644 --- a/tests/Get-DbaUpTime.Tests.ps1 +++ b/tests/Get-DbaUpTime.Tests.ps1 @@ -26,10 +26,10 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } Context "Command can handle multiple SqlInstances" { - $results = Get-DbaUptime -SqlInstance $script:instance1,$script:instance2 - It "Command resultset could contain 2 results" { - $results.count | Should Be 2 - } + $results = Get-DbaUptime -SqlInstance $script:instance1, $script:instance2 + It "Command resultset could contain 2 results" { + $results.count | Should Be 2 + } foreach ($result in $results) { It "Windows up time should be more than SQL Uptime" { $result.SqlUptime | Should BeLessThan $result.WindowsUpTime @@ -47,5 +47,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} - +} \ No newline at end of file diff --git a/tests/Get-DbaWaitResource.Tests.ps1 b/tests/Get-DbaWaitResource.Tests.ps1 index bf48290377..c515986768 100644 --- a/tests/Get-DbaWaitResource.Tests.ps1 +++ b/tests/Get-DbaWaitResource.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaWaitResource).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','WaitResource','Row','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'WaitResource', 'Row', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,7 +40,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } - Context "Test getting a Page resource"{ + Context "Test getting a Page resource" { $PageSql = " Create table #TmpIndex( PageFiD int, @@ -66,25 +66,25 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { select @pageid=PagePid from #TmpIndex where PageType=10 select 'PAGE: '+convert(varchar(3),DB_ID())+':1:'+convert(varchar(15),@pageid) " - $page = (Invoke-DbaQuery -SqlInstance $script:instance1 -Database $WaitResourceDB -Query $Pagesql).Column1 - $file = Get-DbaDbFile -SqlInstance $script:instance1 -Database $WaitResourceDB | Where-Object TypeDescription -eq 'ROWS' - $results = Get-DbaWaitResource -SqlInstance $script:instance1 -WaitResource $page - It "Should return databasename $WaitResourceDB" { - $results.DatabaseName | Should Be $WaitResourceDB - } + $page = (Invoke-DbaQuery -SqlInstance $script:instance1 -Database $WaitResourceDB -Query $Pagesql).Column1 + $file = Get-DbaDbFile -SqlInstance $script:instance1 -Database $WaitResourceDB | Where-Object TypeDescription -eq 'ROWS' + $results = Get-DbaWaitResource -SqlInstance $script:instance1 -WaitResource $page + It "Should return databasename $WaitResourceDB" { + $results.DatabaseName | Should Be $WaitResourceDB + } - It "Should return physical filename" { - $results.DataFilePath | Should Be $file.PhysicalName - } - It "Should return the correct filename" { - $results.DatafileName | Should Be $file.LogicalName - } - It "Should return ObjectName waittest" { - $results.ObjectName | Should be 'waittest' - } - It "Should return the correct object type" { - $Results.ObjectType | Should Be 'USER_TABLE' - } + It "Should return physical filename" { + $results.DataFilePath | Should Be $file.PhysicalName + } + It "Should return the correct filename" { + $results.DatafileName | Should Be $file.LogicalName + } + It "Should return ObjectName waittest" { + $results.ObjectName | Should be 'waittest' + } + It "Should return the correct object type" { + $Results.ObjectType | Should Be 'USER_TABLE' + } } Context "Deciphering a KEY WaitResource" { @@ -117,7 +117,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { It "Should return indexname is idx_pester" { $resultskey.IndexName | Should Be 'idx_pester' } - It "Should return ObjectName keytest"{ + It "Should return ObjectName keytest" { $resultskey.ObjectName | Should Be 'Keytest' } It "SHould return col1 is 1" { @@ -127,4 +127,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $resultskey.ObjectData.col2 | Should Be 'bilbo' } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWaitStatistic.Tests.ps1 b/tests/Get-DbaWaitStatistic.Tests.ps1 index 7ade912921..1c27eaad72 100644 --- a/tests/Get-DbaWaitStatistic.Tests.ps1 +++ b/tests/Get-DbaWaitStatistic.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaWaitStatistic).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Threshold','IncludeIgnorable','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Threshold', 'IncludeIgnorable', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,8 +35,8 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Command returns proper info when using parameter IncludeIgnorable" { $ignoredWaits = 'REQUEST_FOR_DEADLOCK_SEARCH', 'SLEEP_MASTERDBREADY', 'SLEEP_TASK', 'LAZYWRITER_SLEEP' $results = Get-DbaWaitStatistic -SqlInstance $script:instance2 -Threshold 100 -IncludeIgnorable | Where-Object { - $ignoredWaits -contains $_.WaitType - } + $ignoredWaits -contains $_.WaitType + } It "returns results" { $results | Should -Not -BeNullOrEmpty @@ -52,4 +52,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWaitingTask.Tests.ps1 b/tests/Get-DbaWaitingTask.Tests.ps1 index 69a7e7a0bf..df8f9c2472 100644 --- a/tests/Get-DbaWaitingTask.Tests.ps1 +++ b/tests/Get-DbaWaitingTask.Tests.ps1 @@ -81,4 +81,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } Get-Job -Name $job | Remove-Job -Force -ErrorAction SilentlyContinue } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWindowsLog.Tests.ps1 b/tests/Get-DbaWindowsLog.Tests.ps1 index 0a0b52026c..0e22ef98d4 100644 --- a/tests/Get-DbaWindowsLog.Tests.ps1 +++ b/tests/Get-DbaWindowsLog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaWindowsLog).Parameters.Keys - $knownParameters = 'SqlInstance','Start','End','Credential','MaxThreads','MaxRemoteThreads','EnableException' + $knownParameters = 'SqlInstance', 'Start', 'End', 'Credential', 'MaxThreads', 'MaxRemoteThreads', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } diff --git a/tests/Get-DbaWsfcAvailableDisk.Tests.ps1 b/tests/Get-DbaWsfcAvailableDisk.Tests.ps1 index 68cd72ea7f..da493e5b98 100644 --- a/tests/Get-DbaWsfcAvailableDisk.Tests.ps1 +++ b/tests/Get-DbaWsfcAvailableDisk.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcAvailableDisk).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcCluster.Tests.ps1 b/tests/Get-DbaWsfcCluster.Tests.ps1 index a6ac785bbe..4263846857 100644 --- a/tests/Get-DbaWsfcCluster.Tests.ps1 +++ b/tests/Get-DbaWsfcCluster.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcCluster).Parameters.Keys It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcDisk.Tests.ps1 b/tests/Get-DbaWsfcDisk.Tests.ps1 index eb1a67f6f6..96a143fe61 100644 --- a/tests/Get-DbaWsfcDisk.Tests.ps1 +++ b/tests/Get-DbaWsfcDisk.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcDisk).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcNetwork.Tests.ps1 b/tests/Get-DbaWsfcNetwork.Tests.ps1 index c1118605f7..41b16b33cf 100644 --- a/tests/Get-DbaWsfcNetwork.Tests.ps1 +++ b/tests/Get-DbaWsfcNetwork.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcNetwork).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcNetworkInterface.Tests.ps1 b/tests/Get-DbaWsfcNetworkInterface.Tests.ps1 index 61f89217cf..40737756d0 100644 --- a/tests/Get-DbaWsfcNetworkInterface.Tests.ps1 +++ b/tests/Get-DbaWsfcNetworkInterface.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcNetworkInterface).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcNode.Tests.ps1 b/tests/Get-DbaWsfcNode.Tests.ps1 index 0351ecebbb..3334dfe369 100644 --- a/tests/Get-DbaWsfcNode.Tests.ps1 +++ b/tests/Get-DbaWsfcNode.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcNode).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcResource.Tests.ps1 b/tests/Get-DbaWsfcResource.Tests.ps1 index 41088cb338..ff96ed0a3f 100644 --- a/tests/Get-DbaWsfcResource.Tests.ps1 +++ b/tests/Get-DbaWsfcResource.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcResource).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcResourceType.Tests.ps1 b/tests/Get-DbaWsfcResourceType.Tests.ps1 index 80db47a88c..bfd394869b 100644 --- a/tests/Get-DbaWsfcResourceType.Tests.ps1 +++ b/tests/Get-DbaWsfcResourceType.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcResourceType).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcRole.Tests.ps1 b/tests/Get-DbaWsfcRole.Tests.ps1 index 438d88cfcd..e575168263 100644 --- a/tests/Get-DbaWsfcRole.Tests.ps1 +++ b/tests/Get-DbaWsfcRole.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcRole).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaWsfcSharedVolume.Tests.ps1 b/tests/Get-DbaWsfcSharedVolume.Tests.ps1 index 055e96cb1d..8c4cb91ae6 100644 --- a/tests/Get-DbaWsfcSharedVolume.Tests.ps1 +++ b/tests/Get-DbaWsfcSharedVolume.Tests.ps1 @@ -10,12 +10,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $defaultParamCount = 11 - + $knownParameters = 'ComputerName', 'Credential', 'EnableException' $paramCount = $knownParameters.Count - + [object[]]$params = (Get-ChildItem function:\Get-DbaWsfcSharedVolume).Parameters.Keys It "Should contain our specific parameters" { ((Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count) | Should Be $paramCount @@ -24,4 +24,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaXEObject.Tests.ps1 b/tests/Get-DbaXEObject.Tests.ps1 index ed94e5dcb6..896ee875f7 100644 --- a/tests/Get-DbaXEObject.Tests.ps1 +++ b/tests/Get-DbaXEObject.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaXEObject).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Type','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Type', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaXESession.Tests.ps1 b/tests/Get-DbaXESession.Tests.ps1 index 474d776ea5..d0f39c79e2 100644 --- a/tests/Get-DbaXESession.Tests.ps1 +++ b/tests/Get-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaXESession).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -29,4 +29,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name -eq 'system_health' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaXESessionTarget.Tests.ps1 b/tests/Get-DbaXESessionTarget.Tests.ps1 index 8d14574d19..108a6e99bd 100644 --- a/tests/Get-DbaXESessionTarget.Tests.ps1 +++ b/tests/Get-DbaXESessionTarget.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaXESessionTarget).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','Target','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'Target', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,4 +32,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Count -gt 0 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaXESessionTargetFile.Tests.ps1 b/tests/Get-DbaXESessionTargetFile.Tests.ps1 index 4cbef23968..75822fdc3c 100644 --- a/tests/Get-DbaXESessionTargetFile.Tests.ps1 +++ b/tests/Get-DbaXESessionTargetFile.Tests.ps1 @@ -9,7 +9,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaXESessionTargetFile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','Target','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'Target', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -22,5 +22,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaXESessionTemplate.Tests.ps1 b/tests/Get-DbaXESessionTemplate.Tests.ps1 index 8713009734..fc5d80be6b 100644 --- a/tests/Get-DbaXESessionTemplate.Tests.ps1 +++ b/tests/Get-DbaXESessionTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaXESessionTemplate).Parameters.Keys - $knownParameters = 'Path','Pattern','Template','EnableException' + $knownParameters = 'Path', 'Pattern', 'Template', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -27,4 +27,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results | Where-Object Category -eq $null | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Get-DbaXESmartTarget.Tests.ps1 b/tests/Get-DbaXESmartTarget.Tests.ps1 index e20a111dc9..5011504816 100644 --- a/tests/Get-DbaXESmartTarget.Tests.ps1 +++ b/tests/Get-DbaXESmartTarget.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbaXEStore.Tests.ps1 b/tests/Get-DbaXEStore.Tests.ps1 index 3fb5f87960..b544f658b1 100644 --- a/tests/Get-DbaXEStore.Tests.ps1 +++ b/tests/Get-DbaXEStore.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbaXEStore).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbatoolsConfig.Tests.ps1 b/tests/Get-DbatoolsConfig.Tests.ps1 index 3d4c24118a..cd4c0bc171 100644 --- a/tests/Get-DbatoolsConfig.Tests.ps1 +++ b/tests/Get-DbatoolsConfig.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbatoolsConfig).Parameters.Keys - $knownParameters = 'FullName','Name','Module','Force' + $knownParameters = 'FullName', 'Name', 'Module', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Value -is [int] } } -} +} \ No newline at end of file diff --git a/tests/Get-DbatoolsConfigValue.Tests.ps1 b/tests/Get-DbatoolsConfigValue.Tests.ps1 index 001d9df82f..9fab6e2971 100644 --- a/tests/Get-DbatoolsConfigValue.Tests.ps1 +++ b/tests/Get-DbatoolsConfigValue.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbatoolsConfigValue).Parameters.Keys - $knownParameters = 'FullName','Fallback','NotNull' + $knownParameters = 'FullName', 'Fallback', 'NotNull' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DbatoolsLog.Tests.ps1 b/tests/Get-DbatoolsLog.Tests.ps1 index 0198824c74..582165f716 100644 --- a/tests/Get-DbatoolsLog.Tests.ps1 +++ b/tests/Get-DbatoolsLog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DbatoolsLog).Parameters.Keys - $knownParameters = 'FunctionName','ModuleName','Target','Tag','Last','Skip','Runspace','Level','Errors' + $knownParameters = 'FunctionName', 'ModuleName', 'Target', 'Tag', 'Last', 'Skip', 'Runspace', 'Level', 'Errors' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Get-DirectoryRestoreFile.Tests.ps1 b/tests/Get-DirectoryRestoreFile.Tests.ps1 index 3838cc75c3..8705bcfe9b 100644 --- a/tests/Get-DirectoryRestoreFile.Tests.ps1 +++ b/tests/Get-DirectoryRestoreFile.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Get-DirectoryRestoreFile).Parameters.Keys - $knownParameters = 'Path','Recurse','EnableException' + $knownParameters = 'Path', 'Recurse', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -70,5 +70,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { ($results2 | Where-Object {$_.Fullname -like '*\backups\*log2b.trn'}).count | Should be 1 } } -} - +} \ No newline at end of file diff --git a/tests/Get-XpDirTreeRestoreFile.Tests.ps1 b/tests/Get-XpDirTreeRestoreFile.Tests.ps1 index ce50b26e3d..10a66ec6cd 100644 --- a/tests/Get-XpDirTreeRestoreFile.Tests.ps1 +++ b/tests/Get-XpDirTreeRestoreFile.Tests.ps1 @@ -109,5 +109,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } } -} - +} \ No newline at end of file diff --git a/tests/Grant-DbaAgPermission.Tests.p1.ps1 b/tests/Grant-DbaAgPermission.Tests.p1.ps1 index 25d3739695..d9ac7f012a 100644 --- a/tests/Grant-DbaAgPermission.Tests.p1.ps1 +++ b/tests/Grant-DbaAgPermission.Tests.p1.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Grant-DbaAgPermission).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'AvailabilityGroup', 'Type', 'Permission', 'InputObject', 'EnableException' @@ -36,4 +36,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status | Should -Be 'Success' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Import-DbaCmsRegServer.Tests.ps1 b/tests/Import-DbaCmsRegServer.Tests.ps1 index 99aa24acad..3646b218b9 100644 --- a/tests/Import-DbaCmsRegServer.Tests.ps1 +++ b/tests/Import-DbaCmsRegServer.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -92,4 +91,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $warn | Should -Match 'No servers added' } } -} +} \ No newline at end of file diff --git a/tests/Import-DbaCsvToSql.Tests.ps1 b/tests/Import-DbaCsvToSql.Tests.ps1 index c6f2e0f5b6..e0693b544a 100644 --- a/tests/Import-DbaCsvToSql.Tests.ps1 +++ b/tests/Import-DbaCsvToSql.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 22 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Import-DbaCsvToSql).Parameters.Keys - $knownParameters = 'Csv','SqlInstance','SqlCredential','Table','Schema','Truncate','Delimiter','SingleColumn','FirstRowColumns','Turbo','Safe','First','Query','BatchSize','NotifyAfter','TableLock','CheckConstraints','FireTriggers','KeepIdentity','KeepNulls','shellswitch','SqlCredentialPath' + $knownParameters = 'Csv', 'SqlInstance', 'SqlCredential', 'Table', 'Schema', 'Truncate', 'Delimiter', 'SingleColumn', 'FirstRowColumns', 'Turbo', 'Safe', 'First', 'Query', 'BatchSize', 'NotifyAfter', 'TableLock', 'CheckConstraints', 'FireTriggers', 'KeepIdentity', 'KeepNulls', 'shellswitch', 'SqlCredentialPath' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Import-DbaPfDataCollectorSetTemplate.Tests.ps1 b/tests/Import-DbaPfDataCollectorSetTemplate.Tests.ps1 index 1cbf4f15e9..30c178cc4b 100644 --- a/tests/Import-DbaPfDataCollectorSetTemplate.Tests.ps1 +++ b/tests/Import-DbaPfDataCollectorSetTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 20 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Import-DbaPfDataCollectorSetTemplate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','DisplayName','SchedulesEnabled','RootPath','Segment','SegmentMaxDuration','SegmentMaxSize','Subdirectory','SubdirectoryFormat','SubdirectoryFormatPattern','Task','TaskRunAsSelf','TaskArguments','TaskUserTextArguments','StopOnCompletion','Path','Template','Instance','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'DisplayName', 'SchedulesEnabled', 'RootPath', 'Segment', 'SegmentMaxDuration', 'SegmentMaxSize', 'Subdirectory', 'SubdirectoryFormat', 'SubdirectoryFormatPattern', 'Task', 'TaskRunAsSelf', 'TaskArguments', 'TaskUserTextArguments', 'StopOnCompletion', 'Path', 'Template', 'Instance', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,4 +36,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.ComputerName | Should Be $env:COMPUTERNAME } } -} +} \ No newline at end of file diff --git a/tests/Import-DbaSpConfigure.Tests.ps1 b/tests/Import-DbaSpConfigure.Tests.ps1 index 8a47aeb8e2..b8605d57b9 100644 --- a/tests/Import-DbaSpConfigure.Tests.ps1 +++ b/tests/Import-DbaSpConfigure.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Import-DbaSpConfigure).Parameters.Keys - $knownParameters = 'Source','Destination','SourceSqlCredential','DestinationSqlCredential','SqlInstance','Path','SqlCredential','Force','EnableException' + $knownParameters = 'Source', 'Destination', 'SourceSqlCredential', 'DestinationSqlCredential', 'SqlInstance', 'Path', 'SqlCredential', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Import-DbaXESessionTemplate.Tests.ps1 b/tests/Import-DbaXESessionTemplate.Tests.ps1 index 5db6ff85ec..1dedcb4757 100644 --- a/tests/Import-DbaXESessionTemplate.Tests.ps1 +++ b/tests/Import-DbaXESessionTemplate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Import-DbaXESessionTemplate).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Name','Path','Template','TargetFilePath','TargetFileMetadataPath','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'Path', 'Template', 'TargetFilePath', 'TargetFileMetadataPath', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -28,4 +28,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $result.TargetFile -match 'C\:\\temp' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/InModule.Help.Exceptions.ps1 b/tests/InModule.Help.Exceptions.ps1 index 14ecea7d56..1d9518c9fb 100644 --- a/tests/InModule.Help.Exceptions.ps1 +++ b/tests/InModule.Help.Exceptions.ps1 @@ -11,5 +11,4 @@ $global:HelpTestSkipParameterType = @{ "Get-DbaCmObject" = @("DoNotUse") "Test-DbaCmConnection" = @("Type") "Get-DbaService" = @("DoNotUse") -} - +} \ No newline at end of file diff --git a/tests/InModule.Help.Tests.ps1 b/tests/InModule.Help.Tests.ps1 index 86be6111b1..66c3977ce4 100644 --- a/tests/InModule.Help.Tests.ps1 +++ b/tests/InModule.Help.Tests.ps1 @@ -124,8 +124,7 @@ foreach ($command in $commands) { } $testparamserrors += 1 } - } - elseif ($parameter.ParameterType.FullName -in $HelpTestEnumeratedArrays) { + } elseif ($parameter.ParameterType.FullName -in $HelpTestEnumeratedArrays) { # Enumerations often have issues with the typename not being reliably available $names = [Enum]::GetNames($parameter.ParameterType.DeclaredMembers[0].ReturnType) if ($parameterHelp.parameterValueGroup.parameterValue -ne $names) { @@ -135,8 +134,7 @@ foreach ($command in $commands) { } $testparamserrors += 1 } - } - else { + } else { # To avoid calling Trim method on a null object. $helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() } if ($helpType -ne $codeType ) { @@ -165,5 +163,4 @@ foreach ($command in $commands) { } } } -} - +} \ No newline at end of file diff --git a/tests/Install-DbaFirstResponderKit.Tests.ps1 b/tests/Install-DbaFirstResponderKit.Tests.ps1 index 097d936e79..fcbb7bebe9 100644 --- a/tests/Install-DbaFirstResponderKit.Tests.ps1 +++ b/tests/Install-DbaFirstResponderKit.Tests.ps1 @@ -45,4 +45,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($result.PsObject.Properties.Name | Sort-Object) | Should Be ($ExpectedProps | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Install-DbaMaintenanceSolution.Tests.ps1 b/tests/Install-DbaMaintenanceSolution.Tests.ps1 index fbd0892b60..fd0bc0dbbb 100644 --- a/tests/Install-DbaMaintenanceSolution.Tests.ps1 +++ b/tests/Install-DbaMaintenanceSolution.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Install-DbaMaintenanceSolution).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','BackupLocation','CleanupTime','OutputFileDirectory','ReplaceExisting','LogToTable','Solution','InstallJobs','LocalFile','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'BackupLocation', 'CleanupTime', 'OutputFileDirectory', 'ReplaceExisting', 'LogToTable', 'Solution', 'InstallJobs', 'LocalFile', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -31,4 +31,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $warn -match "already exists" | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Install-DbaWatchUpdate.Tests.ps1 b/tests/Install-DbaWatchUpdate.Tests.ps1 index 44784b5569..41bceee52a 100644 --- a/tests/Install-DbaWatchUpdate.Tests.ps1 +++ b/tests/Install-DbaWatchUpdate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Install-DbaWatchUpdate).Parameters.Keys - $knownParameters = 'TaskName','EnableException' + $knownParameters = 'TaskName', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Install-DbaWhoIsActive.Tests.ps1 b/tests/Install-DbaWhoIsActive.Tests.ps1 index 460eb9fdb5..2b14c3bccf 100644 --- a/tests/Install-DbaWhoIsActive.Tests.ps1 +++ b/tests/Install-DbaWhoIsActive.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Install-DbaWhoIsActive).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','LocalFile','Database','EnableException','Force' + $knownParameters = 'SqlInstance', 'SqlCredential', 'LocalFile', 'Database', 'EnableException', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaAdvancedRestore.Tests.ps1 b/tests/Invoke-DbaAdvancedRestore.Tests.ps1 index c7adbca2ab..324cb38500 100644 --- a/tests/Invoke-DbaAdvancedRestore.Tests.ps1 +++ b/tests/Invoke-DbaAdvancedRestore.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 17 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbaAdvancedRestore).Parameters.Keys - $knownParameters = 'BackupHistory','SqlInstance','SqlCredential','OutputScriptOnly','VerifyOnly','RestoreTime','StandbyDirectory','NoRecovery','MaxTransferSize','BlockSize','BufferCount','Continue','AzureCredential','WithReplace','KeepCDC','PageRestore','EnableException' + $knownParameters = 'BackupHistory', 'SqlInstance', 'SqlCredential', 'OutputScriptOnly', 'VerifyOnly', 'RestoreTime', 'StandbyDirectory', 'NoRecovery', 'MaxTransferSize', 'BlockSize', 'BufferCount', 'Continue', 'AzureCredential', 'WithReplace', 'KeepCDC', 'PageRestore', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaBalanceDataFiles.Tests.ps1 b/tests/Invoke-DbaBalanceDataFiles.Tests.ps1 index a22e7f4f1f..94874a2d86 100644 --- a/tests/Invoke-DbaBalanceDataFiles.Tests.ps1 +++ b/tests/Invoke-DbaBalanceDataFiles.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbaBalanceDataFiles).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Table','RebuildOffline','EnableException','Force' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Table', 'RebuildOffline', 'EnableException', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -79,4 +79,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $sizeUsedAfter | Should -BeLessThan $sizeUsedBefore } } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaCycleErrorLog.Tests.ps1 b/tests/Invoke-DbaCycleErrorLog.Tests.ps1 index 0d03ef594c..c682809742 100644 --- a/tests/Invoke-DbaCycleErrorLog.Tests.ps1 +++ b/tests/Invoke-DbaCycleErrorLog.Tests.ps1 @@ -29,5 +29,4 @@ Describe "$CommandName Integration Test" -Tag "IntegrationTests" { $results.LogType | Should Be "instance" } } -} - +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbClone.Tests.ps1 b/tests/Invoke-DbaDbClone.Tests.ps1 index c91d66e370..7d75bcade1 100644 --- a/tests/Invoke-DbaDbClone.Tests.ps1 +++ b/tests/Invoke-DbaDbClone.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbClone).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','CloneDatabase','ExcludeStatistics','ExcludeQueryStore','UpdateStatistics','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'CloneDatabase', 'ExcludeStatistics', 'ExcludeQueryStore', 'UpdateStatistics', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -61,4 +61,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbCorruption.Tests.ps1 b/tests/Invoke-DbaDbCorruption.Tests.ps1 index 7846e9f913..8e4f7d64b8 100644 --- a/tests/Invoke-DbaDbCorruption.Tests.ps1 +++ b/tests/Invoke-DbaDbCorruption.Tests.ps1 @@ -58,4 +58,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $result = Start-DbccCheck -Server $Server -dbname $dbname $result | Should Not Be 'Success' } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbDecryptObject.Tests.ps1 b/tests/Invoke-DbaDbDecryptObject.Tests.ps1 index 5f1a35e251..fa5b74f611 100644 --- a/tests/Invoke-DbaDbDecryptObject.Tests.ps1 +++ b/tests/Invoke-DbaDbDecryptObject.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbDecryptObject).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ObjectName','EncodingType','ExportDestination','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ObjectName', 'EncodingType', 'ExportDestination', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -126,4 +126,4 @@ END } } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbLogShipRecovery.Tests.ps1 b/tests/Invoke-DbaDbLogShipRecovery.Tests.ps1 index 5a6858ccac..2c7cfda77b 100644 --- a/tests/Invoke-DbaDbLogShipRecovery.Tests.ps1 +++ b/tests/Invoke-DbaDbLogShipRecovery.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbLogShipRecovery).Parameters.Keys - $knownParameters = 'SqlInstance','Database','SqlCredential','NoRecovery','EnableException','Force','InputObject','Delay' + $knownParameters = 'SqlInstance', 'Database', 'SqlCredential', 'NoRecovery', 'EnableException', 'Force', 'InputObject', 'Delay' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaDbLogShipping.Tests.ps1 b/tests/Invoke-DbaDbLogShipping.Tests.ps1 index 4e743e2f7e..8bb492ff20 100644 --- a/tests/Invoke-DbaDbLogShipping.Tests.ps1 +++ b/tests/Invoke-DbaDbLogShipping.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SourceSqlInstance','DestinationSqlInstance','SourceSqlCredential','SourceCredential','DestinationSqlCredential','DestinationCredential','Database','BackupNetworkPath','BackupLocalPath','BackupJob','BackupRetention','BackupSchedule','BackupScheduleDisabled','BackupScheduleFrequencyType','BackupScheduleFrequencyInterval','BackupScheduleFrequencySubdayType','BackupScheduleFrequencySubdayInterval','BackupScheduleFrequencyRelativeInterval','BackupScheduleFrequencyRecurrenceFactor','BackupScheduleStartDate','BackupScheduleEndDate','BackupScheduleStartTime','BackupScheduleEndTime','BackupThreshold','CompressBackup','CopyDestinationFolder','CopyJob','CopyRetention','CopySchedule','CopyScheduleDisabled','CopyScheduleFrequencyType','CopyScheduleFrequencyInterval','CopyScheduleFrequencySubdayType','CopyScheduleFrequencySubdayInterval','CopyScheduleFrequencyRelativeInterval','CopyScheduleFrequencyRecurrenceFactor','CopyScheduleStartDate','CopyScheduleEndDate','CopyScheduleStartTime','CopyScheduleEndTime','DisconnectUsers','FullBackupPath','GenerateFullBackup','HistoryRetention','NoRecovery','NoInitialization','PrimaryMonitorServer','PrimaryMonitorCredential','PrimaryMonitorServerSecurityMode','PrimaryThresholdAlertEnabled','RestoreDataFolder','RestoreLogFolder','RestoreDelay','RestoreAlertThreshold','RestoreJob','RestoreRetention','RestoreSchedule','RestoreScheduleDisabled','RestoreScheduleFrequencyType','RestoreScheduleFrequencyInterval','RestoreScheduleFrequencySubdayType','RestoreScheduleFrequencySubdayInterval','RestoreScheduleFrequencyRelativeInterval','RestoreScheduleFrequencyRecurrenceFactor','RestoreScheduleStartDate','RestoreScheduleEndDate','RestoreScheduleStartTime','RestoreScheduleEndTime','RestoreThreshold','SecondaryDatabasePrefix','SecondaryDatabaseSuffix','SecondaryMonitorServer','SecondaryMonitorCredential','SecondaryMonitorServerSecurityMode','SecondaryThresholdAlertEnabled','Standby','StandbyDirectory','UseExistingFullBackup','UseBackupFolder','Force','EnableException' + $knownParameters = 'SourceSqlInstance', 'DestinationSqlInstance', 'SourceSqlCredential', 'SourceCredential', 'DestinationSqlCredential', 'DestinationCredential', 'Database', 'BackupNetworkPath', 'BackupLocalPath', 'BackupJob', 'BackupRetention', 'BackupSchedule', 'BackupScheduleDisabled', 'BackupScheduleFrequencyType', 'BackupScheduleFrequencyInterval', 'BackupScheduleFrequencySubdayType', 'BackupScheduleFrequencySubdayInterval', 'BackupScheduleFrequencyRelativeInterval', 'BackupScheduleFrequencyRecurrenceFactor', 'BackupScheduleStartDate', 'BackupScheduleEndDate', 'BackupScheduleStartTime', 'BackupScheduleEndTime', 'BackupThreshold', 'CompressBackup', 'CopyDestinationFolder', 'CopyJob', 'CopyRetention', 'CopySchedule', 'CopyScheduleDisabled', 'CopyScheduleFrequencyType', 'CopyScheduleFrequencyInterval', 'CopyScheduleFrequencySubdayType', 'CopyScheduleFrequencySubdayInterval', 'CopyScheduleFrequencyRelativeInterval', 'CopyScheduleFrequencyRecurrenceFactor', 'CopyScheduleStartDate', 'CopyScheduleEndDate', 'CopyScheduleStartTime', 'CopyScheduleEndTime', 'DisconnectUsers', 'FullBackupPath', 'GenerateFullBackup', 'HistoryRetention', 'NoRecovery', 'NoInitialization', 'PrimaryMonitorServer', 'PrimaryMonitorCredential', 'PrimaryMonitorServerSecurityMode', 'PrimaryThresholdAlertEnabled', 'RestoreDataFolder', 'RestoreLogFolder', 'RestoreDelay', 'RestoreAlertThreshold', 'RestoreJob', 'RestoreRetention', 'RestoreSchedule', 'RestoreScheduleDisabled', 'RestoreScheduleFrequencyType', 'RestoreScheduleFrequencyInterval', 'RestoreScheduleFrequencySubdayType', 'RestoreScheduleFrequencySubdayInterval', 'RestoreScheduleFrequencyRelativeInterval', 'RestoreScheduleFrequencyRecurrenceFactor', 'RestoreScheduleStartDate', 'RestoreScheduleEndDate', 'RestoreScheduleStartTime', 'RestoreScheduleEndTime', 'RestoreThreshold', 'SecondaryDatabasePrefix', 'SecondaryDatabaseSuffix', 'SecondaryMonitorServer', 'SecondaryMonitorCredential', 'SecondaryMonitorServerSecurityMode', 'SecondaryThresholdAlertEnabled', 'Standby', 'StandbyDirectory', 'UseExistingFullBackup', 'UseBackupFolder', 'Force', 'EnableException' $SupportShouldProcess = $true $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -36,4 +35,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results = Invoke-DbaDbLogShipping -SourceSqlInstance $script:instance2 -DestinationSqlInstance $script:instance -Database $dbname -BackupNetworkPath C:\temp -BackupLocalPath "C:\temp\logshipping\backup" -GenerateFullBackup -CompressBackup -SecondaryDatabaseSuffix "_LS" -Force $results.Status -eq 'Success' | Should Be $true } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbMirrorFailover.Tests.ps1 b/tests/Invoke-DbaDbMirrorFailover.Tests.ps1 index 23f83b9be2..47d82e95b4 100644 --- a/tests/Invoke-DbaDbMirrorFailover.Tests.ps1 +++ b/tests/Invoke-DbaDbMirrorFailover.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbMirrorFailover).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaDbMirroring.Tests.ps1 b/tests/Invoke-DbaDbMirroring.Tests.ps1 index 9eaab0a8ee..f6f7386d2b 100644 --- a/tests/Invoke-DbaDbMirroring.Tests.ps1 +++ b/tests/Invoke-DbaDbMirroring.Tests.ps1 @@ -7,18 +7,18 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $null = Get-DbaProcess -SqlInstance $script:instance2 | Where-Object Program -match dbatools | Stop-DbaProcess -Confirm:$false -WarningAction SilentlyContinue $server = Connect-DbaInstance -SqlInstance $script:instance2 $db1 = "dbatoolsci_mirroring" - + Remove-DbaDbMirror -SqlInstance $script:instance2 -Database $db1 -Confirm:$false Remove-DbaDatabase -SqlInstance $script:instance2 -Database $db1 -Confirm:$false $null = Get-DbaDatabase -SqlInstance $script:instance2 -Database $db1 | Remove-DbaDatabase -Confirm:$false $null = $server.Query("CREATE DATABASE $db1") - } + } AfterAll { $null = Remove-DbaDatabase -Confirm:$false -SqlInstance $script:instance2, $script:instance3 -Database $db1 -ErrorAction SilentlyContinue } - + It -Skip "returns success" { $results = Invoke-DbaDbMirroring -Primary $script:instance2 -Mirror $script:instance3 -Database $db1 -Confirm:$false -Force -NetworkShare C:\temp $results.Status | Should -Be 'Success' } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbShrink.Tests.ps1 b/tests/Invoke-DbaDbShrink.Tests.ps1 index d1e23672c6..005a56e801 100644 --- a/tests/Invoke-DbaDbShrink.Tests.ps1 +++ b/tests/Invoke-DbaDbShrink.Tests.ps1 @@ -3,19 +3,19 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan . "$PSScriptRoot\constants.ps1" Describe "$CommandName Unit Tests" -Tag 'UnitTests' { - Context "Validate parameters" { - $paramCount = 14 - $defaultParamCount = 13 - [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbShrink).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential','Database','ExcludeDatabase','AllUserDatabases','PercentFreeSpace','ShrinkMethod','StatementTimeout','LogsOnly','FileType','StepSizeMB','ExcludeIndexStats','ExcludeUpdateUsage','EnableException' - It "Should contain our specific parameters" { - ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount - } - It "Should only contain $paramCount parameters" { - $params.Count - $defaultParamCount | Should Be $paramCount - } + Context "Validate parameters" { + $paramCount = 14 + $defaultParamCount = 13 + [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbShrink).Parameters.Keys + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'AllUserDatabases', 'PercentFreeSpace', 'ShrinkMethod', 'StatementTimeout', 'LogsOnly', 'FileType', 'StepSizeMB', 'ExcludeIndexStats', 'ExcludeUpdateUsage', 'EnableException' + It "Should contain our specific parameters" { + ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount + } + It "Should only contain $paramCount parameters" { + $params.Count - $defaultParamCount | Should Be $paramCount } } +} Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Verifying Database is shrunk" { @@ -93,4 +93,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $db.FileGroups[0].Files[0].Size | Should BeLessThan $oldDataSize } } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaDbUpgrade.Tests.ps1 b/tests/Invoke-DbaDbUpgrade.Tests.ps1 index 49978f280f..d447650855 100644 --- a/tests/Invoke-DbaDbUpgrade.Tests.ps1 +++ b/tests/Invoke-DbaDbUpgrade.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 12 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbaDbUpgrade).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','NoCheckDb','NoUpdateUsage','NoUpdateStats','NoRefreshView','AllUserDatabases','Force','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'NoCheckDb', 'NoUpdateUsage', 'NoUpdateStats', 'NoRefreshView', 'AllUserDatabases', 'Force', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaDiagnosticQuery.Tests.ps1 b/tests/Invoke-DbaDiagnosticQuery.Tests.ps1 index 850fffc3c7..15ec0a5a31 100644 --- a/tests/Invoke-DbaDiagnosticQuery.Tests.ps1 +++ b/tests/Invoke-DbaDiagnosticQuery.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 16 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbaDiagnosticQuery).Parameters.Keys - $knownParameters = 'SqlInstance','Database','ExcludeDatabase','ExcludeQuery','SqlCredential','Path','QueryName','UseSelectionHelper','InstanceOnly','DatabaseSpecific','NoQueryTextColumn','NoPlanColumn','NoColumnParsing','OutputPath','ExportQueries','EnableException' + $knownParameters = 'SqlInstance', 'Database', 'ExcludeDatabase', 'ExcludeQuery', 'SqlCredential', 'Path', 'QueryName', 'UseSelectionHelper', 'InstanceOnly', 'DatabaseSpecific', 'NoQueryTextColumn', 'NoPlanColumn', 'NoColumnParsing', 'OutputPath', 'ExportQueries', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -121,4 +121,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { @($results).Count | Should -Be 2 } } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaPfRelog.Tests.ps1 b/tests/Invoke-DbaPfRelog.Tests.ps1 index 03e5bb80f7..188d4fb939 100644 --- a/tests/Invoke-DbaPfRelog.Tests.ps1 +++ b/tests/Invoke-DbaPfRelog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 17 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbaPfRelog).Parameters.Keys - $knownParameters = 'Path','Destination','Type','Append','AllowClobber','PerformanceCounter','PerformanceCounterPath','Interval','BeginTime','EndTime','ConfigPath','Summary','InputObject','Multithread','AllTime','Raw','EnableException' + $knownParameters = 'Path', 'Destination', 'Type', 'Append', 'AllowClobber', 'PerformanceCounter', 'PerformanceCounterPath', 'Interval', 'BeginTime', 'EndTime', 'ConfigPath', 'Summary', 'InputObject', 'Multithread', 'AllTime', 'Raw', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaQuery.Tests.ps1 b/tests/Invoke-DbaQuery.Tests.ps1 index 5bd34cbc2f..7e7accb094 100644 --- a/tests/Invoke-DbaQuery.Tests.ps1 +++ b/tests/Invoke-DbaQuery.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbaQuery).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Query','QueryTimeout','File','SqlObject','As','SqlParameters','AppendServerInstance','MessagesToOutput','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Query', 'QueryTimeout', 'File', 'SqlObject', 'As', 'SqlParameters', 'AppendServerInstance', 'MessagesToOutput', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -104,7 +104,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { foreach ($result in $results) { $result.TestColumn | Should -Be 'hello' } - }#> + } #> It "supports queries with GO statements" { $Query = @' SELECT DB_NAME() as dbname @@ -171,4 +171,4 @@ SELECT @@servername as dbname $results.Length | Should -Be 7 # 6 'messages' plus the actual resultset ($results | ForEach-Object { Get-Date -Date $_.FiredAt -Format s } | Get-Unique).Count | Should -Not -Be 1 # the first WITH NOWAIT (stmt_4) and after } -} +} \ No newline at end of file diff --git a/tests/Invoke-DbaWhoisActive.Tests.ps1 b/tests/Invoke-DbaWhoisActive.Tests.ps1 index 9b78468743..1866bde34f 100644 --- a/tests/Invoke-DbaWhoisActive.Tests.ps1 +++ b/tests/Invoke-DbaWhoisActive.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 28 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbaWhoisActive).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Filter','FilterType','NotFilter','NotFilterType','ShowOwnSpid','ShowSystemSpids','ShowSleepingSpids','GetFullInnerText','GetPlans','GetOuterCommand','GetTransactionInfo','GetTaskInfo','GetLocks','GetAverageTime','GetAdditonalInfo','FindBlockLeaders','DeltaInterval','OutputColumnList','SortOrder','FormatOutput','DestinationTable','ReturnSchema','Schema','Help','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Filter', 'FilterType', 'NotFilter', 'NotFilterType', 'ShowOwnSpid', 'ShowSystemSpids', 'ShowSleepingSpids', 'GetFullInnerText', 'GetPlans', 'GetOuterCommand', 'GetTransactionInfo', 'GetTaskInfo', 'GetLocks', 'GetAverageTime', 'GetAdditonalInfo', 'FindBlockLeaders', 'DeltaInterval', 'OutputColumnList', 'SortOrder', 'FormatOutput', 'DestinationTable', 'ReturnSchema', 'Schema', 'Help', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbaXEReplay.Tests.ps1 b/tests/Invoke-DbaXEReplay.Tests.ps1 index 00c234a713..8edd36bec2 100644 --- a/tests/Invoke-DbaXEReplay.Tests.ps1 +++ b/tests/Invoke-DbaXEReplay.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbaXEReplay).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Event','InputObject','Raw','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Event', 'InputObject', 'Raw', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Invoke-DbatoolsFormatter.Tests.ps1 b/tests/Invoke-DbatoolsFormatter.Tests.ps1 index b5a9a7c448..0b7e993280 100644 --- a/tests/Invoke-DbatoolsFormatter.Tests.ps1 +++ b/tests/Invoke-DbatoolsFormatter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Invoke-DbatoolsFormatter).Parameters.Keys - $knownParameters = 'Path','EnableException' + $knownParameters = 'Path', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -26,7 +26,7 @@ function Get-DbaStub { .DESCRIPTION Using -#> + #> process { Write-Message -Level Verbose "stub" }} diff --git a/tests/Invoke-DbatoolsRenameHelper.Tests.ps1 b/tests/Invoke-DbatoolsRenameHelper.Tests.ps1 index dfb793f648..5847ced180 100644 --- a/tests/Invoke-DbatoolsRenameHelper.Tests.ps1 +++ b/tests/Invoke-DbatoolsRenameHelper.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Invoke-DbatoolsRenameHelper).Parameters.Keys - $knownParameters = 'InputObject','Encoding','EnableException' + $knownParameters = 'InputObject', 'Encoding', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Measure-DbaBackupThroughput.Tests.ps1 b/tests/Measure-DbaBackupThroughput.Tests.ps1 index 106b0fd92f..0008945a97 100644 --- a/tests/Measure-DbaBackupThroughput.Tests.ps1 +++ b/tests/Measure-DbaBackupThroughput.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Measure-DbaBackupThroughput).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Since','Last','Type','DeviceType','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Since', 'Last', 'Type', 'DeviceType', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Database.Count -eq 1 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Measure-DbaDiskSpaceRequirement.Tests.ps1 b/tests/Measure-DbaDiskSpaceRequirement.Tests.ps1 index dc8c7aae34..99b5e30706 100644 --- a/tests/Measure-DbaDiskSpaceRequirement.Tests.ps1 +++ b/tests/Measure-DbaDiskSpaceRequirement.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Measure-DbaDiskSpaceRequirement).Parameters.Keys - $knownParameters = 'Source','Database','SourceSqlCredential','Destination','DestinationDatabase','DestinationSqlCredential','Credential','EnableException' + $knownParameters = 'Source', 'Database', 'SourceSqlCredential', 'Destination', 'DestinationDatabase', 'DestinationSqlCredential', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Measure-DbatoolsImport.Tests.ps1 b/tests/Measure-DbatoolsImport.Tests.ps1 index 6c5113ebf8..c4d8993bdf 100644 --- a/tests/Measure-DbatoolsImport.Tests.ps1 +++ b/tests/Measure-DbatoolsImport.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Mount-DbaDatabase.Tests.ps1 b/tests/Mount-DbaDatabase.Tests.ps1 index c4d879ce8b..f77d520368 100644 --- a/tests/Mount-DbaDatabase.Tests.ps1 +++ b/tests/Mount-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Mount-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','FileStructure','DatabaseOwner','AttachOption','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'FileStructure', 'DatabaseOwner', 'AttachOption', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } $null = Get-DbaDatabase -SqlInstance $script:instance1 -Database detachattach | Remove-DbaDatabase -Confirm:$false -} +} \ No newline at end of file diff --git a/tests/Move-DbaCmsRegServer.Tests.ps1 b/tests/Move-DbaCmsRegServer.Tests.ps1 index 3406328c63..fc5a6554c8 100644 --- a/tests/Move-DbaCmsRegServer.Tests.ps1 +++ b/tests/Move-DbaCmsRegServer.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -68,4 +67,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Description | Should -Be $regSrvDesc3 } } -} +} \ No newline at end of file diff --git a/tests/Move-DbaCmsRegServerGroup.Tests.ps1 b/tests/Move-DbaCmsRegServerGroup.Tests.ps1 index d9816aa9e3..6821756411 100644 --- a/tests/Move-DbaCmsRegServerGroup.Tests.ps1 +++ b/tests/Move-DbaCmsRegServerGroup.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -42,7 +41,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $group3 = "dbatoolsci-group1b" $newGroup3 = Add-DbaCmsRegServerGroup -SqlInstance $script:instance1 -Name $group3 - } + } AfterAll { Get-DbaCmsRegServer -SqlInstance $script:instance1 -Name $regSrvName | Remove-DbaCmsRegServer -Confirm:$false Get-DbaCmsRegServerGroup -SqlInstance $script:instance1 -Group $group, $group2, $group3 | Remove-DbaCmsRegServerGroup -Confirm:$false @@ -58,4 +57,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Parent.Name | Should -Be 'DatabaseEngineServerGroup' } } -} +} \ No newline at end of file diff --git a/tests/New-DbaAgentJob.Tests.ps1 b/tests/New-DbaAgentJob.Tests.ps1 index e94d7add41..37a658b1ae 100644 --- a/tests/New-DbaAgentJob.Tests.ps1 +++ b/tests/New-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 19 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaAgentJob).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','Schedule','ScheduleId','Disabled','Description','StartStepId','Category','OwnerLogin','EventLogLevel','EmailLevel','PageLevel','EmailOperator','NetsendOperator','PageOperator','DeleteLevel','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'Schedule', 'ScheduleId', 'Disabled', 'Description', 'StartStepId', 'Category', 'OwnerLogin', 'EventLogLevel', 'EmailLevel', 'PageLevel', 'EmailOperator', 'NetsendOperator', 'PageOperator', 'DeleteLevel', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { # Cleanup and ignore all output Remove-DbaAgentJob -SqlInstance $script:instance2 -Job "Job One" *> $null } -} +} \ No newline at end of file diff --git a/tests/New-DbaAgentJobCategory.Tests.ps1 b/tests/New-DbaAgentJobCategory.Tests.ps1 index e70466d8bd..681312c1a1 100644 --- a/tests/New-DbaAgentJobCategory.Tests.ps1 +++ b/tests/New-DbaAgentJobCategory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaAgentJobCategory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Category','CategoryType','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Category', 'CategoryType', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -48,4 +48,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { # Cleanup and ignore all output Remove-DbaAgentJobCategory -SqlInstance $script:instance2 -Category CategoryTest1, CategoryTest2 *> $null } -} +} \ No newline at end of file diff --git a/tests/New-DbaAgentJobStep.Tests.ps1 b/tests/New-DbaAgentJobStep.Tests.ps1 index 590cda22bb..435f1ed260 100644 --- a/tests/New-DbaAgentJobStep.Tests.ps1 +++ b/tests/New-DbaAgentJobStep.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 21 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaAgentJobStep).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','StepId','StepName','Subsystem','Command','CmdExecSuccessCode','OnSuccessAction','OnSuccessStepId','OnFailAction','OnFailStepId','Database','DatabaseUser','RetryAttempts','RetryInterval','OutputFileName','Flag','ProxyName','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'StepId', 'StepName', 'Subsystem', 'Command', 'CmdExecSuccessCode', 'OnSuccessAction', 'OnSuccessStepId', 'OnFailAction', 'OnFailStepId', 'Database', 'DatabaseUser', 'RetryAttempts', 'RetryInterval', 'OutputFileName', 'Flag', 'ProxyName', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -50,4 +50,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $newresults.JobSteps | Where-Object Id -eq 2 | Select-Object -ExpandProperty Name | Should -Be "Step One" } } -} +} \ No newline at end of file diff --git a/tests/New-DbaAgentProxy.Tests.ps1 b/tests/New-DbaAgentProxy.Tests.ps1 index c15fca5f02..a1bc65ab56 100644 --- a/tests/New-DbaAgentProxy.Tests.ps1 +++ b/tests/New-DbaAgentProxy.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 12 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaAgentProxy).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Name','ProxyCredential','SubSystem','Description','Login','ServerRole','MsdbRole','Disabled','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'ProxyCredential', 'SubSystem', 'Description', 'Login', 'ServerRole', 'MsdbRole', 'Disabled', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $warn -match 'does not exist' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/New-DbaAgentSchedule.Tests.ps1 b/tests/New-DbaAgentSchedule.Tests.ps1 index ed898ed969..d950d3faa3 100644 --- a/tests/New-DbaAgentSchedule.Tests.ps1 +++ b/tests/New-DbaAgentSchedule.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 17 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaAgentSchedule).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','Schedule','Disabled','FrequencyType','FrequencyInterval','FrequencySubdayType','FrequencySubdayInterval','FrequencyRelativeInterval','FrequencyRecurrenceFactor','StartDate','EndDate','StartTime','EndTime','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'Schedule', 'Disabled', 'FrequencyType', 'FrequencyInterval', 'FrequencySubdayType', 'FrequencySubdayInterval', 'FrequencyRelativeInterval', 'FrequencyRecurrenceFactor', 'StartDate', 'EndDate', 'StartTime', 'EndTime', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaAvailabilityGroup.Tests.ps1 b/tests/New-DbaAvailabilityGroup.Tests.ps1 index 36051f4844..2589e8feea 100644 --- a/tests/New-DbaAvailabilityGroup.Tests.ps1 +++ b/tests/New-DbaAvailabilityGroup.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaAvailabilityGroup).Parameters.Keys $knownParameters = 'Primary', 'PrimarySqlCredential', 'Secondary', 'SecondarySqlCredential', 'Name', 'DtcSupport', 'ClusterType', 'AutomatedBackupPreference', 'FailureConditionLevel', 'HealthCheckTimeout', 'Basic', 'DatabaseHealthTrigger', 'Passthru', 'Database', 'NetworkShare', 'UseLastBackups', 'Force', 'AvailabilityMode', 'FailoverMode', 'BackupPriority', 'ConnectionModeInPrimaryRole', 'ConnectionModeInSecondaryRole', 'SeedingMode', 'Endpoint', 'ReadonlyRoutingConnectionUrl', 'Certificate', 'IPAddress', 'SubnetMask', 'Port', 'Dhcp', 'EnableException' @@ -41,8 +41,8 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } Context "adds an ag" { It "returns an ag with a db" { - $results = New-DbaAvailabilityGroup -Primary $script:instance3 -Name $agname -ClusterType None -FailoverMode Manual -Database $dbname -Confirm:$false -Certificate dbatoolsci_AGCert + $results = New-DbaAvailabilityGroup -Primary $script:instance3 -Name $agname -ClusterType None -FailoverMode Manual -Database $dbname -Confirm:$false -Certificate dbatoolsci_AGCert $results.AvailabilityDatabases.Name | Should -Be $dbname } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/New-DbaClientAlias.Tests.ps1 b/tests/New-DbaClientAlias.Tests.ps1 index 2f5f9a6fa4..7fdb7763a4 100644 --- a/tests/New-DbaClientAlias.Tests.ps1 +++ b/tests/New-DbaClientAlias.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaClientAlias).Parameters.Keys - $knownParameters = 'ComputerName','Credential','ServerName','Alias','Protocol','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'ServerName', 'Alias', 'Protocol', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } $results | Remove-DbaClientAlias } -} +} \ No newline at end of file diff --git a/tests/New-DbaCmConnection.Tests.ps1 b/tests/New-DbaCmConnection.Tests.ps1 index aa2685c569..1bbe8d5eae 100644 --- a/tests/New-DbaCmConnection.Tests.ps1 +++ b/tests/New-DbaCmConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaCmConnection).Parameters.Keys - $knownParameters = 'ComputerName','Credential','UseWindowsCredentials','OverrideExplicitCredential','DisabledConnectionTypes','DisableBadCredentialCache','DisableCimPersistence','DisableCredentialAutoRegister','EnableCredentialFailover','WindowsCredentialsAreBad','CimWinRMOptions','CimDCOMOptions','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'UseWindowsCredentials', 'OverrideExplicitCredential', 'DisabledConnectionTypes', 'DisableBadCredentialCache', 'DisableCimPersistence', 'DisableCredentialAutoRegister', 'EnableCredentialFailover', 'WindowsCredentialsAreBad', 'CimWinRMOptions', 'CimDCOMOptions', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaComputerCertificate.Tests.ps1 b/tests/New-DbaComputerCertificate.Tests.ps1 index 873c607ef1..867287e47c 100644 --- a/tests/New-DbaComputerCertificate.Tests.ps1 +++ b/tests/New-DbaComputerCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 14 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaComputerCertificate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CaServer','CaName','ClusterInstanceName','Password','FriendlyName','CertificateTemplate','KeyLength','Store','Folder','Dns','SelfSigned','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CaServer', 'CaName', 'ClusterInstanceName', 'Password', 'FriendlyName', 'CertificateTemplate', 'KeyLength', 'Store', 'Folder', 'Dns', 'SelfSigned', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ if (-not $env:appveyor) { } } } -} +} \ No newline at end of file diff --git a/tests/New-DbaConnectionString.Tests.ps1 b/tests/New-DbaConnectionString.Tests.ps1 index 6c35e8c3d8..8580b38af5 100644 --- a/tests/New-DbaConnectionString.Tests.ps1 +++ b/tests/New-DbaConnectionString.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 24 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaConnectionString).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','AccessToken','ApplicationIntent','BatchSeparator','ClientName','ConnectTimeout','EncryptConnection','FailoverPartner','IsActiveDirectoryUniversalAuth','LockTimeout','MaxPoolSize','MinPoolSize','MultipleActiveResultSets','MultiSubnetFailover','NetworkProtocol','NonPooledConnection','PacketSize','PooledConnectionLifetime','SqlExecutionModes','StatementTimeout','TrustServerCertificate','WorkstationId','AppendConnectionString' + $knownParameters = 'SqlInstance', 'Credential', 'AccessToken', 'ApplicationIntent', 'BatchSeparator', 'ClientName', 'ConnectTimeout', 'EncryptConnection', 'FailoverPartner', 'IsActiveDirectoryUniversalAuth', 'LockTimeout', 'MaxPoolSize', 'MinPoolSize', 'MultipleActiveResultSets', 'MultiSubnetFailover', 'NetworkProtocol', 'NonPooledConnection', 'PacketSize', 'PooledConnectionLifetime', 'SqlExecutionModes', 'StatementTimeout', 'TrustServerCertificate', 'WorkstationId', 'AppendConnectionString' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaConnectionStringBuilder.Tests.ps1 b/tests/New-DbaConnectionStringBuilder.Tests.ps1 index 179b39cfba..1e9117ca74 100644 --- a/tests/New-DbaConnectionStringBuilder.Tests.ps1 +++ b/tests/New-DbaConnectionStringBuilder.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaConnectionStringBuilder).Parameters.Keys - $knownParameters = 'ConnectionString','ApplicationName','DataSource','InitialCatalog','IntegratedSecurity','UserName','Password','MultipleActiveResultSets','ColumnEncryptionSetting','WorkstationId' + $knownParameters = 'ConnectionString', 'ApplicationName', 'DataSource', 'InitialCatalog', 'IntegratedSecurity', 'UserName', 'Password', 'MultipleActiveResultSets', 'ColumnEncryptionSetting', 'WorkstationId' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -95,4 +95,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.IntegratedSecurity | Should Be $True } } -} +} \ No newline at end of file diff --git a/tests/New-DbaCredential.Tests.ps1 b/tests/New-DbaCredential.Tests.ps1 index 4800243e83..b98b84ddd8 100644 --- a/tests/New-DbaCredential.Tests.ps1 +++ b/tests/New-DbaCredential.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaCredential).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Name','Identity','Password','MappedClassType','ProviderName','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'Identity', 'Password', 'MappedClassType', 'ProviderName', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,8 +32,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { AfterAll { try { (Get-DbaCredential -SqlInstance $script:instance2 -Identity dbatoolsci_thor, dbatoolsci_thorsmomma -ErrorAction Stop -WarningAction SilentlyContinue).Drop() - } - catch { } + } catch { } foreach ($login in $logins) { $null = Invoke-Command2 -ScriptBlock { net user $args /delete *>&1 } -ArgumentList $login -ComputerName $script:instance2 @@ -56,4 +55,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Identity | Should Be "dbatoolsci_thorsmomma" } } -} +} \ No newline at end of file diff --git a/tests/New-DbaDacOption.Tests.ps1 b/tests/New-DbaDacOption.Tests.ps1 index 10f711ee97..be283f41b3 100644 --- a/tests/New-DbaDacOption.Tests.ps1 +++ b/tests/New-DbaDacOption.Tests.ps1 @@ -24,5 +24,4 @@ Describe "$commandname Unit Tests" -Tag "UnitTests" { It "Returns bacpac publish options" { New-DbaDacOption -Action Publish -Type Bacpac | Should -Not -BeNullOrEmpty } -} - +} \ No newline at end of file diff --git a/tests/New-DbaDacProfile.Tests.ps1 b/tests/New-DbaDacProfile.Tests.ps1 index c76f54b92b..80f1211ab1 100644 --- a/tests/New-DbaDacProfile.Tests.ps1 +++ b/tests/New-DbaDacProfile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaDacProfile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Path','ConnectionString','PublishOptions','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Path', 'ConnectionString', 'PublishOptions', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -37,4 +37,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $publishprofile.FileName -match 'publish.xml' | Should Be $true Remove-Item -Confirm:$false -Path $publishprofile.FileName -ErrorAction SilentlyContinue } -} +} \ No newline at end of file diff --git a/tests/New-DbaDatabase.Tests.ps1 b/tests/New-DbaDatabase.Tests.ps1 index 411b47b50f..f011ce9fd5 100644 --- a/tests/New-DbaDatabase.Tests.ps1 +++ b/tests/New-DbaDatabase.Tests.ps1 @@ -25,14 +25,14 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Name | Should -Match random $results | Remove-DbaDatabase -Confirm:$false } - + $null = Get-DbaProcess -SqlInstance $script:instance2, $script:instance3 | Where-Object Program -match dbatools | Stop-DbaProcess -Confirm:$false $results = New-DbaDatabase -SqlInstance $script:instance2, $script:instance3 -Name dbatoolsci_newdb It "creates one new database on two servers" { $results.Name | Should -Be 'dbatoolsci_newdb', 'dbatoolsci_newdb' $results | Remove-DbaDatabase -Confirm:$false } - + $null = Get-DbaProcess -SqlInstance $script:instance2, $script:instance3 | Where-Object Program -match dbatools | Stop-DbaProcess -Confirm:$false $results = New-DbaDatabase -SqlInstance $script:instance2, $script:instance3 -Name dbatoolsci_newdb1, dbatoolsci_newdb2 It "creates two new databases on two servers" { diff --git a/tests/New-DbaDbCertificate.Tests.ps1 b/tests/New-DbaDbCertificate.Tests.ps1 index 57f3c21d14..577ef50b8d 100644 --- a/tests/New-DbaDbCertificate.Tests.ps1 +++ b/tests/New-DbaDbCertificate.Tests.ps1 @@ -46,4 +46,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $null = $cert1 | Remove-DbaDbCertificate -Confirm:$false $null = $cert2 | Remove-DbaDbCertificate -Confirm:$false } -} +} \ No newline at end of file diff --git a/tests/New-DbaDbMasterKey.Tests.ps1 b/tests/New-DbaDbMasterKey.Tests.ps1 index 1aa6d4210e..3e938353fc 100644 --- a/tests/New-DbaDbMasterKey.Tests.ps1 +++ b/tests/New-DbaDbMasterKey.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaDbSnapshot.Tests.ps1 b/tests/New-DbaDbSnapshot.Tests.ps1 index e577432b99..dd3e02497a 100644 --- a/tests/New-DbaDbSnapshot.Tests.ps1 +++ b/tests/New-DbaDbSnapshot.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 11 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaDbSnapshot).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','AllDatabases','Name','NameSuffix','Path','Force','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'AllDatabases', 'Name', 'NameSuffix', 'Path', 'Force', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -90,8 +90,8 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "has the correct default properties" { $result = Get-DbaDbSnapshot -SqlInstance $script:instance2 -Database $db2 | Select-Object -First 1 - $ExpectedPropsDefault = 'ComputerName', 'CreateDate', 'InstanceName', 'Name', 'SnapshotOf', 'SqlInstance','DiskUsage' + $ExpectedPropsDefault = 'ComputerName', 'CreateDate', 'InstanceName', 'Name', 'SnapshotOf', 'SqlInstance', 'DiskUsage' ($result.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedPropsDefault | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/New-DbaDbUser.Tests.ps1 b/tests/New-DbaDbUser.Tests.ps1 index 9800490df8..6a1cf02348 100644 --- a/tests/New-DbaDbUser.Tests.ps1 +++ b/tests/New-DbaDbUser.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaDbUser).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','IncludeSystem','Login','Username','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeSystem', 'Login', 'Username', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaDirectory.Tests.ps1 b/tests/New-DbaDirectory.Tests.ps1 index 60a001b5fa..d2225f5f50 100644 --- a/tests/New-DbaDirectory.Tests.ps1 +++ b/tests/New-DbaDirectory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaDirectory).Parameters.Keys - $knownParameters = 'SqlInstance','Path','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'Path', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaEndpoint.Tests.ps1 b/tests/New-DbaEndpoint.Tests.ps1 index 1ccfbe3b37..35f4780ad0 100644 --- a/tests/New-DbaEndpoint.Tests.ps1 +++ b/tests/New-DbaEndpoint.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName diff --git a/tests/New-DbaLogin.Tests.ps1 b/tests/New-DbaLogin.Tests.ps1 index ec91cc796a..2e8d3ce383 100644 --- a/tests/New-DbaLogin.Tests.ps1 +++ b/tests/New-DbaLogin.Tests.ps1 @@ -10,7 +10,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 19 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaLogin).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Login','InputObject','LoginRenameHashtable','Password','HashedPassword','MapToCertificate','MapToAsymmetricKey','MapToCredential','Sid','DefaultDatabase','Language','PasswordExpiration','PasswordPolicy','Disabled','NewSid','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'InputObject', 'LoginRenameHashtable', 'Password', 'HashedPassword', 'MapToCertificate', 'MapToAsymmetricKey', 'MapToCredential', 'Sid', 'DefaultDatabase', 'Language', 'PasswordExpiration', 'PasswordPolicy', 'Disabled', 'NewSid', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -50,8 +50,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } - } - catch {<#nbd#> } + } catch {<#nbd#> } #create Windows login $computer = [ADSI]"WinNT://$computerName" @@ -60,8 +59,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if ($user.Name -eq $credLogin) { $computer.Delete('User', $credLogin) } - } - catch {<#User does not exist#>} + } catch {<#User does not exist#>} $user = $computer.Create("user", $credLogin) $user.SetPassword($password) @@ -80,8 +78,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if ($crt = $server1.Databases['master'].Certificates[$certificateName]) { $crt.Drop() } - } - catch {<#nbd#> } + } catch {<#nbd#> } $null = New-DbaDbCertificate $server1 -Name $certificateName -Password $null -Confirm:$false Context "Create new logins" { @@ -218,6 +215,5 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if (!$mkey) { $null = Remove-DbaDbMasterKey -SqlInstance $script:instance1 -Database master -Confirm:$false } - } - catch {<#nbd#> } -} + } catch {<#nbd#> } +} \ No newline at end of file diff --git a/tests/New-DbaScriptingOption.Tests.ps1 b/tests/New-DbaScriptingOption.Tests.ps1 index a0d6c78731..ea82c5d41c 100644 --- a/tests/New-DbaScriptingOption.Tests.ps1 +++ b/tests/New-DbaScriptingOption.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaServiceMasterKey.Tests.ps1 b/tests/New-DbaServiceMasterKey.Tests.ps1 index 35cf9e13e9..aa7a62f416 100644 --- a/tests/New-DbaServiceMasterKey.Tests.ps1 +++ b/tests/New-DbaServiceMasterKey.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaServiceMasterKey).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Password', 'Credential', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Password', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaSsisCatalog.Tests.ps1 b/tests/New-DbaSsisCatalog.Tests.ps1 index cca138a229..af15cf0a08 100644 --- a/tests/New-DbaSsisCatalog.Tests.ps1 +++ b/tests/New-DbaSsisCatalog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaSsisCatalog).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Password','SsisCatalog','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Password', 'SsisCatalog', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,8 +32,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if (-not $env:APPVEYOR_REPO_BRANCH) { Write-Warning "$warn" } - } - else { + } else { It "uses the specified database" { $results.SsisCatalog | Should Be $database } @@ -45,4 +44,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/New-DbaXESession.Tests.ps1 b/tests/New-DbaXESession.Tests.ps1 index 9e491dd5b5..eb21bb5f9c 100644 --- a/tests/New-DbaXESession.Tests.ps1 +++ b/tests/New-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaXESession).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Name','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Name', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaXESmartCsvWriter.Tests.ps1 b/tests/New-DbaXESmartCsvWriter.Tests.ps1 index b2fa506cdb..e2f8985977 100644 --- a/tests/New-DbaXESmartCsvWriter.Tests.ps1 +++ b/tests/New-DbaXESmartCsvWriter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaXESmartCsvWriter).Parameters.Keys - $knownParameters = 'OutputFile','Overwrite','Event','OutputColumn','Filter','EnableException' + $knownParameters = 'OutputFile', 'Overwrite', 'Event', 'OutputColumn', 'Filter', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaXESmartEmail.Tests.ps1 b/tests/New-DbaXESmartEmail.Tests.ps1 index a874143cc2..4bd69bcdb8 100644 --- a/tests/New-DbaXESmartEmail.Tests.ps1 +++ b/tests/New-DbaXESmartEmail.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 14 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaXESmartEmail).Parameters.Keys - $knownParameters = 'SmtpServer','Sender','To','Cc','Bcc','Credential','Subject','Body','Attachment','AttachmentFileName','PlainText','Event','Filter','EnableException' + $knownParameters = 'SmtpServer', 'Sender', 'To', 'Cc', 'Bcc', 'Credential', 'Subject', 'Body', 'Attachment', 'AttachmentFileName', 'PlainText', 'Event', 'Filter', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaXESmartQueryExec.Tests.ps1 b/tests/New-DbaXESmartQueryExec.Tests.ps1 index b289688bc9..38718cc6c7 100644 --- a/tests/New-DbaXESmartQueryExec.Tests.ps1 +++ b/tests/New-DbaXESmartQueryExec.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaXESmartQueryExec).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Query','EnableException','Event','Filter' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Query', 'EnableException', 'Event', 'Filter' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaXESmartReplay.Tests.ps1 b/tests/New-DbaXESmartReplay.Tests.ps1 index 31bc6861fc..2f76980d75 100644 --- a/tests/New-DbaXESmartReplay.Tests.ps1 +++ b/tests/New-DbaXESmartReplay.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaXESmartReplay).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Event','Filter','DelaySeconds','StopOnError','ReplayIntervalSeconds','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Event', 'Filter', 'DelaySeconds', 'StopOnError', 'ReplayIntervalSeconds', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbaXESmartTableWriter.Tests.ps1 b/tests/New-DbaXESmartTableWriter.Tests.ps1 index 3c8ecf55ac..1954fa50bc 100644 --- a/tests/New-DbaXESmartTableWriter.Tests.ps1 +++ b/tests/New-DbaXESmartTableWriter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbaXESmartTableWriter).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Table','AutoCreateTargetTable','UploadIntervalSeconds','Event','OutputColumn','Filter','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Table', 'AutoCreateTargetTable', 'UploadIntervalSeconds', 'Event', 'OutputColumn', 'Filter', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/New-DbatoolsSupportPackage.Tests.ps1 b/tests/New-DbatoolsSupportPackage.Tests.ps1 index 09b9aa6cbc..7c605c0063 100644 --- a/tests/New-DbatoolsSupportPackage.Tests.ps1 +++ b/tests/New-DbatoolsSupportPackage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\New-DbatoolsSupportPackage).Parameters.Keys - $knownParameters = 'Path','Variables','EnableException' + $knownParameters = 'Path', 'Variables', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Publish-DbaDacPackage.Tests.ps1 b/tests/Publish-DbaDacPackage.Tests.ps1 index 913ae9c988..6e05bc5be6 100644 --- a/tests/Publish-DbaDacPackage.Tests.ps1 +++ b/tests/Publish-DbaDacPackage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 15 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Publish-DbaDacPackage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','PublishXml','Database','ConnectionString','GenerateDeploymentScript','GenerateDeploymentReport','ScriptOnly','OutputPath','IncludeSqlCmdVars','EnableException','DacFxPath','Type','DacOption' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'PublishXml', 'Database', 'ConnectionString', 'GenerateDeploymentScript', 'GenerateDeploymentReport', 'ScriptOnly', 'OutputPath', 'IncludeSqlCmdVars', 'EnableException', 'DacFxPath', 'Type', 'DacOption' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -99,4 +99,4 @@ if (-not $env:appveyor) { } } } -} +} \ No newline at end of file diff --git a/tests/Read-DbaAuditFile.Tests.ps1 b/tests/Read-DbaAuditFile.Tests.ps1 index 45220b5775..b1287a19d2 100644 --- a/tests/Read-DbaAuditFile.Tests.ps1 +++ b/tests/Read-DbaAuditFile.Tests.ps1 @@ -13,7 +13,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Read-DbaAuditFile).Parameters.Keys - $knownParameters = 'Path','Exact','Raw','EnableException' + $knownParameters = 'Path', 'Exact', 'Raw', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -59,4 +59,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.server_principal_name | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Read-DbaBackupHeader.Tests.ps1 b/tests/Read-DbaBackupHeader.Tests.ps1 index ad29259d49..aa4e291b3a 100644 --- a/tests/Read-DbaBackupHeader.Tests.ps1 +++ b/tests/Read-DbaBackupHeader.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Read-DbaBackupHeader).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','Simple','FileList','AzureCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'Simple', 'FileList', 'AzureCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Read-DbaTraceFile.Tests.ps1 b/tests/Read-DbaTraceFile.Tests.ps1 index 8fc3300db6..74451b552b 100644 --- a/tests/Read-DbaTraceFile.Tests.ps1 +++ b/tests/Read-DbaTraceFile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 15 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Read-DbaTraceFile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','Database','Login','Spid','EventClass','ObjectType','ErrorId','EventSequence','TextData','ApplicationName','ObjectName','Where','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'Database', 'Login', 'Spid', 'EventClass', 'ObjectType', 'ErrorId', 'EventSequence', 'TextData', 'ApplicationName', 'ObjectName', 'Where', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -83,5 +83,5 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { mock Write-Message {"Path Does Not Exist"} -module dbatools (Read-DbaTraceFile -SqlInstance "$script:Instance2" ) | Should -Be "Failure" } - } -} + } +} \ No newline at end of file diff --git a/tests/Read-DbaTransactionLog.Tests.ps1 b/tests/Read-DbaTransactionLog.Tests.ps1 index 484ee77ebc..5dec9b12de 100644 --- a/tests/Read-DbaTransactionLog.Tests.ps1 +++ b/tests/Read-DbaTransactionLog.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Read-DbaTransactionLog).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','IgnoreLimit','EnableException','RowLimit' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'IgnoreLimit', 'EnableException', 'RowLimit' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Read-DbaXEFile.Tests.ps1 b/tests/Read-DbaXEFile.Tests.ps1 index 066ecc6254..3c44c42808 100644 --- a/tests/Read-DbaXEFile.Tests.ps1 +++ b/tests/Read-DbaXEFile.Tests.ps1 @@ -13,7 +13,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Read-DbaXEFile).Parameters.Keys - $knownParameters = 'Path','Exact','Raw','EnableException' + $knownParameters = 'Path', 'Exact', 'Raw', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Count -gt 1 | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Register-DbatoolsConfig.Tests.ps1 b/tests/Register-DbatoolsConfig.Tests.ps1 index 9a7d3b451b..5157c35c81 100644 --- a/tests/Register-DbatoolsConfig.Tests.ps1 +++ b/tests/Register-DbatoolsConfig.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Register-DbatoolsConfig).Parameters.Keys - $knownParameters = 'Config','FullName','Module','Name','Scope','EnableException' + $knownParameters = 'Config', 'FullName', 'Module', 'Name', 'Scope', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaAgDatabase.Tests.ps1 b/tests/Remove-DbaAgDatabase.Tests.ps1 index 89c5b9f82e..4bb7e1feed 100644 --- a/tests/Remove-DbaAgDatabase.Tests.ps1 +++ b/tests/Remove-DbaAgDatabase.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAvailabilityGroup).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'AllAvailabilityGroups', 'InputObject', 'EnableException' @@ -43,11 +43,11 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Database | Should -Be $dbname $results.Status | Should -Be 'Removed' } - + It "really removed the db from the ag" { $results = Get-DbaAvailabilityGroup -SqlInstance $script:instance3 -AvailabilityGroup $agname $results.AvailabilityGroup | Should -Be $agname $results.AvailabilityDatabases.Name | Should -Not -Contain $dbname } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Remove-DbaAgListener.Tests.ps1 b/tests/Remove-DbaAgListener.Tests.ps1 index 49578f946b..6bb9373127 100644 --- a/tests/Remove-DbaAgListener.Tests.ps1 +++ b/tests/Remove-DbaAgListener.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAgListener).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Listener', 'InputObject', 'EnableException' @@ -36,4 +36,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status | Should -Be 'Removed' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Remove-DbaAgReplica.Tests.ps1 b/tests/Remove-DbaAgReplica.Tests.ps1 index 81dc241259..a1ead80bbd 100644 --- a/tests/Remove-DbaAgReplica.Tests.ps1 +++ b/tests/Remove-DbaAgReplica.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAgReplica).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Replica', 'InputObject', 'EnableException' @@ -21,4 +21,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } -# Can't test on appveyor so idc +# Can't test on appveyor so idc \ No newline at end of file diff --git a/tests/Remove-DbaAgentJob.Tests.ps1 b/tests/Remove-DbaAgentJob.Tests.ps1 index bc1966e6c5..eb48adc4a8 100644 --- a/tests/Remove-DbaAgentJob.Tests.ps1 +++ b/tests/Remove-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAgentJob).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','KeepHistory','KeepUnusedSchedule','Mode','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'KeepHistory', 'KeepUnusedSchedule', 'Mode', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -74,4 +74,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $server.Query("delete from sysjobhistory where job_id = '$jobId'", "msdb") } } -} # $script:instance2 for appveyor +} # $script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Remove-DbaAgentJobCategory.Tests.ps1 b/tests/Remove-DbaAgentJobCategory.Tests.ps1 index 07e8ca07f4..23db2e0d69 100644 --- a/tests/Remove-DbaAgentJobCategory.Tests.ps1 +++ b/tests/Remove-DbaAgentJobCategory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAgentJobCategory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Category','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Category', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -43,4 +43,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $newresults.Count | Should Be 0 } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaAgentJobStep.Tests.ps1 b/tests/Remove-DbaAgentJobStep.Tests.ps1 index 994eedae02..f9457ed2d8 100644 --- a/tests/Remove-DbaAgentJobStep.Tests.ps1 +++ b/tests/Remove-DbaAgentJobStep.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAgentJobStep).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','StepName','Mode','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'StepName', 'Mode', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaAgentSchedule.Tests.ps1 b/tests/Remove-DbaAgentSchedule.Tests.ps1 index 2864cdc38e..a5412cd218 100644 --- a/tests/Remove-DbaAgentSchedule.Tests.ps1 +++ b/tests/Remove-DbaAgentSchedule.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAgentSchedule).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Schedule','InputObject','EnableException','Force' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Schedule', 'InputObject', 'EnableException', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaAvailabilityGroup.Tests.ps1 b/tests/Remove-DbaAvailabilityGroup.Tests.ps1 index 248c836404..5f6459061a 100644 --- a/tests/Remove-DbaAvailabilityGroup.Tests.ps1 +++ b/tests/Remove-DbaAvailabilityGroup.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaAvailabilityGroup).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'AllAvailabilityGroups', 'InputObject', 'EnableException' @@ -37,4 +37,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results | Should -BeNullorEmpty } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Remove-DbaBackup.Tests.ps1 b/tests/Remove-DbaBackup.Tests.ps1 index 9feb5b4ee3..46ccc83fc6 100644 --- a/tests/Remove-DbaBackup.Tests.ps1 +++ b/tests/Remove-DbaBackup.Tests.ps1 @@ -95,5 +95,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { (Get-ChildItem -Path $testPath -Directory -Recurse).Count | Should Be 0 } } -} - +} \ No newline at end of file diff --git a/tests/Remove-DbaClientAlias.Tests.ps1 b/tests/Remove-DbaClientAlias.Tests.ps1 index 7ab3acdbaf..a1d6dfb6ea 100644 --- a/tests/Remove-DbaClientAlias.Tests.ps1 +++ b/tests/Remove-DbaClientAlias.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaClientAlias).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Alias','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Alias', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -83,7 +83,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } $defaultParamValues = $PSDefaultParameterValues - $PSDefaultParameterValues=@{"*:WarningVariable"="+buffer"} + $PSDefaultParameterValues = @{"*:WarningVariable" = "+buffer"} $null = Remove-DbaClientAlias -Alias 'dbatoolscialias5' -WarningAction 'SilentlyContinue' @@ -94,4 +94,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaCmConnection.Tests.ps1 b/tests/Remove-DbaCmConnection.Tests.ps1 index d411ee1207..f41dc1fa45 100644 --- a/tests/Remove-DbaCmConnection.Tests.ps1 +++ b/tests/Remove-DbaCmConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaCmConnection).Parameters.Keys - $knownParameters = 'ComputerName','EnableException' + $knownParameters = 'ComputerName', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaCmsRegServer.Tests.ps1 b/tests/Remove-DbaCmsRegServer.Tests.ps1 index f1d2d49fb6..9dd5357abb 100644 --- a/tests/Remove-DbaCmsRegServer.Tests.ps1 +++ b/tests/Remove-DbaCmsRegServer.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -55,4 +54,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Status | Should -Be 'Dropped' } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaCmsRegServerGroup.Tests.ps1 b/tests/Remove-DbaCmsRegServerGroup.Tests.ps1 index e935b129c6..0955621e2d 100644 --- a/tests/Remove-DbaCmsRegServerGroup.Tests.ps1 +++ b/tests/Remove-DbaCmsRegServerGroup.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -58,4 +57,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Name | Should -Be 'dbatoolsci-third' } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaComputerCertificate.Tests.ps1 b/tests/Remove-DbaComputerCertificate.Tests.ps1 index fb6e6eeea6..3ff80f2ec6 100644 --- a/tests/Remove-DbaComputerCertificate.Tests.ps1 +++ b/tests/Remove-DbaComputerCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaComputerCertificate).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Thumbprint','Store','Folder','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Thumbprint', 'Store', 'Folder', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaDatabase.Tests.ps1 b/tests/Remove-DbaDatabase.Tests.ps1 index 87ca9a9802..1aa23196bd 100644 --- a/tests/Remove-DbaDatabase.Tests.ps1 +++ b/tests/Remove-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','IncludeSystemDb','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'IncludeSystemDb', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -61,4 +61,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Get-DbaDatabase -SqlInstance $script:instance1 -Database singlerestore | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaDatabaseSafely.Tests.ps1 b/tests/Remove-DbaDatabaseSafely.Tests.ps1 index a69e5f02b2..ea1e7a6117 100644 --- a/tests/Remove-DbaDatabaseSafely.Tests.ps1 +++ b/tests/Remove-DbaDatabaseSafely.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 14 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaDatabaseSafely).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Destination','DestinationCredential','NoDbccCheckDb','BackupFolder','CategoryName','JobOwner','AllDatabases','BackupCompression','ReuseSourceFolderStructure','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Destination', 'DestinationCredential', 'NoDbccCheckDb', 'BackupFolder', 'CategoryName', 'JobOwner', 'AllDatabases', 'BackupCompression', 'ReuseSourceFolderStructure', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -53,4 +53,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaDbCertificate.Tests.ps1 b/tests/Remove-DbaDbCertificate.Tests.ps1 index aaeeeff70c..16aa076183 100644 --- a/tests/Remove-DbaDbCertificate.Tests.ps1 +++ b/tests/Remove-DbaDbCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaDbCertificate).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Certificate','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Certificate', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { "$($results.Status)" -match 'Success' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaDbMasterKey.Tests.ps1 b/tests/Remove-DbaDbMasterKey.Tests.ps1 index 28df3585c9..027f38237f 100644 --- a/tests/Remove-DbaDbMasterKey.Tests.ps1 +++ b/tests/Remove-DbaDbMasterKey.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaDbMirror.Tests.ps1 b/tests/Remove-DbaDbMirror.Tests.ps1 index ceb2d38783..47402d0a03 100644 --- a/tests/Remove-DbaDbMirror.Tests.ps1 +++ b/tests/Remove-DbaDbMirror.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaDbMirror).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaDbMirrorMonitor.Tests.ps1 b/tests/Remove-DbaDbMirrorMonitor.Tests.ps1 index d61e665883..f350d3a3e6 100644 --- a/tests/Remove-DbaDbMirrorMonitor.Tests.ps1 +++ b/tests/Remove-DbaDbMirrorMonitor.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -31,8 +30,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $db = Get-DbaDatabase -SqlInstance $script:instance2 -Database msdb if (($db.Tables['dbm_monitor_data'].Name)) { $putback = $true - } - else { + } else { $null = Add-DbaDbMirrorMonitor -SqlInstance $script:instance2 -WarningAction SilentlyContinue } } @@ -47,4 +45,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Remove-DbaDbMirrorMonitor -SqlInstance $script:instance2 -WarningAction SilentlyContinue $results.MonitorStatus | Should -Be 'Removed' } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaDbSnapshot.Tests.ps1 b/tests/Remove-DbaDbSnapshot.Tests.ps1 index eb1bcb74fb..80a252b118 100644 --- a/tests/Remove-DbaDbSnapshot.Tests.ps1 +++ b/tests/Remove-DbaDbSnapshot.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaDbSnapshot).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Snapshot','InputObject','AllSnapshots','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Snapshot', 'InputObject', 'AllSnapshots', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -83,4 +83,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { ($result.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedPropsDefault | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaDbUser.Tests.ps1 b/tests/Remove-DbaDbUser.Tests.ps1 index 8a4910eed3..6e3e1d2dfd 100644 --- a/tests/Remove-DbaDbUser.Tests.ps1 +++ b/tests/Remove-DbaDbUser.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaDbUser).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','User','InputObject','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'User', 'InputObject', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -77,4 +77,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $db.Users[$user.Name] | Should Be $user } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaEndpoint.Tests.ps1 b/tests/Remove-DbaEndpoint.Tests.ps1 index 05382cdc74..6c74aea4e9 100644 --- a/tests/Remove-DbaEndpoint.Tests.ps1 +++ b/tests/Remove-DbaEndpoint.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -43,4 +42,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Get-DbaEndpoint -SqlInstance $script:instance2 | Where-Object EndpointType -eq DatabaseMirroring | Remove-DbaEndpoint -Confirm:$false $results.Status | Should -Be 'Removed' } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaLogin.Tests.ps1 b/tests/Remove-DbaLogin.Tests.ps1 index 8c3b768645..6de704fa65 100644 --- a/tests/Remove-DbaLogin.Tests.ps1 +++ b/tests/Remove-DbaLogin.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaLogin).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Login','InputObject','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'InputObject', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -31,4 +31,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $login1 = Get-Dbalogin -SqlInstance $script:instance1 -login $removed $null -eq $login1 } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaNetworkCertificate.Tests.ps1 b/tests/Remove-DbaNetworkCertificate.Tests.ps1 index 57f2e069ec..d6eca07089 100644 --- a/tests/Remove-DbaNetworkCertificate.Tests.ps1 +++ b/tests/Remove-DbaNetworkCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaNetworkCertificate).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaOrphanUser.Tests.ps1 b/tests/Remove-DbaOrphanUser.Tests.ps1 index aebfb0983b..9b521086f0 100644 --- a/tests/Remove-DbaOrphanUser.Tests.ps1 +++ b/tests/Remove-DbaOrphanUser.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaOrphanUser).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','User','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'User', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaPfDataCollectorCounter.Tests.ps1 b/tests/Remove-DbaPfDataCollectorCounter.Tests.ps1 index 6beaea8911..3e1a6dcc1a 100644 --- a/tests/Remove-DbaPfDataCollectorCounter.Tests.ps1 +++ b/tests/Remove-DbaPfDataCollectorCounter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaPfDataCollectorCounter).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','Collector','Counter','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'Collector', 'Counter', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -27,11 +27,11 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Verifying command returns all the required results" { It "returns the correct values" { $results = Get-DbaPfDataCollectorSet -CollectorSet 'Long Running Queries' | Get-DbaPfDataCollector | - Get-DbaPfDataCollectorCounter -Counter '\LogicalDisk(*)\Avg. Disk Queue Length' | - Remove-DbaPfDataCollectorCounter -Counter '\LogicalDisk(*)\Avg. Disk Queue Length' -Confirm:$false + Get-DbaPfDataCollectorCounter -Counter '\LogicalDisk(*)\Avg. Disk Queue Length' | + Remove-DbaPfDataCollectorCounter -Counter '\LogicalDisk(*)\Avg. Disk Queue Length' -Confirm:$false $results.DataCollectorSet | Should Be 'Long Running Queries' $results.Name | Should Be '\LogicalDisk(*)\Avg. Disk Queue Length' $results.Status | Should Be 'Removed' } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaPfDataCollectorSet.Tests.ps1 b/tests/Remove-DbaPfDataCollectorSet.Tests.ps1 index 4ac8c71902..4a9c4fd093 100644 --- a/tests/Remove-DbaPfDataCollectorSet.Tests.ps1 +++ b/tests/Remove-DbaPfDataCollectorSet.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaPfDataCollectorSet).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','InputObject','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Name | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaSpn.Tests.ps1 b/tests/Remove-DbaSpn.Tests.ps1 index 3e3967892c..d1c649c0af 100644 --- a/tests/Remove-DbaSpn.Tests.ps1 +++ b/tests/Remove-DbaSpn.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaSpn).Parameters.Keys - $knownParameters = 'SPN','ServiceAccount','Credential','EnableException' + $knownParameters = 'SPN', 'ServiceAccount', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Remove-DbaTrace.Tests.ps1 b/tests/Remove-DbaTrace.Tests.ps1 index e591288e7e..556a5e7941 100644 --- a/tests/Remove-DbaTrace.Tests.ps1 +++ b/tests/Remove-DbaTrace.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaTrace).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Id','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Id', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -112,4 +112,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Get-DbaTrace -SqlInstance $script:instance1 -Id $traceid | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaXESession.Tests.ps1 b/tests/Remove-DbaXESession.Tests.ps1 index 527fcc8d9f..f5ba99af75 100644 --- a/tests/Remove-DbaXESession.Tests.ps1 +++ b/tests/Remove-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaXESession).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','AllSessions','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'AllSessions', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -39,4 +39,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.Status | Should Be $null } } -} +} \ No newline at end of file diff --git a/tests/Remove-DbaXESmartTarget.Tests.ps1 b/tests/Remove-DbaXESmartTarget.Tests.ps1 index 79fed16c3f..d88d8ee184 100644 --- a/tests/Remove-DbaXESmartTarget.Tests.ps1 +++ b/tests/Remove-DbaXESmartTarget.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Remove-DbaXESmartTarget).Parameters.Keys - $knownParameters = 'InputObject','EnableException' + $knownParameters = 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Rename-DbaDatabase.Tests.ps1 b/tests/Rename-DbaDatabase.Tests.ps1 index 620d1249fe..95b450d327 100644 --- a/tests/Rename-DbaDatabase.Tests.ps1 +++ b/tests/Rename-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 16 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Rename-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','AllDatabases','DatabaseName','FileGroupName','LogicalName','FileName','ReplaceBefore','Force','Move','SetOffline','Preview','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'AllDatabases', 'DatabaseName', 'FileGroupName', 'LogicalName', 'FileName', 'ReplaceBefore', 'Force', 'Move', 'SetOffline', 'Preview', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Rename-DbaLogin.Tests.ps1 b/tests/Rename-DbaLogin.Tests.ps1 index 1ca1ef5ba2..4b7c31d2ca 100644 --- a/tests/Rename-DbaLogin.Tests.ps1 +++ b/tests/Rename-DbaLogin.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Rename-DbaLogin).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Login','NewLogin','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'NewLogin', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -38,4 +38,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $login1 = Get-Dbalogin -SqlInstance $script:instance1 -login $renamed $null -ne $login1 } -} +} \ No newline at end of file diff --git a/tests/Repair-DbaDbMirror.Tests.ps1 b/tests/Repair-DbaDbMirror.Tests.ps1 index 4366198475..85e211327c 100644 --- a/tests/Repair-DbaDbMirror.Tests.ps1 +++ b/tests/Repair-DbaDbMirror.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Repair-DbaDbMirror).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Repair-DbaOrphanUser.Tests.ps1 b/tests/Repair-DbaOrphanUser.Tests.ps1 index f674c17a44..2060dbaceb 100644 --- a/tests/Repair-DbaOrphanUser.Tests.ps1 +++ b/tests/Repair-DbaOrphanUser.Tests.ps1 @@ -70,5 +70,4 @@ CREATE LOGIN [dbatoolsci_orphan2] WITH PASSWORD = N'password2', CHECK_EXPIRATION It "does not find any other orphan" { $results | Should -BeNullOrEmpty } -} - +} \ No newline at end of file diff --git a/tests/Repair-DbaServerName.Tests.ps1 b/tests/Repair-DbaServerName.Tests.ps1 index 44fd1372a0..704add148d 100644 --- a/tests/Repair-DbaServerName.Tests.ps1 +++ b/tests/Repair-DbaServerName.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Repair-DbaServerName).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','AutoFix','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'AutoFix', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Reset-DbaAdmin.Tests.ps1 b/tests/Reset-DbaAdmin.Tests.ps1 index c6932433d5..8a2e20d636 100644 --- a/tests/Reset-DbaAdmin.Tests.ps1 +++ b/tests/Reset-DbaAdmin.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Reset-DbaAdmin).Parameters.Keys - $knownParameters = 'SqlInstance','Login','SecurePassword','Force','EnableException' + $knownParameters = 'SqlInstance', 'Login', 'SecurePassword', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -32,4 +32,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $server.ConnectionContext.FixedServerRoles -match 'SysAdmin' } } -} +} \ No newline at end of file diff --git a/tests/Resolve-DbaNetworkName.Tests.ps1 b/tests/Resolve-DbaNetworkName.Tests.ps1 index ad39998bca..49d046d97c 100644 --- a/tests/Resolve-DbaNetworkName.Tests.ps1 +++ b/tests/Resolve-DbaNetworkName.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Resolve-DbaNetworkName).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Turbo','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Turbo', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Restart-DbaService.Tests.ps1 b/tests/Restart-DbaService.Tests.ps1 index e010206599..13d345c481 100644 --- a/tests/Restart-DbaService.Tests.ps1 +++ b/tests/Restart-DbaService.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Restart-DbaService).Parameters.Keys - $knownParameters = 'ComputerName','InstanceName','Type','InputObject','Timeout','Credential','Force','EnableException' + $knownParameters = 'ComputerName', 'InstanceName', 'Type', 'InputObject', 'Timeout', 'Credential', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -41,4 +41,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Restore-DbaBackupFromDirectory.Tests.ps1 b/tests/Restore-DbaBackupFromDirectory.Tests.ps1 index 8024d33212..58dc20a2d1 100644 --- a/tests/Restore-DbaBackupFromDirectory.Tests.ps1 +++ b/tests/Restore-DbaBackupFromDirectory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Restore-DbaBackupFromDirectory).Parameters.Keys - $knownParameters = 'SqlInstance','Path','NoRecovery','ReuseSourceFolderStructure','SqlCredential','Force' + $knownParameters = 'SqlInstance', 'Path', 'NoRecovery', 'ReuseSourceFolderStructure', 'SqlCredential', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Restore-DbaDatabase.Tests.ps1 b/tests/Restore-DbaDatabase.Tests.ps1 index e69601018e..53800000a8 100644 --- a/tests/Restore-DbaDatabase.Tests.ps1 +++ b/tests/Restore-DbaDatabase.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 45 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Restore-DbaDatabase).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','DatabaseName','DestinationDataDirectory','DestinationLogDirectory','DestinationFileStreamDirectory','RestoreTime','NoRecovery','WithReplace','XpDirTree','OutputScriptOnly','VerifyOnly','MaintenanceSolutionBackup','FileMapping','IgnoreLogBackup','useDestinationDefaultDirectories','ReuseSourceFolderStructure','DestinationFilePrefix','RestoredDatabaseNamePrefix','TrustDbBackupHistory','MaxTransferSize','BlockSize','BufferCount','DirectoryRecurse','EnableException','StandbyDirectory','Continue','AzureCredential','ReplaceDbNameInFile','DestinationFileSuffix','Recover','KeepCDC','AllowContinue','GetBackupInformation','StopAfterGetBackupInformation','SelectBackupInformation','StopAfterSelectBackupInformation','FormatBackupInformation','StopAfterFormatBackupInformation','TestBackupInformation','StopAfterTestBackupInformation','PageRestore','PageRestoreTailFolder','StatementTimeout' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'DatabaseName', 'DestinationDataDirectory', 'DestinationLogDirectory', 'DestinationFileStreamDirectory', 'RestoreTime', 'NoRecovery', 'WithReplace', 'XpDirTree', 'OutputScriptOnly', 'VerifyOnly', 'MaintenanceSolutionBackup', 'FileMapping', 'IgnoreLogBackup', 'useDestinationDefaultDirectories', 'ReuseSourceFolderStructure', 'DestinationFilePrefix', 'RestoredDatabaseNamePrefix', 'TrustDbBackupHistory', 'MaxTransferSize', 'BlockSize', 'BufferCount', 'DirectoryRecurse', 'EnableException', 'StandbyDirectory', 'Continue', 'AzureCredential', 'ReplaceDbNameInFile', 'DestinationFileSuffix', 'Recover', 'KeepCDC', 'AllowContinue', 'GetBackupInformation', 'StopAfterGetBackupInformation', 'SelectBackupInformation', 'StopAfterSelectBackupInformation', 'FormatBackupInformation', 'StopAfterFormatBackupInformation', 'TestBackupInformation', 'StopAfterTestBackupInformation', 'PageRestore', 'PageRestoreTailFolder', 'StatementTimeout' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -443,7 +443,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "Should have left the db in a norecovery state" { (Get-DbaDatabase -SqlInstance $script:instance2 -Database ft1).Status | Should Be "Restoring" } - $Results2 = Restore-DbaDatabase -SqlInstance $script:instance2 -Path $script:appveyorlabrepo\sql2008-backups\ft1\ -Continue + $Results2 = Restore-DbaDatabase -SqlInstance $script:instance2 -Path $script:appveyorlabrepo\sql2008-backups\ft1\ -Continue It "Should Have restored the database cleanly" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -465,7 +465,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "Should have left the db in a norecovery state" { (Get-DbaDatabase -SqlInstance $script:instance2 -Database contest).Status | Should Be "Restoring" } - $Results2 = Restore-DbaDatabase -SqlInstance $script:instance2 -DatabaseName contest -Path $script:appveyorlabrepo\sql2008-backups\ft1\ -Continue + $Results2 = Restore-DbaDatabase -SqlInstance $script:instance2 -DatabaseName contest -Path $script:appveyorlabrepo\sql2008-backups\ft1\ -Continue It "Should Have restored the database cleanly" { ($results2.RestoreComplete -contains $false) | Should be $False (($results2 | Measure-Object).count -gt 0) | Should be $True @@ -477,7 +477,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Continue Restore with multiple databases" { AfterAll { - $null = Get-DbaDatabase -SqlInstance $script:instance2 -ExcludeAllSystemDb | Remove-DbaDatabase -Confirm:$false + $null = Get-DbaDatabase -SqlInstance $script:instance2 -ExcludeAllSystemDb | Remove-DbaDatabase -Confirm:$false } $files = @() $files += Get-ChildItem $script:appveyorlabrepo\sql2008-backups\db1\FULL\ @@ -493,7 +493,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $files = @() $files += Get-ChildItem $script:appveyorlabrepo\sql2008-backups\db1\ -Recurse $files += Get-ChildItem $script:appveyorlabrepo\sql2008-backups\dbareports\ -Recurse - $Results2 = $files | ?{$_.PsIsContainer -eq $false} | Restore-DbaDatabase -SqlInstance $script:instance2 -Continue + $Results2 = $files | ? {$_.PsIsContainer -eq $false} | Restore-DbaDatabase -SqlInstance $script:instance2 -Continue It "Should Have restored the database cleanly" { ($results2.RestoreComplete -contains $false) | Should be $False (($results2 | Measure-Object).count -gt 0) | Should be $True @@ -800,7 +800,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } - Context "Don't try to create/test folders with OutputScriptOnly (Issue 4046)"{ + Context "Don't try to create/test folders with OutputScriptOnly (Issue 4046)" { $null = Restore-DbaDatabase -SqlInstance $script:instance2 -Path $script:appveyorlabrepo\RestoreTimeClean\RestoreTimeClean.bak -DestinationDataDirectory g:\DoesNtExist -OutputScriptOnly -WarningVariable warnvar It "Should not raise a warning" { ('' -eq $warnvar) | Should -Be $True @@ -811,7 +811,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Restores From Azure using SAS" { BeforeAll { $server = Connect-DbaInstance -SqlInstance $script:instance2 - if (Get-DbaCredential -SqlInstance $script:instance2 -Name "[$script:azureblob]" ){ + if (Get-DbaCredential -SqlInstance $script:instance2 -Name "[$script:azureblob]" ) { $sql = "DROP CREDENTIAL [$script:azureblob]" $server.Query($sql) } @@ -848,7 +848,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Get-DbaDatabase -SqlInstance $script:instance2 -Database "dbatoolsci_azure" | Remove-DbaDatabase -Confirm:$false } It "Should restore cleanly" { - $results = @("$script:azureblob/az-1.bak","$script:azureblob/az-2.bak","$script:azureblob/az-3.bak") | Restore-DbaDatabase -SqlInstance $script:instance2 -DatabaseName azstripetest -WithReplace -ReplaceDbNameInFile + $results = @("$script:azureblob/az-1.bak", "$script:azureblob/az-2.bak", "$script:azureblob/az-3.bak") | Restore-DbaDatabase -SqlInstance $script:instance2 -DatabaseName azstripetest -WithReplace -ReplaceDbNameInFile $results.RestoreComplete | Should Be $True } } @@ -878,4 +878,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Restore-DbaDbCertificate.Tests.ps1 b/tests/Restore-DbaDbCertificate.Tests.ps1 index b04d2a16dc..2861774fa9 100644 --- a/tests/Restore-DbaDbCertificate.Tests.ps1 +++ b/tests/Restore-DbaDbCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Restore-DbaDbCertificate).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Path','Database','Password','EncryptionPassword','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Path', 'Database', 'Password', 'EncryptionPassword', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -29,7 +29,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $null = Remove-DbaDbCertificate -SqlInstance $script:instance1 -Certificate $cert.Name -Database tempdb -Confirm:$false $null = $masterkey | Remove-DbaDbMasterKey -Confirm:$false } - + It "restores the db cert" { $results = Restore-DbaDbCertificate -SqlInstance $script:instance1 -Path $backup.ExportPath -Password $password -Database tempdb -EncryptionPassword $password -Confirm:$false $results.Parent.Name | Should Be 'tempdb' @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { # From what I can tell, what matters is creation, not restore. } } -} +} \ No newline at end of file diff --git a/tests/Restore-DbaDbSnapshot.Tests.ps1 b/tests/Restore-DbaDbSnapshot.Tests.ps1 index 7ac0ab3ed5..b8f0817b45 100644 --- a/tests/Restore-DbaDbSnapshot.Tests.ps1 +++ b/tests/Restore-DbaDbSnapshot.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Restore-DbaDbSnapshot).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Snapshot','InputObject','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Snapshot', 'InputObject', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -102,4 +102,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { ($result.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedPropsDefault | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Resume-DbaAgDbDataMovement.Tests.ps1 b/tests/Resume-DbaAgDbDataMovement.Tests.ps1 index 8c8e91c346..870bfd5fb1 100644 --- a/tests/Resume-DbaAgDbDataMovement.Tests.ps1 +++ b/tests/Resume-DbaAgDbDataMovement.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Resume-DbaAgDbDataMovement).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Database', 'InputObject', 'EnableException' @@ -45,4 +45,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.SynchronizationState | Should -Be 'Synchronized' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Revoke-DbaAgPermission.Tests.ps1 b/tests/Revoke-DbaAgPermission.Tests.ps1 index 91ba622989..e0423cd638 100644 --- a/tests/Revoke-DbaAgPermission.Tests.ps1 +++ b/tests/Revoke-DbaAgPermission.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Revoke-DbaAgPermission).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'Login', 'AvailabilityGroup', 'Type', 'Permission', 'InputObject', 'EnableException' @@ -36,4 +36,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.Status | Should -Be 'Success' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Save-DbaDiagnosticQueryScript.Tests.ps1 b/tests/Save-DbaDiagnosticQueryScript.Tests.ps1 index 28f646a58c..88b5092561 100644 --- a/tests/Save-DbaDiagnosticQueryScript.Tests.ps1 +++ b/tests/Save-DbaDiagnosticQueryScript.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Save-DbaDiagnosticQueryScript).Parameters.Keys - $knownParameters = 'Path','EnableException' + $knownParameters = 'Path', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Select-DbaBackupInformation.Tests.ps1 b/tests/Select-DbaBackupInformation.Tests.ps1 index f8c52c29ed..6fd0c61310 100644 --- a/tests/Select-DbaBackupInformation.Tests.ps1 +++ b/tests/Select-DbaBackupInformation.Tests.ps1 @@ -259,4 +259,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } -} +} \ No newline at end of file diff --git a/tests/Select-DbaObject.Tests.ps1 b/tests/Select-DbaObject.Tests.ps1 index 28e5ce5d77..674d02ea82 100644 --- a/tests/Select-DbaObject.Tests.ps1 +++ b/tests/Select-DbaObject.Tests.ps1 @@ -8,12 +8,12 @@ Describe "$commandname Unit Tests" -Tag "UnitTests" { Bar = 18 Tara = 21 } - + $global:object2 = [PSCustomObject]@{ Foo = 42000 Bar = 23 } - + $global:list = @() $global:list += $object $global:list += [PSCustomObject]@{ @@ -21,50 +21,50 @@ Describe "$commandname Unit Tests" -Tag "UnitTests" { Bar = 88 Tara = 28 } - + It "renames Bar to Bar2" { ($object | Select-DbaObject -Property 'Foo', 'Bar as Bar2').PSObject.Properties.Name | Should -Be 'Foo', 'Bar2' } - + It "changes Bar to string" { ($object | Select-DbaObject -Property 'Bar to string').Bar.GetType().FullName | Should -Be 'System.String' } - + it "converts numbers to sizes" { ($object2 | Select-DbaObject -Property 'Foo size KB:1').Foo | Should -Be 41 ($object2 | Select-DbaObject -Property 'Foo size KB:1:1').Foo | Should -Be "41 KB" } - + it "picks values from other variables" { ($object2 | Select-DbaObject -Property 'Tara from object').Tara | Should -Be 21 } - + it "picks values from the properties of the right object in a list" { ($object2 | Select-DbaObject -Property 'Tara from List where Foo = Bar').Tara | Should -Be 28 } - + It "sets the correct properties to show in whitelist mode" { $obj = [PSCustomObject]@{ Foo = "Bar"; Bar = 42; Right = "Left" } $null = $obj | Select-DbaObject -ShowProperty Foo, Bar $obj.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Should -Be 'Foo', 'Bar' } - + It "sets the correct properties to show in blacklist mode" { $obj = [PSCustomObject]@{ Foo = "Bar"; Bar = 42; Right = "Left" } $null = $obj | Select-DbaObject -ShowExcludeProperty Foo $obj.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Should -Be 'Bar', 'Right' } - + It "sets the correct typename" { $obj = [PSCustomObject]@{ Foo = "Bar"; Bar = 42; Right = "Left" } $null = $obj | Select-DbaObject -TypeName 'Foo.Bar' $obj.PSObject.TypeNames[0] | Should -Be 'Foo.Bar' } - + It "adds properties without harming the original object when used with -KeepInputObject" { $item = Get-Item "$PSScriptRoot\Select-DbaObject.Tests.ps1" $modItem = $item | Select-DbaObject "Length as Size size KB:1:1" -KeepInputObject $modItem.GetType().FullName | Should -Be 'System.IO.FileInfo' $modItem.Size | Should -BeLike '* KB' } -} +} \ No newline at end of file diff --git a/tests/Set-DbaAgListener.Tests.ps1 b/tests/Set-DbaAgListener.Tests.ps1 index 80be0748f3..4d9dc01282 100644 --- a/tests/Set-DbaAgListener.Tests.ps1 +++ b/tests/Set-DbaAgListener.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgListener).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Listener', 'Port', 'InputObject', 'EnableException' @@ -19,4 +19,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaAgReplica.Tests.ps1 b/tests/Set-DbaAgReplica.Tests.ps1 index 3f9a3116b5..94804b70c0 100644 --- a/tests/Set-DbaAgReplica.Tests.ps1 +++ b/tests/Set-DbaAgReplica.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgReplica).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Replica', 'AvailabilityMode', 'InputObject', 'EnableException', 'FailoverMode', 'BackupPriority', 'EndpointUrl', 'ConnectionModeInPrimaryRole', 'ConnectionModeInSecondaryRole', 'ReadonlyRoutingConnectionUrl', 'SeedingMode' diff --git a/tests/Set-DbaAgentAlert.Tests.ps1 b/tests/Set-DbaAgentAlert.Tests.ps1 index ec484348cd..97b430fbe4 100644 --- a/tests/Set-DbaAgentAlert.Tests.ps1 +++ b/tests/Set-DbaAgentAlert.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgentAlert).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Alert','NewName','Enabled','Disabled','Force','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Alert', 'NewName', 'Enabled', 'Disabled', 'Force', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,4 +36,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "changes new alert name to dbatoolsci test alert NEW" { $results.Name | Should Be 'dbatoolsci test alert NEW' } -} +} \ No newline at end of file diff --git a/tests/Set-DbaAgentJob.Tests.ps1 b/tests/Set-DbaAgentJob.Tests.ps1 index 8a1dba84c9..771e084cc1 100644 --- a/tests/Set-DbaAgentJob.Tests.ps1 +++ b/tests/Set-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 23 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgentJob).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','Schedule','ScheduleId','NewName','Enabled','Disabled','Description','StartStepId','Category','OwnerLogin','EventLogLevel','EmailLevel','NetsendLevel','PageLevel','EmailOperator','NetsendOperator','PageOperator','DeleteLevel','Force','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'Schedule', 'ScheduleId', 'NewName', 'Enabled', 'Disabled', 'Description', 'StartStepId', 'Category', 'OwnerLogin', 'EventLogLevel', 'EmailLevel', 'NetsendLevel', 'PageLevel', 'EmailOperator', 'NetsendOperator', 'PageOperator', 'DeleteLevel', 'Force', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaAgentJobCategory.Tests.ps1 b/tests/Set-DbaAgentJobCategory.Tests.ps1 index 443681ebce..16a5be9580 100644 --- a/tests/Set-DbaAgentJobCategory.Tests.ps1 +++ b/tests/Set-DbaAgentJobCategory.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgentJobCategory).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Category','NewName','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Category', 'NewName', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { # Cleanup and ignore all output Remove-DbaAgentJobCategory -SqlInstance $script:instance2 -Category CategoryTest2 *> $null } -} +} \ No newline at end of file diff --git a/tests/Set-DbaAgentJobOutputFile.Tests.ps1 b/tests/Set-DbaAgentJobOutputFile.Tests.ps1 index 61fdc2ecde..666c6bab8a 100644 --- a/tests/Set-DbaAgentJobOutputFile.Tests.ps1 +++ b/tests/Set-DbaAgentJobOutputFile.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgentJobOutputFile).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','Step','OutputFile','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'Step', 'OutputFile', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaAgentJobStep.Tests.ps1 b/tests/Set-DbaAgentJobStep.Tests.ps1 index 88924e5645..1f1e374701 100644 --- a/tests/Set-DbaAgentJobStep.Tests.ps1 +++ b/tests/Set-DbaAgentJobStep.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 21 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgentJobStep).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','StepName','NewName','Subsystem','Command','CmdExecSuccessCode','OnSuccessAction','OnSuccessStepId','OnFailAction','OnFailStepId','Database','DatabaseUser','RetryAttempts','RetryInterval','OutputFileName','Flag','ProxyName','EnableException','Force' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'StepName', 'NewName', 'Subsystem', 'Command', 'CmdExecSuccessCode', 'OnSuccessAction', 'OnSuccessStepId', 'OnFailAction', 'OnFailStepId', 'Database', 'DatabaseUser', 'RetryAttempts', 'RetryInterval', 'OutputFileName', 'Flag', 'ProxyName', 'EnableException', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaAgentSchedule.Tests.ps1 b/tests/Set-DbaAgentSchedule.Tests.ps1 index 45f8b0f394..8be84a4fdd 100644 --- a/tests/Set-DbaAgentSchedule.Tests.ps1 +++ b/tests/Set-DbaAgentSchedule.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 19 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAgentSchedule).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','ScheduleName','NewName','Enabled','Disabled','FrequencyType','FrequencyInterval','FrequencySubdayType','FrequencySubdayInterval','FrequencyRelativeInterval','FrequencyRecurrenceFactor','StartDate','EndDate','StartTime','EndTime','EnableException','Force' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'ScheduleName', 'NewName', 'Enabled', 'Disabled', 'FrequencyType', 'FrequencyInterval', 'FrequencySubdayType', 'FrequencySubdayInterval', 'FrequencyRelativeInterval', 'FrequencyRecurrenceFactor', 'StartDate', 'EndDate', 'StartTime', 'EndTime', 'EnableException', 'Force' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaAvailabilityGroup.Tests.ps1 b/tests/Set-DbaAvailabilityGroup.Tests.ps1 index 214791702d..4d78498490 100644 --- a/tests/Set-DbaAvailabilityGroup.Tests.ps1 +++ b/tests/Set-DbaAvailabilityGroup.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaAvailabilityGroup).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'AllAvailabilityGroups', 'DtcSupportEnabled', 'ClusterType', 'AutomatedBackupPreference', 'FailureConditionLevel', 'HealthCheckTimeout', 'BasicAvailabilityGroup', 'DatabaseHealthTrigger', 'IsDistributedAvailabilityGroup', 'InputObject', 'EnableException' @@ -41,4 +41,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.DtcSupportEnabled | Should -Be $true } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Set-DbaCmConnection.Tests.ps1 b/tests/Set-DbaCmConnection.Tests.ps1 index bc9c18541a..81842084a7 100644 --- a/tests/Set-DbaCmConnection.Tests.ps1 +++ b/tests/Set-DbaCmConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 21 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaCmConnection).Parameters.Keys - $knownParameters = 'ComputerName','Credential','UseWindowsCredentials','OverrideExplicitCredential','OverrideConnectionPolicy','DisabledConnectionTypes','DisableBadCredentialCache','DisableCimPersistence','DisableCredentialAutoRegister','EnableCredentialFailover','WindowsCredentialsAreBad','CimWinRMOptions','CimDCOMOptions','AddBadCredential','RemoveBadCredential','ClearBadCredential','ClearCredential','ResetCredential','ResetConnectionStatus','ResetConfiguration','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'UseWindowsCredentials', 'OverrideExplicitCredential', 'OverrideConnectionPolicy', 'DisabledConnectionTypes', 'DisableBadCredentialCache', 'DisableCimPersistence', 'DisableCredentialAutoRegister', 'EnableCredentialFailover', 'WindowsCredentialsAreBad', 'CimWinRMOptions', 'CimDCOMOptions', 'AddBadCredential', 'RemoveBadCredential', 'ClearBadCredential', 'ClearCredential', 'ResetCredential', 'ResetConnectionStatus', 'ResetConfiguration', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaDbCompression.Tests.ps1 b/tests/Set-DbaDbCompression.Tests.ps1 index 331261b334..0802106cb2 100644 --- a/tests/Set-DbaDbCompression.Tests.ps1 +++ b/tests/Set-DbaDbCompression.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaDbCompression).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential','Database','ExcludeDatabase','CompressionType','MaxRunTime','PercentCompression','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'CompressionType', 'MaxRunTime', 'PercentCompression', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,8 +25,8 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $null = $server.Query("select * into syscols from sys.all_columns select * into sysallparams from sys.all_parameters create clustered index CL_sysallparams on sysallparams (object_id) - create nonclustered index NC_syscols on syscols (precision) include (collation_name)",$dbname) - } + create nonclustered index NC_syscols on syscols (precision) include (collation_name)", $dbname) + } AfterAll { Get-DbaProcess -SqlInstance $script:instance2 -Database $dbname | Stop-DbaProcess -WarningAction SilentlyContinue Remove-DbaDatabase -SqlInstance $script:instance2 -Database $dbname -Confirm:$false @@ -40,14 +40,14 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } Context "Command handles heaps and clustered indexes" { - foreach ($row in $results | Where-Object {$_.IndexId -le 1}){ + foreach ($row in $results | Where-Object {$_.IndexId -le 1}) { It "Should process object $($row.TableName)" { $row.AlreadyProcessed | Should Be $True } } } Context "Command handles nonclustered indexes" { - foreach ($row in $results | Where-Object {$_.IndexId -gt 1}){ + foreach ($row in $results | Where-Object {$_.IndexId -gt 1}) { It "Should process nonclustered index $($row.IndexName)" { $row.AlreadyProcessed | Should Be $True } @@ -98,5 +98,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } } -} - +} \ No newline at end of file diff --git a/tests/Set-DbaDbMirror.Tests.ps1 b/tests/Set-DbaDbMirror.Tests.ps1 index 22cd3c1221..c6e3e7b175 100644 --- a/tests/Set-DbaDbMirror.Tests.ps1 +++ b/tests/Set-DbaDbMirror.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaDbMirror).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Partner','Witness','SafetyLevel','State','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Partner', 'Witness', 'SafetyLevel', 'State', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaDbOwner.Tests.ps1 b/tests/Set-DbaDbOwner.Tests.ps1 index ff6dd1f766..7acf8e8c27 100644 --- a/tests/Set-DbaDbOwner.Tests.ps1 +++ b/tests/Set-DbaDbOwner.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaDbOwner).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','TargetLogin','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'TargetLogin', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaDbQueryStoreOption.Tests.ps1 b/tests/Set-DbaDbQueryStoreOption.Tests.ps1 index 47cb70b1a8..6f71365507 100644 --- a/tests/Set-DbaDbQueryStoreOption.Tests.ps1 +++ b/tests/Set-DbaDbQueryStoreOption.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaDbQueryStoreOption).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','AllDatabases','State','FlushInterval','CollectionInterval','MaxSize','CaptureMode','CleanupMode','StaleQueryThreshold','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'AllDatabases', 'State', 'FlushInterval', 'CollectionInterval', 'MaxSize', 'CaptureMode', 'CleanupMode', 'StaleQueryThreshold', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -30,8 +30,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { It "should warn" { $warning | Should Not Be $null } - } - else { + } else { It "should return some valid results" { $result = $results | Where-Object Database -eq msdb $result.ActualState | Should Be 'Off' @@ -59,4 +58,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaDbRecoveryModel.Tests.ps1 b/tests/Set-DbaDbRecoveryModel.Tests.ps1 index 72d9925b92..bf17b7c076 100644 --- a/tests/Set-DbaDbRecoveryModel.Tests.ps1 +++ b/tests/Set-DbaDbRecoveryModel.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaDbRecoveryModel).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','RecoveryModel','Database','ExcludeDatabase','AllDatabases','EnableException','InputObject' + $knownParameters = 'SqlInstance', 'SqlCredential', 'RecoveryModel', 'Database', 'ExcludeDatabase', 'AllDatabases', 'EnableException', 'InputObject' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -46,4 +46,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaDbState.Tests.ps1 b/tests/Set-DbaDbState.Tests.ps1 index c784924243..c1d0a7bd6a 100644 --- a/tests/Set-DbaDbState.Tests.ps1 +++ b/tests/Set-DbaDbState.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 17 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaDbState).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','AllDatabases','ReadOnly','ReadWrite','Online','Offline','Emergency','Detached','SingleUser','RestrictedUser','MultiUser','Force','EnableException','InputObject' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'AllDatabases', 'ReadOnly', 'ReadWrite', 'Online', 'Offline', 'Emergency', 'Detached', 'SingleUser', 'RestrictedUser', 'MultiUser', 'Force', 'EnableException', 'InputObject' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -187,4 +187,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaEndpoint.Tests.ps1 b/tests/Set-DbaEndpoint.Tests.ps1 index af4f75597b..7da22720ea 100644 --- a/tests/Set-DbaEndpoint.Tests.ps1 +++ b/tests/Set-DbaEndpoint.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaEndpoint).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'Owner', 'Type', 'Endpoint', 'AllEndpoints', 'InputObject', 'EnableException' @@ -19,4 +19,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaErrorLogConfig.Tests.ps1 b/tests/Set-DbaErrorLogConfig.Tests.ps1 index 02f828a114..3b3d6129f7 100644 --- a/tests/Set-DbaErrorLogConfig.Tests.ps1 +++ b/tests/Set-DbaErrorLogConfig.Tests.ps1 @@ -65,4 +65,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $warn2 | Should Match 'not supported' } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaJobOwner.Tests.ps1 b/tests/Set-DbaJobOwner.Tests.ps1 index 750c23654c..e1845d163e 100644 --- a/tests/Set-DbaJobOwner.Tests.ps1 +++ b/tests/Set-DbaJobOwner.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaJobOwner).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','ExcludeJob','Login','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'ExcludeJob', 'Login', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaLogin.Tests.ps1 b/tests/Set-DbaLogin.Tests.ps1 index a3bf3e7a37..b5b9119b7b 100644 --- a/tests/Set-DbaLogin.Tests.ps1 +++ b/tests/Set-DbaLogin.Tests.ps1 @@ -171,5 +171,4 @@ Describe "$CommandName Integration Tests" -Tag 'IntegrationTests' { Remove-DbaLogin -SqlInstance $script:instance2 -Login testlogin -Confirm:$false -Force } } -} - +} \ No newline at end of file diff --git a/tests/Set-DbaMaxDop.Tests.ps1 b/tests/Set-DbaMaxDop.Tests.ps1 index 3fd66c8ba1..80a42dda97 100644 --- a/tests/Set-DbaMaxDop.Tests.ps1 +++ b/tests/Set-DbaMaxDop.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$commandname Unit Tests" -Tag "UnitTests", Set-DbaMaxDop { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -34,10 +33,10 @@ Describe "$commandname Unit Tests" -Tag "UnitTests", Set-DbaMaxDop { } It "Validates that Stop Function Mock has been called" { $assertMockParams = @{ - 'CommandName' = 'Stop-Function' - 'Times' = 1 - 'Exactly' = $true - 'Module' = 'dbatools' + 'CommandName' = 'Stop-Function' + 'Times' = 1 + 'Exactly' = $true + 'Module' = 'dbatools' } Assert-MockCalled @assertMockParams } diff --git a/tests/Set-DbaMaxMemory.Tests.ps1 b/tests/Set-DbaMaxMemory.Tests.ps1 index 1a1cf13437..af2bd44c3a 100644 --- a/tests/Set-DbaMaxMemory.Tests.ps1 +++ b/tests/Set-DbaMaxMemory.Tests.ps1 @@ -9,8 +9,7 @@ Describe "$CommandName Unit Tests" -Tags "UnitTests" { $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -32,8 +31,8 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $inst2CurrentMaxValue = (Get-DbaMaxMemory -SqlInstance $script:instance2).MaxValue } AfterAll { - $null = Set-DbaMaxMemory -SqlInstance $script:instance1 -Max $inst1CurrentMaxValue - $null = Set-DbaMaxMemory -SqlInstance $script:instance2 -Max $inst2CurrentMaxValue + $null = Set-DbaMaxMemory -SqlInstance $script:instance1 -Max $inst1CurrentMaxValue + $null = Set-DbaMaxMemory -SqlInstance $script:instance2 -Max $inst2CurrentMaxValue } Context "Connects to multiple instances" { $results = Set-DbaMaxMemory -SqlInstance $script:instance1, $script:instance2 -Max 1024 diff --git a/tests/Set-DbaNetworkCertificate.Tests.ps1 b/tests/Set-DbaNetworkCertificate.Tests.ps1 index 23fb5cc785..b490f852c9 100644 --- a/tests/Set-DbaNetworkCertificate.Tests.ps1 +++ b/tests/Set-DbaNetworkCertificate.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaNetworkCertificate).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','Certificate','Thumbprint','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'Certificate', 'Thumbprint', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaPowerPlan.Tests.ps1 b/tests/Set-DbaPowerPlan.Tests.ps1 index 955f658cce..95b8c93038 100644 --- a/tests/Set-DbaPowerPlan.Tests.ps1 +++ b/tests/Set-DbaPowerPlan.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Context "Validate parameters" { - $knownParameters = 'ComputerName', 'Credential','PowerPlan','CustomPowerPlan','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'PowerPlan', 'CustomPowerPlan', 'EnableException' $paramCount = $knownParameters.Count $SupportShouldProcess = $true if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -57,5 +56,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.ActivePowerPlan -eq 'Balanced' | Should Be $true } } -} - +} \ No newline at end of file diff --git a/tests/Set-DbaPrivilege.Tests.ps1 b/tests/Set-DbaPrivilege.Tests.ps1 index 9fa5948d6d..eebe6041e5 100644 --- a/tests/Set-DbaPrivilege.Tests.ps1 +++ b/tests/Set-DbaPrivilege.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaPrivilege).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Type','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Type', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaSpConfigure.Tests.ps1 b/tests/Set-DbaSpConfigure.Tests.ps1 index 2ff90d9a15..c700e25cf9 100644 --- a/tests/Set-DbaSpConfigure.Tests.ps1 +++ b/tests/Set-DbaSpConfigure.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaSpConfigure).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Value','Name','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Value', 'Name', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -46,4 +46,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $warning -match "existing" | Should be $true } } -} +} \ No newline at end of file diff --git a/tests/Set-DbaSpn.Tests.ps1 b/tests/Set-DbaSpn.Tests.ps1 index 2d2b2f09e4..2d0c79393a 100644 --- a/tests/Set-DbaSpn.Tests.ps1 +++ b/tests/Set-DbaSpn.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaSpn).Parameters.Keys - $knownParameters = 'SPN','ServiceAccount','Credential','NoDelegation','EnableException' + $knownParameters = 'SPN', 'ServiceAccount', 'Credential', 'NoDelegation', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaStartupParameter.Tests.ps1 b/tests/Set-DbaStartupParameter.Tests.ps1 index 43d0ba498c..5f3d1f8623 100644 --- a/tests/Set-DbaStartupParameter.Tests.ps1 +++ b/tests/Set-DbaStartupParameter.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 21 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaStartupParameter).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Credential','MasterData','MasterLog','ErrorLog','TraceFlags','CommandPromptStart','MinimalStart','MemoryToReserve','SingleUser','SingleUserDetails','NoLoggingToWinEvents','StartAsNamedInstance','DisableMonitoring','IncreasedExtents','TraceFlagsOverride','StartUpConfig','Offline','Force','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Credential', 'MasterData', 'MasterLog', 'ErrorLog', 'TraceFlags', 'CommandPromptStart', 'MinimalStart', 'MemoryToReserve', 'SingleUser', 'SingleUserDetails', 'NoLoggingToWinEvents', 'StartAsNamedInstance', 'DisableMonitoring', 'IncreasedExtents', 'TraceFlagsOverride', 'StartUpConfig', 'Offline', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaTcpPort.Tests.ps1 b/tests/Set-DbaTcpPort.Tests.ps1 index 33c56bf123..c998419ee2 100644 --- a/tests/Set-DbaTcpPort.Tests.ps1 +++ b/tests/Set-DbaTcpPort.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaTcpPort).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','Port','IpAddress','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'Port', 'IpAddress', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbaTempDbConfig.Tests.ps1 b/tests/Set-DbaTempDbConfig.Tests.ps1 index eeb366aa16..dba66c5187 100644 --- a/tests/Set-DbaTempDbConfig.Tests.ps1 +++ b/tests/Set-DbaTempDbConfig.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Set-DbaTempDbConfig).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','DataFileCount','DataFileSizeMB','LogFileSizeMB','DataFileGrowthMB','LogFileGrowthMB','DataPath','LogPath','OutFile','OutputScriptOnly','DisableGrowth','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'DataFileCount', 'DataFileSizeMB', 'LogFileSizeMB', 'DataFileGrowthMB', 'LogFileGrowthMB', 'DataPath', 'LogPath', 'OutFile', 'OutputScriptOnly', 'DisableGrowth', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Set-DbatoolsConfig.Tests.ps1 b/tests/Set-DbatoolsConfig.Tests.ps1 index fc6a578949..735b666517 100644 --- a/tests/Set-DbatoolsConfig.Tests.ps1 +++ b/tests/Set-DbatoolsConfig.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 13 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Set-DbatoolsConfig).Parameters.Keys - $knownParameters = 'FullName','Name','Module','Value','Description','Validation','Handler','Hidden','Default','Initialize','DisableValidation','DisableHandler','EnableException' + $knownParameters = 'FullName', 'Name', 'Module', 'Value', 'Description', 'Validation', 'Handler', 'Hidden', 'Default', 'Initialize', 'DisableValidation', 'DisableHandler', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Show-DbaDbList.Tests.ps1 b/tests/Show-DbaDbList.Tests.ps1 index dc7cddeace..c46f0de4f9 100644 --- a/tests/Show-DbaDbList.Tests.ps1 +++ b/tests/Show-DbaDbList.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Show-DbaDbList).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Title','Header','DefaultDb' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Title', 'Header', 'DefaultDb' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Show-DbaServerFileSystem.Tests.ps1 b/tests/Show-DbaServerFileSystem.Tests.ps1 index b5f757ce32..8a6767e548 100644 --- a/tests/Show-DbaServerFileSystem.Tests.ps1 +++ b/tests/Show-DbaServerFileSystem.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Show-DbaServerFileSystem).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Start-DbaAgentJob.Tests.ps1 b/tests/Start-DbaAgentJob.Tests.ps1 index d6cc67c366..f4f7ea7309 100644 --- a/tests/Start-DbaAgentJob.Tests.ps1 +++ b/tests/Start-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaAgentJob).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','ExcludeJob','InputObject','AllJobs','Wait','WaitPeriod','SleepPeriod','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'ExcludeJob', 'InputObject', 'AllJobs', 'Wait', 'WaitPeriod', 'SleepPeriod', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -27,4 +27,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $null = Start-DbaAgentJob -SqlInstance $script:instance2 -WarningAction SilentlyContinue -WarningVariable warn $warn -match 'use one of the job' | Should Be $true } -} +} \ No newline at end of file diff --git a/tests/Start-DbaEndpoint.Tests.ps1 b/tests/Start-DbaEndpoint.Tests.ps1 index a75a1c54a3..809792d3aa 100644 --- a/tests/Start-DbaEndpoint.Tests.ps1 +++ b/tests/Start-DbaEndpoint.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SqlInstance','SqlCredential', 'EndPoint', 'AllEndpoints', 'InputObject', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EndPoint', 'AllEndpoints', 'InputObject', 'EnableException' $SupportShouldProcess = $true $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -36,4 +35,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = $endpoint | Start-DbaEndpoint -Confirm:$false $results.EndpointState | Should -Be 'Started' } -} +} \ No newline at end of file diff --git a/tests/Start-DbaMigration.Tests.ps1 b/tests/Start-DbaMigration.Tests.ps1 index 25e4087e8c..806ee83cf0 100644 --- a/tests/Start-DbaMigration.Tests.ps1 +++ b/tests/Start-DbaMigration.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 39 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaMigration).Parameters.Keys - $knownParameters = 'Source','Destination','DetachAttach','Reattach','BackupRestore','NetworkShare','WithReplace','NoRecovery','SetSourceReadOnly','ReuseSourceFolderStructure','IncludeSupportDbs','SourceSqlCredential','DestinationSqlCredential','NoDatabases','NoLogins','NoAgentServer','NoCredentials','NoLinkedServers','NoSpConfigure','NoCentralManagementServer','NoDatabaseMail','NoSysDbUserObjects','NoSystemTriggers','NoBackupDevices','NoAudits','NoEndpoints','NoExtendedEvents','NoPolicyManagement','NoResourceGovernor','NoServerAuditSpecifications','NoCustomErrors','NoDataCollector','DisableJobsOnDestination','DisableJobsOnSource','NoSaRename','UseLastBackups','Continue','Force','EnableException' + $knownParameters = 'Source', 'Destination', 'DetachAttach', 'Reattach', 'BackupRestore', 'NetworkShare', 'WithReplace', 'NoRecovery', 'SetSourceReadOnly', 'ReuseSourceFolderStructure', 'IncludeSupportDbs', 'SourceSqlCredential', 'DestinationSqlCredential', 'NoDatabases', 'NoLogins', 'NoAgentServer', 'NoCredentials', 'NoLinkedServers', 'NoSpConfigure', 'NoCentralManagementServer', 'NoDatabaseMail', 'NoSysDbUserObjects', 'NoSystemTriggers', 'NoBackupDevices', 'NoAudits', 'NoEndpoints', 'NoExtendedEvents', 'NoPolicyManagement', 'NoResourceGovernor', 'NoServerAuditSpecifications', 'NoCustomErrors', 'NoDataCollector', 'DisableJobsOnDestination', 'DisableJobsOnSource', 'NoSaRename', 'UseLastBackups', 'Continue', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Start-DbaPfDataCollectorSet.Tests.ps1 b/tests/Start-DbaPfDataCollectorSet.Tests.ps1 index 8ef33096c8..62796e200e 100644 --- a/tests/Start-DbaPfDataCollectorSet.Tests.ps1 +++ b/tests/Start-DbaPfDataCollectorSet.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaPfDataCollectorSet).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','InputObject','NoWait','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'InputObject', 'NoWait', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Start-DbaService.Tests.ps1 b/tests/Start-DbaService.Tests.ps1 index 5409ecec2a..f9178f7f48 100644 --- a/tests/Start-DbaService.Tests.ps1 +++ b/tests/Start-DbaService.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaService).Parameters.Keys - $knownParameters = 'ComputerName','InstanceName','Type','InputObject','Timeout','Credential','EnableException' + $knownParameters = 'ComputerName', 'InstanceName', 'Type', 'InputObject', 'Timeout', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -29,8 +29,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { #Stop services using native cmdlets if ($instanceName -eq 'MSSQLSERVER') { $serviceName = "SQLSERVERAGENT" - } - else { + } else { $serviceName = "SqlAgent`$$instanceName" } Get-Service -ComputerName $computerName -Name $serviceName | Stop-Service -WarningAction SilentlyContinue | Out-Null @@ -47,8 +46,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { #Stop services using native cmdlets if ($instanceName -eq 'MSSQLSERVER') { $serviceName = "SQLSERVERAGENT", "MSSQLSERVER" - } - else { + } else { $serviceName = "SqlAgent`$$instanceName", "MsSql`$$instanceName" } foreach ($sn in $servicename) { Get-Service -ComputerName $computerName -Name $sn | Stop-Service -WarningAction SilentlyContinue | Out-Null } @@ -66,4 +64,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { { Start-DbaService -ComputerName $script:instance2 -Type 'Agent' -InstanceName 'ThisIsInvalid' -EnableException } | Should Throw 'No services found in relevant namespaces' } } -} +} \ No newline at end of file diff --git a/tests/Start-DbaTrace.Tests.ps1 b/tests/Start-DbaTrace.Tests.ps1 index 6100d63ec0..644aef95fd 100644 --- a/tests/Start-DbaTrace.Tests.ps1 +++ b/tests/Start-DbaTrace.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaTrace).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Id','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Id', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -116,4 +116,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.IsRunning | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Start-DbaXESession.Tests.ps1 b/tests/Start-DbaXESession.Tests.ps1 index 029ee44b12..20d8456528 100644 --- a/tests/Start-DbaXESession.Tests.ps1 +++ b/tests/Start-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaXESession).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','StopAt','AllSessions','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'StopAt', 'AllSessions', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -38,7 +38,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if ($systemhealth.IsRunning) { $systemhealth.Stop() } - #> + #> $systemhealth | Stop-DbaXESession #-ErrorAction SilentlyContinue } AfterAll { @@ -49,8 +49,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if ($session.IsRunning) { $session.Stop() } - } - else { + } else { if (-Not $session.IsRunning) { $session.Start() } @@ -96,4 +95,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } -} +} \ No newline at end of file diff --git a/tests/Start-DbaXESmartTarget.Tests.ps1 b/tests/Start-DbaXESmartTarget.Tests.ps1 index d2c6828df3..27b5361136 100644 --- a/tests/Start-DbaXESmartTarget.Tests.ps1 +++ b/tests/Start-DbaXESmartTarget.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Start-DbaXESmartTarget).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','Session','FailOnProcessingError','Responder','Template','NotAsJob','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Session', 'FailOnProcessingError', 'Responder', 'Template', 'NotAsJob', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Stop-DbaAgentJob.Tests.ps1 b/tests/Stop-DbaAgentJob.Tests.ps1 index f9b5c39dfb..81be3d6512 100644 --- a/tests/Stop-DbaAgentJob.Tests.ps1 +++ b/tests/Stop-DbaAgentJob.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaAgentJob).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Job','ExcludeJob','InputObject','Wait','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Job', 'ExcludeJob', 'InputObject', 'Wait', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.CurrentRunStatus -eq 'Idle' | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaEndpoint.Tests.ps1 b/tests/Stop-DbaEndpoint.Tests.ps1 index fe66fac652..7580aad1a8 100644 --- a/tests/Stop-DbaEndpoint.Tests.ps1 +++ b/tests/Stop-DbaEndpoint.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SqlInstance','SqlCredential', 'EndPoint', 'AllEndpoints', 'InputObject', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EndPoint', 'AllEndpoints', 'InputObject', 'EnableException' $SupportShouldProcess = $true $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -36,4 +35,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = $endpoint | Stop-DbaEndpoint -Confirm:$false $results.EndpointState | Should -Be 'Stopped' } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 b/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 index 66949e496e..c7ba5973d6 100644 --- a/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 +++ b/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaPfDataCollectorSet).Parameters.Keys - $knownParameters = 'ComputerName','Credential','CollectorSet','InputObject','NoWait','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'CollectorSet', 'InputObject', 'NoWait', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaProcess.Tests.ps1 b/tests/Stop-DbaProcess.Tests.ps1 index 3bc85d7ef4..bc7599e4a3 100644 --- a/tests/Stop-DbaProcess.Tests.ps1 +++ b/tests/Stop-DbaProcess.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaProcess).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Spid','ExcludeSpid','Database','Login','Hostname','Program','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Spid', 'ExcludeSpid', 'Database', 'Login', 'Hostname', 'Program', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.Status | Should -Be 'Killed' } } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaService.Tests.ps1 b/tests/Stop-DbaService.Tests.ps1 index 385658e28f..c72a489b45 100644 --- a/tests/Stop-DbaService.Tests.ps1 +++ b/tests/Stop-DbaService.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 8 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaService).Parameters.Keys - $knownParameters = 'ComputerName','InstanceName','Type','InputObject','Timeout','Credential','Force','EnableException' + $knownParameters = 'ComputerName', 'InstanceName', 'Type', 'InputObject', 'Timeout', 'Credential', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -38,8 +38,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { #Start services using native cmdlets if ($instanceName -eq 'MSSQLSERVER') { $serviceName = "SQLSERVERAGENT" - } - else { + } else { $serviceName = "SqlAgent`$$instanceName" } Get-Service -ComputerName $computerName -Name $serviceName | Start-Service -WarningAction SilentlyContinue | Out-Null @@ -56,11 +55,10 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { #Start services using native cmdlets if ($instanceName -eq 'MSSQLSERVER') { $serviceName = "MSSQLSERVER", "SQLSERVERAGENT" - } - else { + } else { $serviceName = "MsSql`$$instanceName", "SqlAgent`$$instanceName" } foreach ($sn in $servicename) { Get-Service -ComputerName $computerName -Name $sn | Start-Service -WarningAction SilentlyContinue | Out-Null } } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaTrace.Tests.ps1 b/tests/Stop-DbaTrace.Tests.ps1 index e60e148b25..d9fb2f5ce4 100644 --- a/tests/Stop-DbaTrace.Tests.ps1 +++ b/tests/Stop-DbaTrace.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaTrace).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Id','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Id', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -116,4 +116,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.IsRunning | Should Be $false } } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaXESession.Tests.ps1 b/tests/Stop-DbaXESession.Tests.ps1 index ebfea45446..1a433f44a4 100644 --- a/tests/Stop-DbaXESession.Tests.ps1 +++ b/tests/Stop-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaXESession).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','AllSessions','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'AllSessions', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -44,8 +44,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if ($session.IsRunning) { $session.Stop() } - } - else { + } else { if (-Not $session.IsRunning) { $session.Start() } @@ -80,4 +79,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $dbatoolsciValid.IsRunning | Should Be $false } } -} +} \ No newline at end of file diff --git a/tests/Stop-DbaXESmartTarget.Tests.ps1 b/tests/Stop-DbaXESmartTarget.Tests.ps1 index b9b8bb7be4..33f7200aec 100644 --- a/tests/Stop-DbaXESmartTarget.Tests.ps1 +++ b/tests/Stop-DbaXESmartTarget.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Stop-DbaXESmartTarget).Parameters.Keys - $knownParameters = 'InputObject','EnableException' + $knownParameters = 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Stop-Function.Tests.ps1 b/tests/Stop-Function.Tests.ps1 index 71228e1577..4a3ce5f81e 100644 --- a/tests/Stop-Function.Tests.ps1 +++ b/tests/Stop-Function.Tests.ps1 @@ -9,7 +9,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 14 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Stop-Function).Parameters.Keys - $knownParameters = 'Message','Category','ErrorRecord','Tag','FunctionName','File','Line','Target','Exception','OverrideExceptionMessage','Continue','SilentlyContinue','ContinueLabel','EnableException' + $knownParameters = 'Message', 'Category', 'ErrorRecord', 'Tag', 'FunctionName', 'File', 'Line', 'Target', 'Exception', 'OverrideExceptionMessage', 'Continue', 'SilentlyContinue', 'ContinueLabel', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,8 +23,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $warning = Stop-Function -WarningAction Continue -Message "Nonsilent Foo" -EnableException $false -Category InvalidResult -FunctionName "Invoke-Pester" -Target "Bar" -ErrorAction Stop 3>&1 $record = $Error[0] $failed = $false - } - catch { + } catch { $record = $null $failed = $true } @@ -58,14 +57,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { try { try { $null.GetType() - } - catch { + } catch { $warning = Stop-Function -WarningAction Continue -Message "Nonsilent Foo" -EnableException $false -ErrorRecord $_ -FunctionName "Invoke-Pester" -Target "Bar" -ErrorAction Stop 3>&1 $record = $Error[0] $failed = $false } - } - catch { + } catch { $record = $null $failed = $true } @@ -97,8 +94,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { It "Should have created an error record with the an inner NULL-invocation exception" { try { $ExceptionName = $record.Exception.InnerException.GetType().FullName - } - catch { + } catch { $ExceptionName = "Meeep!" } @@ -119,8 +115,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Stop-Function -Message "Nonsilent Foo" -EnableException $false -Category InvalidOperation -Continue -ErrorAction Stop 3>&1 $b++ } - } - catch { + } catch { $failed = $true } @@ -140,8 +135,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } $f++ } - } - catch { + } catch { $failed2 = $true } #endregion Run Tests @@ -176,8 +170,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Stop-Function -Message "Nonsilent Foo" -EnableException $true -Category InvalidResult -FunctionName "Invoke-Pester" -Target "Bar" -ErrorAction Stop $record = $null $failed = $false - } - catch { + } catch { $record = $_ $failed = $true } @@ -207,14 +200,12 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { try { try { $null.GetType() - } - catch { + } catch { Stop-Function -Message "Nonsilent Foo" -EnableException $true -ErrorRecord $_ -FunctionName "Invoke-Pester" -Target "Bar" -ErrorAction Stop $record = $null $failed = $false } - } - catch { + } catch { $record = $_ $failed = $true } @@ -253,8 +244,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Stop-Function -Message "Nonsilent Foo" -EnableException $true -Category InvalidOperation -SilentlyContinue -ErrorAction Stop $b++ } - } - catch { + } catch { $failed = $true } @@ -274,8 +264,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } $f++ } - } - catch { + } catch { $failed2 = $true } #endregion Run Tests @@ -305,5 +294,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { #endregion Evaluate Results } } -$PSDefaultParameterValues['*:WarningAction'] = 'SilentlyContinue' - +$PSDefaultParameterValues['*:WarningAction'] = 'SilentlyContinue' \ No newline at end of file diff --git a/tests/Suspend-DbaAgDbDataMovement.Tests.ps1 b/tests/Suspend-DbaAgDbDataMovement.Tests.ps1 index 7f3ed30e56..d8f73083ff 100644 --- a/tests/Suspend-DbaAgDbDataMovement.Tests.ps1 +++ b/tests/Suspend-DbaAgDbDataMovement.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Suspend-DbaAgDbDataMovement).Parameters.Keys $knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'Database', 'InputObject', 'EnableException' @@ -45,4 +45,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.SynchronizationState | Should -Be 'NotSynchronizing' } } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Sync-DbaLoginPermission.Tests.ps1 b/tests/Sync-DbaLoginPermission.Tests.ps1 index b400908144..603561c4f9 100644 --- a/tests/Sync-DbaLoginPermission.Tests.ps1 +++ b/tests/Sync-DbaLoginPermission.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Sync-DbaLoginPermission).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Login','ExcludeLogin','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Login', 'ExcludeLogin', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -18,10 +18,10 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { } Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { - BeforeAll{ + BeforeAll { $tempguid = [guid]::newguid(); $DBUserName = "dbatoolssci_$($tempguid.guid)" -$CreateTestUser = @" + $CreateTestUser = @" CREATE LOGIN [$DBUserName] WITH PASSWORD = '$($tempguid.guid)'; USE Master; @@ -31,15 +31,15 @@ GRANT VIEW ANY DEFINITION to [$DBUserName]; "@ Invoke-DbaQuery -SqlInstance $script:instance2 -Query $CreateTestUser -Database master -#This is used later in the test -$CreateTestLogin = @" + #This is used later in the test + $CreateTestLogin = @" CREATE LOGIN [$DBUserName] WITH PASSWORD = '$($tempguid.guid)'; "@ } - AfterAll{ + AfterAll { $DropTestUser = "DROP LOGIN [$DBUserName]" - Invoke-DbaQuery -SqlInstance $script:instance2,$script:instance3 -Query $DropTestUser -Database master + Invoke-DbaQuery -SqlInstance $script:instance2, $script:instance3 -Query $DropTestUser -Database master } Context "Verifying command output" { @@ -62,4 +62,4 @@ CREATE LOGIN [$DBUserName] $permissionsAfter.member | Should -Be $DBUserName } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaBackupInformation.Tests.ps1 b/tests/Test-DbaBackupInformation.Tests.ps1 index 5d9922ebc3..d71ed0e7ef 100644 --- a/tests/Test-DbaBackupInformation.Tests.ps1 +++ b/tests/Test-DbaBackupInformation.Tests.ps1 @@ -24,9 +24,9 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { param($query) if ($query -eq "SELECT DB_NAME(database_id) AS Name, physical_name AS PhysicalName FROM sys.master_files") { return @( - @{ "Name" = "master" - "PhysicalName" = "C:\temp\master.mdf" - } + @{ "Name" = "master" + "PhysicalName" = "C:\temp\master.mdf" + } ) } } @@ -70,9 +70,9 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { param($query) if ($query -eq "SELECT DB_NAME(database_id) AS Name, physical_name AS PhysicalName FROM sys.master_files") { return @( - @{ "Name" = "master" - "PhysicalName" = "C:\temp\master.mdf" - } + @{ "Name" = "master" + "PhysicalName" = "C:\temp\master.mdf" + } ) } } @@ -116,9 +116,9 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { param($query) if ($query -eq "SELECT DB_NAME(database_id) AS Name, physical_name AS PhysicalName FROM sys.master_files") { return @( - @{ "Name" = "master" - "PhysicalName" = "C:\temp\master.mdf" - } + @{ "Name" = "master" + "PhysicalName" = "C:\temp\master.mdf" + } ) } } @@ -162,9 +162,9 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { param($query) if ($query -eq "SELECT DB_NAME(database_id) AS Name, physical_name AS PhysicalName FROM sys.master_files") { return @( - @{ "Name" = "master" - "PhysicalName" = "C:\temp\master.mdf" - } + @{ "Name" = "master" + "PhysicalName" = "C:\temp\master.mdf" + } ) } } @@ -208,9 +208,9 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { param($query) if ($query -eq "SELECT DB_NAME(database_id) AS Name, physical_name AS PhysicalName FROM sys.master_files") { return @( - @{ "Name" = "master" - "PhysicalName" = "C:\temp\master.mdf" - } + @{ "Name" = "master" + "PhysicalName" = "C:\temp\master.mdf" + } ) } } @@ -234,4 +234,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaBuild.Tests.ps1 b/tests/Test-DbaBuild.Tests.ps1 index d48173c4f3..42af41df9f 100644 --- a/tests/Test-DbaBuild.Tests.ps1 +++ b/tests/Test-DbaBuild.Tests.ps1 @@ -10,11 +10,11 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 9 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaBuild).Parameters.Keys - $knownParameters = 'Build','MinimumBuild','MaxBehind','Latest','SqlInstance','SqlCredential','Update','Quiet','EnableException' + $knownParameters = 'Build', 'MinimumBuild', 'MaxBehind', 'Latest', 'SqlInstance', 'SqlCredential', 'Update', 'Quiet', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaCmConnection.Tests.ps1 b/tests/Test-DbaCmConnection.Tests.ps1 index e24d9b5118..0d35ba8495 100644 --- a/tests/Test-DbaCmConnection.Tests.ps1 +++ b/tests/Test-DbaCmConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaCmConnection).Parameters.Keys - $knownParameters = 'ComputerName','Credential','Type','Force','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'Type', 'Force', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,4 +23,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.ComputerName -eq $env:COMPUTERNAME $results.Available -is [bool] } -} +} \ No newline at end of file diff --git a/tests/Test-DbaConnection.Tests.ps1 b/tests/Test-DbaConnection.Tests.ps1 index a256b2be0f..47d8fa4660 100644 --- a/tests/Test-DbaConnection.Tests.ps1 +++ b/tests/Test-DbaConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 4 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaConnection).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.ConnectingAsUser -eq $whoami | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaConnectionAuthScheme.Tests.ps1 b/tests/Test-DbaConnectionAuthScheme.Tests.ps1 index a95f9b9f75..48a13f679d 100644 --- a/tests/Test-DbaConnectionAuthScheme.Tests.ps1 +++ b/tests/Test-DbaConnectionAuthScheme.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaConnectionAuthScheme).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Kerberos','Ntlm','Detailed','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Kerberos', 'Ntlm', 'Detailed', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -24,4 +24,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.AuthScheme | Should Be 'ntlm' } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDbCollation.Tests.ps1 b/tests/Test-DbaDbCollation.Tests.ps1 index 6f524d2c9c..eb1524d974 100644 --- a/tests/Test-DbaDbCollation.Tests.ps1 +++ b/tests/Test-DbaDbCollation.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDbCollation).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Detailed','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Detailed', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $result.IsEqual } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDbCompatibility.Tests.ps1 b/tests/Test-DbaDbCompatibility.Tests.ps1 index 5fa219b552..0cf5b2bdad 100644 --- a/tests/Test-DbaDbCompatibility.Tests.ps1 +++ b/tests/Test-DbaDbCompatibility.Tests.ps1 @@ -10,11 +10,11 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDbCompatibility).Parameters.Keys - $knownParameters = 'SqlInstance','Credential','Database','ExcludeDatabase','Detailed','EnableException' + $knownParameters = 'SqlInstance', 'Credential', 'Database', 'ExcludeDatabase', 'Detailed', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -40,4 +40,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDbCompression.Tests.ps1 b/tests/Test-DbaDbCompression.Tests.ps1 index d23c0d21c1..b73e784098 100644 --- a/tests/Test-DbaDbCompression.Tests.ps1 +++ b/tests/Test-DbaDbCompression.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 10 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDbCompression).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential','Database','ExcludeDatabase','Schema','Table','ResultSize','Rank','FilterBy', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Schema', 'Table', 'ResultSize', 'Rank', 'FilterBy', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -23,14 +23,14 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $dbname = "dbatoolsci_test_$(get-random)" $server = Connect-DbaInstance -SqlInstance $script:instance2 $null = $server.Query("Create Database [$dbname]") - $null = $server.Query("Create Schema test",$dbname) + $null = $server.Query("Create Schema test", $dbname) $null = $server.Query(" select * into syscols from sys.all_columns select * into test.sysallparams from sys.all_parameters create clustered index CL_sysallparams on test.sysallparams (object_id) create nonclustered index NC_syscols on syscols (precision) include (collation_name) update test.sysallparams set is_xml_document = 1 where name = '@dbname' - ",$dbname) - } + ", $dbname) + } AfterAll { Get-DbaProcess -SqlInstance $script:instance2 -Database $dbname | Stop-DbaProcess -WarningAction SilentlyContinue Remove-DbaDatabase -SqlInstance $script:instance2 -Database $dbname -Confirm:$false @@ -42,7 +42,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } $results.foreach{ It "Should suggest ROW, PAGE or NO_GAIN for $($PSitem.TableName) - $($PSitem.IndexType) " { - $PSitem.CompressionTypeRecommendation | Should BeIn ("ROW","PAGE","NO_GAIN") + $PSitem.CompressionTypeRecommendation | Should BeIn ("ROW", "PAGE", "NO_GAIN") } It "Should have values for PercentScan and PercentUpdate $($PSitem.TableName) - $($PSitem.IndexType) " { $PSitem.PercentUpdate | Should Not BeNullOrEmpty @@ -85,4 +85,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results.Count | Should Be $resultCount } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDbLogShipStatus.Tests.ps1 b/tests/Test-DbaDbLogShipStatus.Tests.ps1 index 1859f9c9e8..c8a66a0aeb 100644 --- a/tests/Test-DbaDbLogShipStatus.Tests.ps1 +++ b/tests/Test-DbaDbLogShipStatus.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SqlInstance','SqlCredential','Database', 'ExcludeDatabase', 'Simple', 'Primary', 'Secondary', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Simple', 'Primary', 'Secondary', 'EnableException' $SupportShouldProcess = $false $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -36,5 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $null = Test-DbaDbLogShipStatus -SqlInstance $script:instance2 -Database 'master' -WarningAction SilentlyContinue -WarningVariable doesntexist $doesntexist -match "No information available" | Should Be $true } -} - +} \ No newline at end of file diff --git a/tests/Test-DbaDbOwner.Tests.ps1 b/tests/Test-DbaDbOwner.Tests.ps1 index 77053ec536..dacdf579b3 100644 --- a/tests/Test-DbaDbOwner.Tests.ps1 +++ b/tests/Test-DbaDbOwner.Tests.ps1 @@ -8,11 +8,11 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $dbname = "dbatoolsci_testdbowner" $server = Connect-DbaInstance -SqlInstance $script:instance1 $null = $server.Query("Create Database [$dbname]") - } + } AfterAll { Remove-DbaDatabase -SqlInstance $script:instance1 -Database $dbname -Confirm:$false } - + It "return the correct information including database, currentowner and targetowner" { $whoami = whoami $results = Test-DbaDbOwner -SqlInstance $script:instance1 -Database $dbname @@ -30,7 +30,7 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDbOwner).Parameters.Keys @@ -47,67 +47,67 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { It -Skip "Should not throw" { Mock Connect-SQLInstance -MockWith { [object]@{ - Name = 'SQLServerName'; - Databases = [object]@( + Name = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'sa' + Name = 'db1'; + Status = 'Normal'; + Owner = 'sa' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + { Test-DbaDbOwner -SqlInstance 'SQLServerName' } | Should Not throw } #It It -Skip "Should not return if no wrong owner for default" { Mock Connect-SQLInstance -MockWith { [object]@{ - Name = 'SQLServerName'; - Databases = [object]@( + Name = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'sa' + Name = 'db1'; + Status = 'Normal'; + Owner = 'sa' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + { Test-DbaDbOwner -SqlInstance 'SQLServerName' } | Should Not throw } #It It -Skip "Should return wrong owner information for one database with no owner specified" { Mock Connect-SQLInstance -MockWith { [object]@{ - DomainInstanceName = 'SQLServerName'; - Databases = [object]@( + DomainInstanceName = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'WrongOWner' + Name = 'db1'; + Status = 'Normal'; + Owner = 'WrongOWner' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + $Result = Test-DbaDbOwner -SqlInstance 'SQLServerName' $Result[0].SqlInstance | Should Be 'SQLServerName' $Result[0].Database | Should Be 'db1'; @@ -119,23 +119,23 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { It -Skip "Should return information for one database with correct owner with detail parameter" { Mock Connect-SQLInstance -MockWith { [object]@{ - DomainInstanceName = 'SQLServerName'; - Databases = [object]@( + DomainInstanceName = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'sa' + Name = 'db1'; + Status = 'Normal'; + Owner = 'sa' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + $Result = Test-DbaDbOwner -SqlInstance 'SQLServerName' $Result.SqlInstance | Should Be 'SQLServerName' $Result.Database | Should Be 'db1'; @@ -147,28 +147,28 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { It -Skip "Should return wrong owner information for one database with no owner specified and multiple databases" { Mock Connect-SQLInstance -MockWith { [object]@{ - DomainInstanceName = 'SQLServerName'; - Databases = [object]@( + DomainInstanceName = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'WrongOWner' + Name = 'db1'; + Status = 'Normal'; + Owner = 'WrongOWner' } @{ - Name = 'db2'; - Status = 'Normal'; - Owner = 'sa' + Name = 'db2'; + Status = 'Normal'; + Owner = 'sa' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + $Result = Test-DbaDbOwner -SqlInstance 'SQLServerName' $Result[0].SqlInstance | Should Be 'SQLServerName' $Result[0].Database | Should Be 'db1'; @@ -180,28 +180,28 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { It -Skip "Should return wrong owner information for two databases with no owner specified and multiple databases" { Mock Connect-SQLInstance -MockWith { [object]@{ - DomainInstanceName = 'SQLServerName'; - Databases = [object]@( + DomainInstanceName = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'WrongOWner' + Name = 'db1'; + Status = 'Normal'; + Owner = 'WrongOWner' } @{ - Name = 'db2'; - Status = 'Normal'; - Owner = 'WrongOWner' + Name = 'db2'; + Status = 'Normal'; + Owner = 'WrongOWner' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + $Result = Test-DbaDbOwner -SqlInstance 'SQLServerName' $Result[0].SqlInstance | Should Be 'SQLServerName' $Result[1].SqlInstance | Should Be 'SQLServerName' @@ -216,66 +216,66 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { $Result[0].OwnerMatch | Should Be $False $Result[1].OwnerMatch | Should Be $False } # it - + It -Skip "Should call Stop-Function one time if Target Login does not exist on Server" { Mock Connect-SQLInstance -MockWith { [object]@{ - DomainInstanceName = 'SQLServerName'; - Databases = [object]@( + DomainInstanceName = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'WrongOwner' + Name = 'db1'; + Status = 'Normal'; + Owner = 'WrongOwner' } @{ - Name = 'db2'; - Status = 'Normal'; - Owner = 'WrongOwner' + Name = 'db2'; + Status = 'Normal'; + Owner = 'WrongOwner' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver Mock Stop-Function { } - + $null = Test-DbaDbOwner -SqlInstance 'SQLServerName' -TargetLogin 'WrongLogin' $assertMockParams = @{ - 'CommandName' = 'Stop-Function' - 'Times' = 1 - 'Exactly' = $true + 'CommandName' = 'Stop-Function' + 'Times' = 1 + 'Exactly' = $true } Assert-MockCalled @assertMockParams } # it It -Skip "Returns all information with detailed for correct and incorrect owner" { Mock Connect-SQLInstance -MockWith { [object]@{ - DomainInstanceName = 'SQLServerName'; - Databases = [object]@( + DomainInstanceName = 'SQLServerName'; + Databases = [object]@( @{ - Name = 'db1'; - Status = 'Normal'; - Owner = 'WrongOWner' + Name = 'db1'; + Status = 'Normal'; + Owner = 'WrongOWner' } @{ - Name = 'db2'; - Status = 'Normal'; - Owner = 'sa' + Name = 'db2'; + Status = 'Normal'; + Owner = 'sa' } ); #databases - Logins = [object]@( + Logins = [object]@( @{ - ID = 1; - Name = 'sa'; + ID = 1; + Name = 'sa'; } ) #logins } #object } #mock connect-sqlserver - + $Result = Test-DbaDbOwner -SqlInstance 'SQLServerName' $Result[0].SqlInstance | Should Be 'SQLServerName' $Result[1].SqlInstance | Should Be 'SQLServerName' @@ -292,4 +292,4 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { } # it } # Context } #modulescope -} #describe +} #describe \ No newline at end of file diff --git a/tests/Test-DbaDbVirtualLogFile.Tests.ps1 b/tests/Test-DbaDbVirtualLogFile.Tests.ps1 index 1c25dc02e0..e190b377f1 100644 --- a/tests/Test-DbaDbVirtualLogFile.Tests.ps1 +++ b/tests/Test-DbaDbVirtualLogFile.Tests.ps1 @@ -66,5 +66,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -} - +} \ No newline at end of file diff --git a/tests/Test-DbaDeprecatedFeature.Tests.ps1 b/tests/Test-DbaDeprecatedFeature.Tests.ps1 index 69c6c8bb5b..405c9299fc 100644 --- a/tests/Test-DbaDeprecatedFeature.Tests.ps1 +++ b/tests/Test-DbaDeprecatedFeature.Tests.ps1 @@ -11,11 +11,11 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDeprecatedFeature).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -36,4 +36,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDiskAlignment.Tests.ps1 b/tests/Test-DbaDiskAlignment.Tests.ps1 index 511f3b2f18..94bb9ee456 100644 --- a/tests/Test-DbaDiskAlignment.Tests.ps1 +++ b/tests/Test-DbaDiskAlignment.Tests.ps1 @@ -10,7 +10,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDiskAlignment).Parameters.Keys @@ -22,4 +22,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $params.Count - $defaultParamCount | Should Be $paramCount } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDiskAllocation.Tests.ps1 b/tests/Test-DbaDiskAllocation.Tests.ps1 index 3bfbd6db1b..09436e1c97 100644 --- a/tests/Test-DbaDiskAllocation.Tests.ps1 +++ b/tests/Test-DbaDiskAllocation.Tests.ps1 @@ -10,11 +10,11 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 6 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Test-DbaDiskAllocation).Parameters.Keys - $knownParameters = 'ComputerName','NoSqlCheck','SqlCredential','Credential','Detailed','EnableException' + $knownParameters = 'ComputerName', 'NoSqlCheck', 'SqlCredential', 'Credential', 'Detailed', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results | Should -Not -Be $null } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaDiskSpeed.Tests.ps1 b/tests/Test-DbaDiskSpeed.Tests.ps1 index c73f6c5e03..b539c2f03b 100644 --- a/tests/Test-DbaDiskSpeed.Tests.ps1 +++ b/tests/Test-DbaDiskSpeed.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaDiskSpeed).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,8 +20,8 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Command actually works" { It "should have info for model" { - $results = Test-DbaDiskSpeed -SqlInstance $script:instance1 - $results.FileName -contains 'modellog.ldf' + $results = Test-DbaDiskSpeed -SqlInstance $script:instance1 + $results.FileName -contains 'modellog.ldf' } It "returns only for master" { $results = Test-DbaDiskSpeed -SqlInstance $script:instance1 -Database master @@ -31,4 +31,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaEndpoint.Tests.ps1 b/tests/Test-DbaEndpoint.Tests.ps1 index 43a61078a2..bd7114b8ef 100644 --- a/tests/Test-DbaEndpoint.Tests.ps1 +++ b/tests/Test-DbaEndpoint.Tests.ps1 @@ -4,13 +4,12 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan Describe "$CommandName Unit Tests" -Tags "UnitTests" { Context "Validate parameters" { - $knownParameters = 'SqlInstance','SqlCredential','Endpoint', 'InputObject', 'EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Endpoint', 'InputObject', 'EnableException' $SupportShouldProcess = $false $paramCount = $knownParameters.Count if ($SupportShouldProcess) { $defaultParamCount = 13 - } - else { + } else { $defaultParamCount = 11 } $command = Get-Command -Name $CommandName @@ -31,4 +30,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results = Test-DbaEndpoint -SqlInstance $script:instance3 $results | Select-Object -First 1 -ExpandProperty Connection | Should -Be 'Success' } -} #$script:instance2 for appveyor +} #$script:instance2 for appveyor \ No newline at end of file diff --git a/tests/Test-DbaIdentityUsage.Tests.ps1 b/tests/Test-DbaIdentityUsage.Tests.ps1 index 30469b15f5..5a612cb716 100644 --- a/tests/Test-DbaIdentityUsage.Tests.ps1 +++ b/tests/Test-DbaIdentityUsage.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaIdentityUsage).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','ExcludeDatabase','Threshold','ExcludeSystemDb','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'Threshold', 'ExcludeSystemDb', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -83,4 +83,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.PercentUsed | Should Be 47.06 } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaJobOwner.Tests.ps1 b/tests/Test-DbaJobOwner.Tests.ps1 index a68aac7cef..6c414a8c1b 100644 --- a/tests/Test-DbaJobOwner.Tests.ps1 +++ b/tests/Test-DbaJobOwner.Tests.ps1 @@ -30,25 +30,25 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Command actually works" { $results = Test-DbaJobOwner -SqlInstance $script:instance2 - It "Should return $notSaJob"{ + It "Should return $notSaJob" { $results | Where-Object {$_.Job -eq $notsajob} | Should Not Be Null } } Context "Command works for specific jobs" { $results = Test-DbaJobOwner -SqlInstance $script:instance2 -Job $saJob, $notSaJob - It "Should find $sajob owner matches default sa"{ + It "Should find $sajob owner matches default sa" { $($results | Where-Object {$_.Job -eq $sajob}).OwnerMatch | Should Be $True } - It "Should find $notSaJob owner doesn't match default sa"{ + It "Should find $notSaJob owner doesn't match default sa" { $($results | Where-Object {$_.Job -eq $notSaJob}).OwnerMatch | Should Be $False } } Context "Exclusions work" { $results = Test-DbaJobOwner -SqlInstance $script:instance2 -ExcludeJob $notSaJob - It "Should exclude $notsajob job"{ + It "Should exclude $notsajob job" { $results.job | Should Not Match $notSaJob } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaLinkedServerConnection.Tests.ps1 b/tests/Test-DbaLinkedServerConnection.Tests.ps1 index 3c663d910a..732c70bc0d 100644 --- a/tests/Test-DbaLinkedServerConnection.Tests.ps1 +++ b/tests/Test-DbaLinkedServerConnection.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaLinkedServerConnection).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -34,4 +34,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.LinkedServerName -eq 'localhost' $results.Connectivity -eq $true } -} +} \ No newline at end of file diff --git a/tests/Test-DbaLoginPassword.Tests.ps1 b/tests/Test-DbaLoginPassword.Tests.ps1 index 2cda37dadf..16d8d5b09a 100644 --- a/tests/Test-DbaLoginPassword.Tests.ps1 +++ b/tests/Test-DbaLoginPassword.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag UnitTests, Get-DbaLogin { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaLoginPassword).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Dictionary','Login','InputObject','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Dictionary', 'Login', 'InputObject', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -45,8 +45,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { AfterAll { try { $newlogin.Drop() - } - catch { + } catch { # don't care } } @@ -61,4 +60,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $results.SqlLogin | Should -Be $weaksauce } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaLsnChain.Tests.ps1 b/tests/Test-DbaLsnChain.Tests.ps1 index cf01c7204a..0a95c4ddb1 100644 --- a/tests/Test-DbaLsnChain.Tests.ps1 +++ b/tests/Test-DbaLsnChain.Tests.ps1 @@ -34,4 +34,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaManagementObject.Tests.ps1 b/tests/Test-DbaManagementObject.Tests.ps1 index 16464da439..52e382ae81 100644 --- a/tests/Test-DbaManagementObject.Tests.ps1 +++ b/tests/Test-DbaManagementObject.Tests.ps1 @@ -49,5 +49,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $falseResults.Exists | Should Be $false } } -} - +} \ No newline at end of file diff --git a/tests/Test-DbaMaxDop.Tests.ps1 b/tests/Test-DbaMaxDop.Tests.ps1 index 08f616d839..bd9f6baa03 100644 --- a/tests/Test-DbaMaxDop.Tests.ps1 +++ b/tests/Test-DbaMaxDop.Tests.ps1 @@ -32,22 +32,22 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { AfterAll { Get-DbaDatabase -SqlInstance $script:instance2 -Database $db1 | Remove-DbaDatabase -Confirm:$false } - + # Just not messin with this in appveyor if ($setupright) { Context "Command works on SQL Server 2016 or higher instances" { $results = Test-DbaMaxDop -SqlInstance $script:instance2 - + It "Should have correct properties" { $ExpectedProps = 'ComputerName,InstanceName,SqlInstance,Database,DatabaseMaxDop,CurrentInstanceMaxDop,RecommendedMaxDop,Notes'.Split(',') foreach ($result in $results) { ($result.PSStandardMembers.DefaultDIsplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedProps | Sort-Object) } } - + It "Should have only one result for database name of dbatoolsci_testMaxDop" { @($results | Where-Object Database -eq dbatoolsci_testMaxDop).Count | Should Be 1 } } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaMaxMemory.Tests.ps1 b/tests/Test-DbaMaxMemory.Tests.ps1 index 2638336cdb..b06228f274 100644 --- a/tests/Test-DbaMaxMemory.Tests.ps1 +++ b/tests/Test-DbaMaxMemory.Tests.ps1 @@ -40,7 +40,7 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { ComputerName = "SQL2016" InstanceName = "MSSQLSERVER" SqlInstance = "SQL2016" - Total = 4096 + Total = 4096 MaxValue = 2147483647 } } diff --git a/tests/Test-DbaMigrationConstraint.Tests.ps1 b/tests/Test-DbaMigrationConstraint.Tests.ps1 index ec5520f9ea..3cbb0c2a78 100644 --- a/tests/Test-DbaMigrationConstraint.Tests.ps1 +++ b/tests/Test-DbaMigrationConstraint.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaMigrationConstraint).Parameters.Keys - $knownParameters = 'Source','SourceSqlCredential','Destination','DestinationSqlCredential','Database','ExcludeDatabase','EnableException' + $knownParameters = 'Source', 'SourceSqlCredential', 'Destination', 'DestinationSqlCredential', 'Database', 'ExcludeDatabase', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -51,4 +51,4 @@ Describe "$CommandName Integration Tests" -Tag 'IntegrationTests' { (Test-DbaMigrationConstraint -Source $script:instance1 -Destination $script:instance2 -Database $db1).IsMigratable | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaNetworkLatency.Tests.ps1 b/tests/Test-DbaNetworkLatency.Tests.ps1 index ffb8d93c6d..b0bced783b 100644 --- a/tests/Test-DbaNetworkLatency.Tests.ps1 +++ b/tests/Test-DbaNetworkLatency.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 5 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaNetworkLatency).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Query','Count','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Query', 'Count', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -37,4 +37,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($result.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames | Sort-Object) | Should Be ($ExpectedPropsDefault | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaOptimizeForAdHoc.Tests.ps1 b/tests/Test-DbaOptimizeForAdHoc.Tests.ps1 index d5b04586c7..f0d51d78ba 100644 --- a/tests/Test-DbaOptimizeForAdHoc.Tests.ps1 +++ b/tests/Test-DbaOptimizeForAdHoc.Tests.ps1 @@ -30,4 +30,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.RecommendedOptimizeAdHoc | Should BeOfType System.Int32 } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaPath.Tests.ps1 b/tests/Test-DbaPath.Tests.ps1 index 442dc212db..5d38f65f5d 100644 --- a/tests/Test-DbaPath.Tests.ps1 +++ b/tests/Test-DbaPath.Tests.ps1 @@ -56,9 +56,9 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results | Where-Object FilePath -eq $trueTest).FileExists | Should Be $true ($results | Where-Object FilePath -eq $falseTest).FileExists | Should Be $false } - $results = Test-DbaPath -SqlInstance $script:instance2,$script:instance1 -Path $falseTest + $results = Test-DbaPath -SqlInstance $script:instance2, $script:instance1 -Path $falseTest It "Should return multiple results when passed multiple instances" { - foreach($result in $results) { + foreach ($result in $results) { $result.FileExists | Should Be $false } ($results.SqlInstance | Sort-Object -Unique).Count | Should Be 2 @@ -75,5 +75,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results | Where-Object FilePath -eq $trueTestPath).IsContainer | Should Be $true } } -} - +} \ No newline at end of file diff --git a/tests/Test-DbaPowerPlan.Tests.ps1 b/tests/Test-DbaPowerPlan.Tests.ps1 index b22d307878..768954115d 100644 --- a/tests/Test-DbaPowerPlan.Tests.ps1 +++ b/tests/Test-DbaPowerPlan.Tests.ps1 @@ -28,4 +28,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $results.isBestPractice | Should Be $false } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaRecoveryModel.Tests.ps1 b/tests/Test-DbaRecoveryModel.Tests.ps1 index 9593a5f82b..7b0725cddd 100644 --- a/tests/Test-DbaRecoveryModel.Tests.ps1 +++ b/tests/Test-DbaRecoveryModel.Tests.ps1 @@ -10,11 +10,11 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { The $defaultParamCount is adjusted based on what type of command you are writing the test for: - Commands that *do not* include SupportShouldProcess, set defaultParamCount = 11 - Commands that *do* include SupportShouldProcess, set defaultParamCount = 13 - #> + #> $paramCount = 7 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaRecoveryModel).Parameters.Keys - $knownParameters = 'SqlInstance', 'SqlCredential','RecoveryModel', 'Database', 'ExcludeDatabase', 'EnableException', 'Detailed' + $knownParameters = 'SqlInstance', 'SqlCredential', 'RecoveryModel', 'Database', 'ExcludeDatabase', 'EnableException', 'Detailed' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -51,24 +51,24 @@ Describe "$CommandName Intigration Tests" -Tag "IntegrationTests" { } Context "Default Execution" { - $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -Database $fullRecovery,$psudoSimpleRecovery,'Model' + $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -Database $fullRecovery, $psudoSimpleRecovery, 'Model' - It "Should return $fullRecovery, $psudoSimpleRecovery, and Model" { - $results.Database | should -BeIn ($fullRecovery,$psudoSimpleRecovery,'Model') - } + It "Should return $fullRecovery, $psudoSimpleRecovery, and Model" { + $results.Database | should -BeIn ($fullRecovery, $psudoSimpleRecovery, 'Model') + } } Context "Full Recovery" { - $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Full -Database $fullRecovery,$psudoSimpleRecovery -ExcludeDatabase 'Model' + $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Full -Database $fullRecovery, $psudoSimpleRecovery -ExcludeDatabase 'Model' It "Should return $fullRecovery and $psudoSimpleRecovery" { - $results.Database | should -BeIn ($fullRecovery,$psudoSimpleRecovery) - } + $results.Database | should -BeIn ($fullRecovery, $psudoSimpleRecovery) + } } Context "Bulk Logged Recovery" { - $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Bulk_Logged -Database $bulkLoggedRecovery + $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Bulk_Logged -Database $bulkLoggedRecovery It "Should return $bulkLoggedRecovery" { $results.Database | should -Be "$bulkLoggedRecovery" @@ -77,7 +77,7 @@ Describe "$CommandName Intigration Tests" -Tag "IntegrationTests" { } Context "Simple Recovery" { - $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Simple -Database $simpleRecovery + $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Simple -Database $simpleRecovery It "Should return $simpleRecovery" { $results.Database | should -Be "$simpleRecovery" @@ -86,7 +86,7 @@ Describe "$CommandName Intigration Tests" -Tag "IntegrationTests" { } Context "Psudo Simple Recovery" { - $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Full | Where {$_.database -eq "$psudoSimpleRecovery"} + $results = Test-DbaRecoveryModel -SqlInstance $script:instance2 -RecoveryModel Full | Where {$_.database -eq "$psudoSimpleRecovery"} It "Should return $psudoSimpleRecovery" { $results.Database | should -Be "$psudoSimpleRecovery" @@ -113,4 +113,4 @@ Describe "$CommandName Intigration Tests" -Tag "IntegrationTests" { } -} +} \ No newline at end of file diff --git a/tests/Test-DbaRepLatency.Tests.ps1 b/tests/Test-DbaRepLatency.Tests.ps1 index f62bde6657..5da90305af 100644 --- a/tests/Test-DbaRepLatency.Tests.ps1 +++ b/tests/Test-DbaRepLatency.Tests.ps1 @@ -24,5 +24,4 @@ Describe "$commandname Unit Tests" -Tag 'UnitTests' { } } -} - +} \ No newline at end of file diff --git a/tests/Test-DbaServerName.Tests.ps1 b/tests/Test-DbaServerName.Tests.ps1 index 7e86f96897..f2166f7e5d 100644 --- a/tests/Test-DbaServerName.Tests.ps1 +++ b/tests/Test-DbaServerName.Tests.ps1 @@ -23,10 +23,10 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "should say rename is not required" { $results.RenameRequired | Should -Be $false } - + It "returns the correct properties" { $ExpectedProps = 'ComputerName,ServerName,RenameRequired,Updatable,Warnings,Blockers,SqlInstance,InstanceName'.Split(',') ($results.PsObject.Properties.Name | Sort-Object) | Should -Be ($ExpectedProps | Sort-Object) } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaSpn.Tests.ps1 b/tests/Test-DbaSpn.Tests.ps1 index 1d255d29e6..9964479a93 100644 --- a/tests/Test-DbaSpn.Tests.ps1 +++ b/tests/Test-DbaSpn.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 3 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-DbaSpn).Parameters.Keys - $knownParameters = 'ComputerName','Credential','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -21,15 +21,15 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "gets spn information" { Mock Resolve-DbaNetworkName { [pscustomobject]@{ - InputName = $env:COMPUTERNAME - ComputerName = $env:COMPUTERNAME - IPAddress = "127.0.0.1" - DNSHostName = $env:COMPUTERNAME - DNSDomain = $env:COMPUTERNAME - Domain = $env:COMPUTERNAME - DNSHostEntry = $env:COMPUTERNAME - FQDN = $env:COMPUTERNAME - FullComputerName = $env:COMPUTERNAME + InputName = $env:COMPUTERNAME + ComputerName = $env:COMPUTERNAME + IPAddress = "127.0.0.1" + DNSHostName = $env:COMPUTERNAME + DNSDomain = $env:COMPUTERNAME + Domain = $env:COMPUTERNAME + DNSHostEntry = $env:COMPUTERNAME + FQDN = $env:COMPUTERNAME + FullComputerName = $env:COMPUTERNAME } } $results = Test-DbaSpn -ComputerName $env:COMPUTERNAME -WarningAction SilentlyContinue @@ -45,4 +45,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaTempDbConfig.Tests.ps1 b/tests/Test-DbaTempDbConfig.Tests.ps1 index 676a213684..483af9ba2c 100644 --- a/tests/Test-DbaTempDbConfig.Tests.ps1 +++ b/tests/Test-DbaTempDbConfig.Tests.ps1 @@ -37,7 +37,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $ExpectedProps = 'ComputerName,InstanceName,SqlInstance,Rule,Recommended,CurrentSetting,IsBestPractice,Notes'.Split(',') ($results[0].PsObject.Properties.Name | Sort-Object) | Should Be ($ExpectedProps | Sort-Object) } - + $rule = 'File Location' It "Should return false for IsBestPractice with rule: $rule" { ($results | Where-Object Rule -match $rule).IsBestPractice | Should Be $false @@ -50,4 +50,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { ($results | Where-Object Rule -match $rule).Recommended | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Test-DbaWindowsLogin.Tests.ps1 b/tests/Test-DbaWindowsLogin.Tests.ps1 index ea4273f639..09c6c1eaeb 100644 --- a/tests/Test-DbaWindowsLogin.Tests.ps1 +++ b/tests/Test-DbaWindowsLogin.Tests.ps1 @@ -47,4 +47,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($results | Where-Object Found).Found | Should Be $true } } -}#> +}#> \ No newline at end of file diff --git a/tests/Test-PSRemoting.Tests.ps1 b/tests/Test-PSRemoting.Tests.ps1 index 42104b8b92..d7fe713870 100644 --- a/tests/Test-PSRemoting.Tests.ps1 +++ b/tests/Test-PSRemoting.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag "UnitTests" { <# Get commands, Default count = 11 Commands with SupportShouldProcess = 13 - #> + #> $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Test-PSRemoting).Parameters.Keys $knownParameters = 'ComputerName', 'Credential', 'EnableException' @@ -38,4 +38,4 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $result | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Uninstall-DbaWatchUpdate.Tests.ps1 b/tests/Uninstall-DbaWatchUpdate.Tests.ps1 index 852926340f..52d62719de 100644 --- a/tests/Uninstall-DbaWatchUpdate.Tests.ps1 +++ b/tests/Uninstall-DbaWatchUpdate.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Update-DbaServiceAccount.Tests.ps1 b/tests/Update-DbaServiceAccount.Tests.ps1 index e7daa3f8d1..44a705f500 100644 --- a/tests/Update-DbaServiceAccount.Tests.ps1 +++ b/tests/Update-DbaServiceAccount.Tests.ps1 @@ -8,7 +8,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 9 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Update-DbaServiceAccount).Parameters.Keys - $knownParameters = 'ComputerName','Credential','InputObject','ServiceName','Username','ServiceCredential','OldPassword','NewPassword','EnableException' + $knownParameters = 'ComputerName', 'Credential', 'InputObject', 'ServiceName', 'Username', 'ServiceCredential', 'OldPassword', 'NewPassword', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -37,8 +37,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { if ($user.Name -eq $login) { $computer.Delete('User', $login) } - } - catch {<#User does not exist#>} + } catch {<#User does not exist#>} if ($l = Get-DbaLogin -SqlInstance $script:instance2 -Login $winLogin) { $results = $server.Query("IF EXISTS (SELECT * FROM sys.server_principals WHERE name = '$winLogin') EXEC sp_who '$winLogin'") @@ -206,4 +205,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { #Cleanup $server.Logins[$winLogin].Drop() $computer.Delete('User', $login) -} +} \ No newline at end of file diff --git a/tests/Update-dbatools.Tests.ps1 b/tests/Update-dbatools.Tests.ps1 index a35d2ff6e8..83e0f22e71 100644 --- a/tests/Update-dbatools.Tests.ps1 +++ b/tests/Update-dbatools.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 2 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Update-dbatools).Parameters.Keys - $knownParameters = 'Development','EnableException' + $knownParameters = 'Development', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Watch-DbaDbLogin.Tests.ps1 b/tests/Watch-DbaDbLogin.Tests.ps1 index 44c478653d..7e84872b52 100644 --- a/tests/Watch-DbaDbLogin.Tests.ps1 +++ b/tests/Watch-DbaDbLogin.Tests.ps1 @@ -59,5 +59,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } } } -#> - +#> \ No newline at end of file diff --git a/tests/Watch-DbaUpdate.Tests.ps1 b/tests/Watch-DbaUpdate.Tests.ps1 index dd41ec5746..d932657613 100644 --- a/tests/Watch-DbaUpdate.Tests.ps1 +++ b/tests/Watch-DbaUpdate.Tests.ps1 @@ -20,5 +20,4 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Integration test should appear below and are custom to the command you are writing. Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests for more guidence. -#> - +#> \ No newline at end of file diff --git a/tests/Watch-DbaXESession.Tests.ps1 b/tests/Watch-DbaXESession.Tests.ps1 index 7988cf29b0..05ede355cf 100644 --- a/tests/Watch-DbaXESession.Tests.ps1 +++ b/tests/Watch-DbaXESession.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 6 $defaultParamCount = 11 [object[]]$params = (Get-ChildItem function:\Watch-DbaXESession).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Session','InputObject','Raw','EnableException' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Session', 'InputObject', 'Raw', 'EnableException' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -25,4 +25,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $versionwarn -match "Unsupported version" | Should Be $true } } -} +} \ No newline at end of file diff --git a/tests/Write-DbaDataTable.Tests.ps1 b/tests/Write-DbaDataTable.Tests.ps1 index cc5bb4fe9e..c8ac05f9f3 100644 --- a/tests/Write-DbaDataTable.Tests.ps1 +++ b/tests/Write-DbaDataTable.Tests.ps1 @@ -7,7 +7,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { $paramCount = 19 $defaultParamCount = 13 [object[]]$params = (Get-ChildItem function:\Write-DbaDataTable).Parameters.Keys - $knownParameters = 'SqlInstance','SqlCredential','Database','InputObject','Table','Schema','BatchSize','NotifyAfter','AutoCreateTable','NoTableLock','CheckConstraints','FireTriggers','KeepIdentity','KeepNulls','Truncate','bulkCopyTimeOut','RegularUser','EnableException','UseDynamicStringLength' + $knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'Table', 'Schema', 'BatchSize', 'NotifyAfter', 'AutoCreateTable', 'NoTableLock', 'CheckConstraints', 'FireTriggers', 'KeepIdentity', 'KeepNulls', 'Truncate', 'bulkCopyTimeOut', 'RegularUser', 'EnableException', 'UseDynamicStringLength' It "Should contain our specific parameters" { ( (Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params -IncludeEqual | Where-Object SideIndicator -eq "==").Count ) | Should Be $paramCount } @@ -35,4 +35,4 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { ($server.Databases[$db].Tables | Where-Object { $_.Schema -eq 'dbo' -and $_.Name -eq 'childitem' }).Count | Should Be 1 } -} +} \ No newline at end of file diff --git a/tests/appveyor.SQL2016.ps1 b/tests/appveyor.SQL2016.ps1 index 1d6b51c75a..aa421b3100 100644 --- a/tests/appveyor.SQL2016.ps1 +++ b/tests/appveyor.SQL2016.ps1 @@ -58,4 +58,4 @@ foreach ($file in (Get-ChildItem C:\github\appveyor-lab\sql2016-startup\*.sql -R } if ($sql2016Startup -eq 1) { Write-Host -Object "$indent something went wrong with startup scripts" -ForegroundColor DarkGreen -} +} \ No newline at end of file diff --git a/tests/appveyor.SQL2017.ps1 b/tests/appveyor.SQL2017.ps1 index a1228bb4da..3816cec106 100644 --- a/tests/appveyor.SQL2017.ps1 +++ b/tests/appveyor.SQL2017.ps1 @@ -49,12 +49,11 @@ $computername = $server.NetName $servicename = $server.ServiceName if ($servicename -eq 'MSSQLSERVER') { $instancename = "$computername" -} -else { +} else { $instancename = "$computername\$servicename" } $server = Connect-DbaInstance -SqlInstance $sqlinstance $server.Query("IF NOT EXISTS (select * from sys.symmetric_keys where name like '%DatabaseMasterKey%') CREATE MASTER KEY ENCRYPTION BY PASSWORD = ''") $server.Query("IF EXISTS ( SELECT * FROM sys.tcp_endpoints WHERE name = 'End_Mirroring') DROP ENDPOINT endpoint_mirroring") -$server.Query("CREATE CERTIFICATE dbatoolsci_AGCert WITH SUBJECT = 'AG Certificate'") +$server.Query("CREATE CERTIFICATE dbatoolsci_AGCert WITH SUBJECT = 'AG Certificate'") \ No newline at end of file diff --git a/tests/appveyor.pester.ps1 b/tests/appveyor.pester.ps1 index c48a326063..bf1551bba5 100644 --- a/tests/appveyor.pester.ps1 +++ b/tests/appveyor.pester.ps1 @@ -61,7 +61,7 @@ function Split-ArrayInParts($array, [int]$parts) { $counter = [pscustomobject] @{ Value = 0 } $groups = $array | Group-Object -Property { [math]::Floor($counter.Value++ / $size) } $rtn = @() - foreach($g in $groups) { + foreach ($g in $groups) { $rtn += , @($g.Group) } $rtn @@ -235,8 +235,7 @@ function Get-TestsForScenario { } } $AllScenarioTests = $ScanTests - } - else { + } else { $AllScenarioTests = $AllTests | Where-Object { ($_.Name -replace '\.Tests\.ps1$', '') -in $TestsRunGroups[$Scenario] } } return $AllScenarioTests @@ -264,8 +263,7 @@ if (-not $Finalize) { if ($AllTests.Count -eq 0) { throw "something went wrong, nothing to test" } - } - else { + } else { $TestsToRun = "*.Tests.*" } @@ -274,8 +272,7 @@ if (-not $Finalize) { # if so, do we have a group with tests to run ? if ($env:SCENARIO -in $TestsRunGroups.Keys) { $AllScenarioTests = Get-TestsForScenario -scenario $env:SCENARIO -AllTest $AllTests - } - else { + } else { $AllTestsToExclude = @() $validScenarios = $TestsRunGroups.Keys | Where-Object { $_ -notin @('disabled', 'appveyor_disabled') } foreach ($k in $validScenarios) { @@ -283,8 +280,7 @@ if (-not $Finalize) { } $AllScenarioTests = $AllTests | Where-Object { $_ -notin $AllTestsToExclude } } - } - else { + } else { $AllScenarioTests = $AllTests } Write-Host -ForegroundColor DarkGreen "Test Groups : Reduced to $($AllScenarioTests.Count) out of $($AllDbatoolsTests.Count) tests" @@ -294,9 +290,9 @@ if (-not $Finalize) { [int]$num, [int]$denom = $env:PART.Split('/') Write-Host -ForegroundColor DarkGreen "Test Parts : part $($env:PART) on total $($AllScenarioTests.Count)" #shuffle things a bit (i.e. with natural sorting most of the *get* fall into the first part, all the *set* in the last, etc) - $AllScenarioTestsShuffled = $AllScenarioTests | Sort-Object -Property @{Expression={ $_.Name.Split('-')[-1].Replace('Dba', '') }; Ascending = $true} + $AllScenarioTestsShuffled = $AllScenarioTests | Sort-Object -Property @{Expression = { $_.Name.Split('-')[-1].Replace('Dba', '') }; Ascending = $true} $scenarioParts = Split-ArrayInParts -array $AllScenarioTestsShuffled -parts $denom - $AllScenarioTests = $scenarioParts[$num-1] | Sort-Object -Property Name + $AllScenarioTests = $scenarioParts[$num - 1] | Sort-Object -Property Name } catch { } } @@ -337,8 +333,7 @@ if (-not $Finalize) { $PesterRun | Export-Clixml -Path "$ModuleBase\PesterResults$PSVersion$Counter.xml" Update-AppveyorTest -Name $f.Name -Framework NUnit -FileName $f.FullName -Outcome Passed -Duration $PesterRun.Time.TotalMilliseconds } -} -else { +} else { # Unsure why we're uploading so I removed it for now <# #If finalize is specified, check for failures and show status @@ -380,4 +375,4 @@ else { $CodecovReport = Get-CodecovReport -Results $results -ModuleBase $ModuleBase $CodecovReport | ConvertTo-Json -Depth 4 -Compress | Out-File -FilePath "$ModuleBase\PesterResultsCoverage.json" -Encoding utf8 } -} +} \ No newline at end of file diff --git a/tests/appveyor.post.ps1 b/tests/appveyor.post.ps1 index 2f07f242d5..3c7ba32252 100644 --- a/tests/appveyor.post.ps1 +++ b/tests/appveyor.post.ps1 @@ -4,17 +4,17 @@ Write-Host -Object "appveyor.post: Sending coverage data" -ForeGroundColor DarkG Push-AppveyorArtifact PesterResultsCoverage.json -FileName "PesterResultsCoverage" codecov -f PesterResultsCoverage.json --flag "ps,$($env:SCENARIO.toLower())" | Out-Null # DLL unittests only in default scenario -if($env:SCENARIO -eq 'default') { - Write-Host -Object "appveyor.post: DLL unittests" -ForeGroundColor DarkGreen - OpenCover.Console.exe ` - -register:user ` - -target:"vstest.console.exe" ` - -targetargs:"/logger:Appveyor bin\projects\dbatools\dbatools.Tests\bin\Debug\dbatools.Tests.dll" ` - -output:"coverage.xml" ` - -filter:"+[dbatools]*" ` - -returntargetcode - Push-AppveyorArtifact coverage.xml -FileName "OpenCover C# Report" - codecov -f "coverage.xml" --flag "dll,$($env:SCENARIO.toLower())" | Out-Null +if ($env:SCENARIO -eq 'default') { + Write-Host -Object "appveyor.post: DLL unittests" -ForeGroundColor DarkGreen + OpenCover.Console.exe ` + -register:user ` + -target:"vstest.console.exe" ` + -targetargs:"/logger:Appveyor bin\projects\dbatools\dbatools.Tests\bin\Debug\dbatools.Tests.dll" ` + -output:"coverage.xml" ` + -filter:"+[dbatools]*" ` + -returntargetcode + Push-AppveyorArtifact coverage.xml -FileName "OpenCover C# Report" + codecov -f "coverage.xml" --flag "dll,$($env:SCENARIO.toLower())" | Out-Null } $sw.Stop() -Update-AppveyorTest -Name "appveyor.post" -Framework NUnit -FileName "appveyor.post.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds +Update-AppveyorTest -Name "appveyor.post" -Framework NUnit -FileName "appveyor.post.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds \ No newline at end of file diff --git a/tests/appveyor.prep.ps1 b/tests/appveyor.prep.ps1 index 0ec0de6253..b571e9d83b 100644 --- a/tests/appveyor.prep.ps1 +++ b/tests/appveyor.prep.ps1 @@ -25,6 +25,4 @@ Write-Host -Object "appveyor.prep: Install opencover.portable" -ForegroundColor choco install opencover.portable | Out-Null $sw.Stop() -Update-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds - - +Update-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds \ No newline at end of file diff --git a/tests/appveyor.sqlserver.ps1 b/tests/appveyor.sqlserver.ps1 index bd7ad9160c..7ffbba9d0d 100644 --- a/tests/appveyor.sqlserver.ps1 +++ b/tests/appveyor.sqlserver.ps1 @@ -17,5 +17,4 @@ if ($env:SCENARIO) { $sw.Stop() Update-AppveyorTest -Name $Setup_Script -Framework NUnit -FileName $Setup_Script -Outcome Passed -Duration $sw.ElapsedMilliseconds } -} - +} \ No newline at end of file diff --git a/tests/constants.ps1 b/tests/constants.ps1 index d02328bf14..5b2c16e1aa 100644 --- a/tests/constants.ps1 +++ b/tests/constants.ps1 @@ -2,12 +2,10 @@ if (Test-Path C:\temp\constants.ps1) { Write-Verbose "C:\temp\constants.ps1 found." . C:\temp\constants.ps1 -} -elseif (Test-Path "$PSScriptRoot\constants.local.ps1") { +} elseif (Test-Path "$PSScriptRoot\constants.local.ps1") { Write-Verbose "tests\constants.local.ps1 found." . "$PSScriptRoot\constants.local.ps1" -} -else { +} else { $script:instance1 = "localhost\sql2008r2sp2" $script:instance2 = "localhost\sql2016" $script:instance3 = "localhost\sql2017" @@ -19,4 +17,4 @@ else { $script:azureblobaccount = "dbatools" } -$PSDefaultParameterValues['*:WarningAction' ] = 'SilentlyContinue' +$PSDefaultParameterValues['*:WarningAction' ] = 'SilentlyContinue' \ No newline at end of file diff --git a/tests/dbatools.Tests.ps1 b/tests/dbatools.Tests.ps1 index 667ccd1e0c..5080bbb84d 100644 --- a/tests/dbatools.Tests.ps1 +++ b/tests/dbatools.Tests.ps1 @@ -4,7 +4,7 @@ $ModulePath = (Get-Item $Path).Parent.FullName $ModuleName = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -Replace ".Tests.ps1" #$ManifestPath = "$ModulePath\$ModuleName.psd1" -Describe "$ModuleName Aliases" -Tag Aliases, Build { +Describe "$ModuleName Aliases" -Tag Aliases, Build { ## Get the Aliases that should -Be set from the psm1 file $psm1 = Get-Content $ModulePath\$ModuleName.psm1 -Verbose @@ -42,10 +42,10 @@ Describe "$ModuleName style" -Tag 'Compliance' { Ensures common formatting standards are applied: - OTSB style, courtesy of PSSA's Invoke-Formatter, is what dbatools uses - UTF8 without BOM is what is going to be used in PS Core, so we adopt this standard for dbatools - #> + #> $AllFiles = Get-ChildItem -Path $ModulePath -File -Recurse -Filter '*.ps*1' | Where-Object Name -ne 'allcommands.ps1' $AllFunctionFiles = Get-ChildItem -Path "$ModulePath\functions", "$ModulePath\internal\functions"-Filter '*.ps*1' - Context "formatting" { + Context "formatting" { $maxConcurrentJobs = $env:NUMBER_OF_PROCESSORS $whatever = Split-ArrayInParts -array $AllFunctionFiles -parts $maxConcurrentJobs $jobs = @() @@ -107,7 +107,7 @@ Describe "$ModuleName style" -Tag 'Compliance' { #> $AllPublicFunctions = Get-ChildItem -Path "$ModulePath\functions" -Filter '*.ps*1' - Context "NoCompatibleTLS" { + Context "NoCompatibleTLS" { # .NET defaults clash with recent TLS hardening (e.g. no TLS 1.2 by default) foreach ($f in $AllPublicFunctions) { $NotAllowed = Select-String -Path $f -Pattern 'Invoke-WebRequest | New-Object System.Net.WebClient|\.DownloadFile' @@ -227,5 +227,4 @@ $Script:Manifest = Test-ModuleManifest -Path $ManifestPath -ErrorAction Silently } } -#> - +#> \ No newline at end of file diff --git a/tests/manual.pester.ps1 b/tests/manual.pester.ps1 index 702012aa43..a6c0d43314 100644 --- a/tests/manual.pester.ps1 +++ b/tests/manual.pester.ps1 @@ -191,8 +191,7 @@ if ($Path) { foreach ($item in $path) { if (Test-Path $item) { $files += Get-ChildItem -Path $item - } - else { + } else { $files += Get-ChildItem -Path "$ModuleBase\tests\*$item*.Tests.ps1" } } @@ -220,8 +219,7 @@ foreach ($f in $AllTestsWithinScenario) { if ($Coverage) { if ($DependencyCoverage) { $CoverFilesPester = $CoverFiles - } - else { + } else { $CoverFilesPester = $HeadFunctionPath } $PesterSplat['CodeCoverage'] = $CoverFilesPester @@ -236,5 +234,4 @@ foreach ($f in $AllTestsWithinScenario) { } Invoke-ScriptAnalyzer -Path $HeadFunctionPath -ExcludeRule $ScriptAnalyzerRulesExclude } -} - +} \ No newline at end of file diff --git a/tests/pester.groups.ps1 b/tests/pester.groups.ps1 index 4f7546d579..b465c5107b 100644 --- a/tests/pester.groups.ps1 +++ b/tests/pester.groups.ps1 @@ -2,13 +2,13 @@ $TestsRunGroups = @{ # run on scenario 2008R2 - "2008R2" = 'autodetect_$script:instance1' + "2008R2" = 'autodetect_$script:instance1' # run on scenario 2016 - "2016" = 'autodetect_$script:instance2' + "2016" = 'autodetect_$script:instance2' # run on scenario 2016_2017 - tests that need developer license - "2016_2017" = 'autodetect_$script:instance2,$script:instance3' + "2016_2017" = 'autodetect_$script:instance2,$script:instance3' #run on scenario service_restarts - SQL Server service tests that might disrupt other tests - "service_restarts" = @( + "service_restarts" = @( 'Start-DbaService', 'Stop-DbaService', 'Restart-DbaService', @@ -41,5 +41,5 @@ $TestsRunGroups = @{ 'Test-DbaDeprecatedFeature' ) # do not run everywhere - "disabled" = @() + "disabled" = @() } \ No newline at end of file