Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

find out how many objects i have in a var and members?

$
0
0

Hi all, not sure my terminology is 100% correct here so please tell me if im wrong. 

 

Im hoping to create a dynamic script that will populate excel with the results of any query i run against sql.

But im having trouble working out how to get the headers out. 

 

for example. 

 

SQL Query 

SELECT  name ,  cmptlevel , filename  FROM    sysdatabases

 

If i put the results of that query in a var called $results how could i find out that there 

 

$results.name, $results.cmptlevel and $results.filename ? 

 

i can get a list of them with $results | get-member but im not sure where to go with that.. or if i can. 

 

Hoping someone can help! 

S


Viewing all articles
Browse latest Browse all 6937

Trending Articles