Passing in multiple instances into the dbatools command GET-DBADBFILE I am attempting to gather all of the dbfile information on all of our sql instances in one of our environments. It is a fairly large environment and would be tedious to perform one instance at a time. I thought there would be an easy way to do this with Powershell but I seem to be running into a roadblock.
I have a list of instances stored in a table/view [vSQLInstances]. If I pass those values into a variable and then use that variable as the SQLInstance parameter, I get an error.
Script I'm using...
$sqlinstance = Invoke-DbaQuery -SqlInstance dbasql01\sql2019 -Database DBAEstate -Query &quot;select sqlinstance from vSQLInstance;&quot;

Get-DbadbFile -SqlInstance $sqlinstance | Select-Object sqlinstance, database, logicalname, size 

The error I receive:
Get-DbaDbFile : Cannot process argument transformation on parameter 'SqlInstance'. Cannot convert value 
&quot;@{sqlinstance=PRODSQLD\D}&quot; to type &quot;Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter&quot;. Error: &quot;Failed to interpret 
input as Instance: @{sqlinstance=PRODSQLD\D}&quot;
At line:11 char:28
+ Get-DbaDbFile -SqlInstance $instancelist
+                            ~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (:) [Get-DbaDbFile], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DbaDbFile
Yes, that is expected because you are passing in a DataRow type. Instead you could pass it as a string type $sqlinstance.sqlinstance (the column name) as a parameter for Get-DbaDbFile to get the results.
Get-DbaDbFile -SqlInstance $sqlinstance.sqlinstance #...

For example...