Skip to content

Discover-MSSQLServers suggestions #1

@mattifestation

Description

@mattifestation
  • Rename 'function Discover-MSSQLServers.ps1' to 'function Discover-MSSQLServers'

  • Remove the GroupResults and SortResults functionality. You should only output object and let the user figure out what to do with the raw output.

  • Is there a distinct performance hit when -ExtendedInfo is provided? If not, remove the -ExtendedInfo switch and just query those properties by default. Ideally, a function shouldn't output more than one type of object.

  • Only output objects! The following line is the equivalent of Write-Host and is unnecessary:
    Write-Output "Discovered $AllMSSQLServerFQDNsCount servers running MS SQL `r "

  • When creating custom object, creating a hastable of properties and adding them to a PSObject seems to be the unofficial best practice.
    e.g.
    $ObjectProperties = @{
    Prop1 = 1
    Prop2 = 2
    }

    New-Object -TypeName PSObject -Property $ObjectProperties

Otherwise, everything looks good! Now, I don't have a domain environment in which I can test this but perhaps @obsuresec does. Nice work!

-Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions