Format-Table doesn't play nice with the pipeline past itself. From your example I suspect you used Out-File instead of Export-CSV. I just did as a quick test of both and the output is not nearly as pretty as Export-CSV
Using select-object you narow down which items get passed down the pipeline but you still preserve all the data, etc. This will play nice with the various Export-* commands. The various Format-* commands are realy for output to the screen as your end destination. They dont seem to play nice with the pipeline past themselves. The downside to select-object is that ONLY the items you select are passed along. Everything else gets dropped. For most basic scripts/cmdline uses this is fine. It only gets complicated if you wanted to do more stuff with other data in the object. So, as a habit when playing with data, I would suggest using select-object as it plays nice with the pipelines which opens up a world of oportunity later. You should definitly check out the 3 videos I suggested earlier. I'm still learning stuff I missed myself and I posted some notes on what I learned in the last one. I need to go back over the remoting one so may post notes on that one as well. http://www.blkmtn.org/PowerShell-neat_function_tricks_for_free MBS or one of the others will point out if I don't have this quite right as he is way better at PowerShell than I am, but the PowerShell community as a practice tends to discourage Format-* as the output point in scripts. It tends to make it less useful in the long run for flexibility and re-use. Steven Peck http://www.blkmtn.org On Mon, Aug 6, 2012 at 12:28 PM, Guyer, Don <dgu...@che.org> wrote: > That’s interesting because I just used Format Table to export a list of > addresses and SAM accounts for over 4k users, to an Excel file.**** > > ** ** > > Keep in mind, I’m just now FINALLY getting to learn and use PS more.**** > > ** ** > > Regards,**** > > * * > > *Don Guyer** > **Catholic Health East - Information Technology***** > > Enterprise Directory & Messaging Services > 3805 West Chester Pike, Suite 100, Newtown Square, Pa 19073**** > > email: *dgu...@che.org***** > > Office: 610.550.3595 | Cell: 610.955.6528 | Fax: 610.271.9440**** > > *For immediate assistance, please open a Service Desk ticket or call the > helpdesk @ 610-492-3839.* > > [image: Description: Description: Description: InfoService-Logo240]**** > > ** ** > > *From:* Steven Peck [mailto:sep...@gmail.com] > *Sent:* Monday, August 06, 2012 3:18 PM > > *To:* NT System Admin Issues > *Subject:* Re: PS export question**** > > ** ** > > oO.... **** > > Ya, don't use Format-Table. Format-Table will display to the screen but > won't go to the file. For this you can use Select-Object. Select-Object > has some other side effects that aren't important in this context.**** > > **** > > I tested with**** > > $user = Get-QADUser -sizelimit 0**** > > $user | select displayname, name, passwordlastset -first 10 | Export-Csv > ./testFile.csv -NoTypeInformation**** > > **** > > Once that worked, I removed the -first 10 from select**** > > The -NoTypeInformation is to remove the annoying .NET type line that gets > put on the first line of the CSV file. The -sizelimit 0 will get you past > the default query limit of AD.**** > > **** > > $user | select displayname, name, passwordlastset | Export-Csv > ./testFile.csv -NoTypeInformation**** > > **** > > Side notes... When dealing with larger data, I tend to dump the query into > a variable. This way I am playing with the data locally and not waiting > for the query to complete each time I test.**** > > **** > > There are three nice powershell videos you may want to check out here:**** > > http://www.blkmtn.org/TechEd-2012-Videos**** > > **** > > **** > > Steven Peck**** > > http://www.blkmtn.org**** > > **** > > > > **** > > On Mon, Aug 6, 2012 at 11:04 AM, Jimmy Tran <jt...@teachtci.com> wrote:*** > * > > I’m trying to get a list of passwords last set from AD for my users.**** > > **** > > I run: **** > > add-PSSnapin quest.activeroles.admanagement**** > > Get-QADUser |ft displayname,PasswordLastSet | export-csv -path > c:\PasswordLastSet.csv**** > > **** > > But the data doesn’t come back as expected. If I omit the export command, > the results show fine in PS. What am I doing wrong?**** > > **** > > TIA,**** > > > Jimmy**** > > **** > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to listmana...@lyris.sunbeltsoftware.com > with the body: unsubscribe ntsysadmin**** > > ** ** > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to listmana...@lyris.sunbeltsoftware.com > with the body: unsubscribe ntsysadmin**** > Confidentiality Notice: > > This e-mail, including any attachments is the > property of Catholic Health East and is intended > for the sole use of the intended recipient(s). > It may contain information that is privileged and > confidential. Any unauthorized review, use, > disclosure, or distribution is prohibited. If you are > not the intended recipient, please delete this message, and > reply to the sender regarding the error in a separate email. > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to listmana...@lyris.sunbeltsoftware.com > with the body: unsubscribe ntsysadmin > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin
<<image001.jpg>>