dbatools
dbatools copied to clipboard
Get-DbaDbColumn and Get-DbaDbPrimaryKey
Summary of new feature
Being able to get column names from a table and more importantly the PrimaryKey(s) of a table.
Latest version of dbatools as of writing
1.0.153
- Please provide the latest released version of dbatools module. 1.0.153
Using Get-DbaDbTable you can do this:
$table = Get-DbaDbTable -SqlInstance SRV1\SQL2017 -Database AdventureWorks -Table 'Person.Person'
$table.Columns | Format-Table -Property Name, InPrimaryKey, Datatype

What else would you like to have?
I also found a way to get the data needed in the end. I was suggested to request this as a new command in the dbatools slack channel. But I guess it's not that important if you can achieve your results with the current commands.
Thanks!