Author | Simone Bizzotto (@niphold) , Friedrich Weinmann (@FredWeinmann) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaBuild on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaBuild.
Returns SQL Server Build "compliance" level on a build.
Returns info about the specific build of a SQL instance, including the SP, the CU and the reference KB, End Of Support, wherever possible. It adds a Compliance property as true/false, and adds details about the "targeted compliance".
The build data used can be found here: https://dbatools.io/builds
Test-DbaBuild
[[-Build] <Version[]>]
[[-MinimumBuild] <Version>]
[[-MaxBehind] <String>]
[-Latest]
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[-Update]
[-Quiet]
[-EnableException]
[<CommonParameters>]
PS C:\> Test-DbaBuild -Build "12.0.5540" -MinimumBuild "12.0.5557"
Returns information about a build identified by "12.0.5540" (which is SQL 2014 with SP2 and CU4), which is not compliant as the minimum required
build is "12.0.5557" (which is SQL 2014 with SP2 and CU8).
PS C:\> Test-DbaBuild -Build "12.0.5540" -MaxBehind "1SP"
Returns information about a build identified by "12.0.5540", making sure it is AT MOST 1 Service Pack "behind". For that version,
that identifies an SP2, means accepting as the lowest compliance version as "12.0.4110", that identifies 2014 with SP1.
Output column CUTarget is not relevant (empty). SPTarget and BuildTarget are filled in the result.
PS C:\> Test-DbaBuild -Build "12.0.5540" -MaxBehind "1SP 1CU"
Returns information about a build identified by "12.0.5540", making sure it is AT MOST 1 Service Pack "behind", plus 1 CU "behind". For that version,
that identifies an SP2 and CU, rolling back 1 SP brings you to "12.0.4110", but given the latest CU for SP1 is CU13, the target "compliant" build
will be "12.0.4511", which is 2014 with SP1 and CU12.
PS C:\> Test-DbaBuild -Build "12.0.5540" -MaxBehind "0CU"
Returns information about a build identified by "12.0.5540", making sure it is the latest CU release.
Output columns CUTarget, SPTarget and BuildTarget are relevant. If the latest build is a service pack (not a CU), CUTarget will be empty.
PS C:\> Test-DbaBuild -Build "12.0.5540" -Latest
Returns information about a build identified by "12.0.5540", making sure it is the latest build available.
Output columns CUTarget and SPTarget are not relevant (empty), only the BuildTarget is.
PS C:\> Test-DbaBuild -Build "12.00.4502" -MinimumBuild "12.0.4511" -Update
Same as before, but tries to fetch the most up to date index online. When the online version is newer, the local one gets overwritten.
PS C:\> Test-DbaBuild -Build "12.0.4502","10.50.4260" -MinimumBuild "12.0.4511"
Returns information builds identified by these versions strings.
PS C:\> Get-DbaRegServer -SqlInstance sqlserver2014a | Test-DbaBuild -MinimumBuild "12.0.4511"
Integrate with other cmdlets to have builds checked for all your registered servers on sqlserver2014a.
Instead of connecting to a real instance, pass a string identifying the build to get the info back.
Alias | |
Required | False |
Pipeline | false |
Default Value |
This is the build version to test "compliance" against. Anything below this is flagged as not compliant.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Instead of using a specific MinimumBuild here you can pass "how many service packs and cu back" is the targeted compliance level. You can use xxSP or xxCU or both, where xx is a number. See the
Examples for more information.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Shortcut for specifying the very most up-to-date build available.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Target any number of instances, in order to return their compliance state.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Looks online for the most up to date reference, replacing the local one.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Makes the function just return $true/$false. It's useful if you use Test-DbaBuild in your own scripts.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |