Solved

output Arrays with headers....

Posted on 2010-09-13
4
1,142 Views
Last Modified: 2012-08-13
Hi,
hopefully a simple question with a simple answer....

I Initialise an array, No problems,
$Global:myData = @()

Open in new window


I have an array populated in a loop, no problems.
{

Open in new window


I add to the array in an inside loop, again no problems
$myUser = Get-QADUser $username | Select Name, Email
$Global:myData += $myUser

Open in new window


I output the array contents, no problem FIRST time through but read on....
}
$myData | Sort Name | Select Name, Email -Unique

Open in new window


I reinitialise the array and loop back to next itteration...
$Global:myData = @()
	}

Open in new window


Now on the FIRST run through the loop i get output with column names of Name and  Email nicely underlined with the array data below listed nicely. On subsequent iterations of the loop, no column headings show?

How do i force it to show these headers with eacho output of $myData?

Thanks
0
Comment
Question by:Neil Russell
  • 2
  • 2
4 Comments
 
LVL 13

Assisted Solution

by:soostibi
soostibi earned 500 total points
ID: 33668710
I can not see your loops. I can only see { as your second code, and also the 5th and 6th code just a part.
0
 
LVL 37

Author Comment

by:Neil Russell
ID: 33742006
This is not a whole code listing, its the concept.  But easy enough to see the principal surely?
0
 
LVL 13

Accepted Solution

by:
soostibi earned 500 total points
ID: 33742550
Actually the items probably include the properties, just the formatting on the console is problematic. In this case I suggest to use the
| format-table name, email
at the very end of your expression.
0
 
LVL 37

Author Closing Comment

by:Neil Russell
ID: 33839194
Thanks for tha
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question