dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 787 forks source link

Harmonize the description of the parameter SqlInstance #9396

Open andreasjordan opened 2 weeks ago

andreasjordan commented 2 weeks ago

After harmonizing the description of the parameter EnableException with #9395 I would like to work on SqlInstance

I have used this code to get the data for some of the parameters at once:

Import-Module -Name dbatools
$commands = Get-Command -Module dbatools -CommandType Function
$data = foreach ($command in $commands) {
    # $command = $commands[0]
    $parameters = (Get-Help -Name $command.Name).parameters.parameter
    [PSCustomObject]@{
        Command         = $command.Name
        SqlInstance     = ($parameters | Where-Object name -eq SqlInstance).description.text
        SqlCredential   = ($parameters | Where-Object name -eq SqlCredential).description.text
        Database        = ($parameters | Where-Object name -eq Database).description.text
        ExcludeDatabase = ($parameters | Where-Object name -eq ExcludeDatabase).description.text
        IncludeSystem   = ($parameters | Where-Object name -eq IncludeSystem).description.text
        Force           = ($parameters | Where-Object name -eq Force).description.text
        Confirm         = ($parameters | Where-Object name -eq Confirm).description.text
        WhatIf          = ($parameters | Where-Object name -eq WhatIf).description.text
        EnableException = ($parameters | Where-Object name -eq EnableException).description.text
        ParameterNames  = $parameters.name
    }
    Write-Host $command.Name
}

To show the mostly used description I have used this code:

$data | 
    Select-Object Command, SqlInstance | 
    Group-Object SqlInstance |
    Where-Object Name |
    Sort-Object Count -Descending |
    Select-Object Count, @{ n = 'Description' ; e = { $_.Name } }, @{ n = 'Command' ; e = { $_.Group.Command } } |
    Out-GridView -PassThru |
    Format-List *

And here is the result: 214: The target SQL Server instance or instances.

44: The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.

30: The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.

29: The target SQL Server instance or instances

19: The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.

18: The target SQL Server instance

17: The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.

17: The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.

10: The target SQL Server instance or instances. Defaults to localhost.

8: The target SQL Server instance or instances. This can be a collection and receive pipeline input.

6: The target SQL Server instance or instances. This can be a collection and receive pipeline input

5: The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or higher.

4: The target SQL Server instance or instances.You must have sysadmin access and server version must be SQL Server version 2000 or higher.

4: Use a combination of computername and instancename to get the SQL Server related services for specific instances on specific computers. Parameters ComputerName and InstanceName will be ignored if SqlInstance is used.