Solved

Powershell question

Posted on 2011-03-24
2
347 Views
Last Modified: 2012-05-11
hello, need assistance with the last part of this script.
basically, trying to send the results of this script to a csv:

get-qaduser -searchroot "OU=accounts,DC=domain,DC=com" -ldapfilter '(sAMAccountName)' | Format-List name,description

would like to | these results to a .csv.
i've tried adding this at the end:  | export-csv results.csv

but doesnt work.

thanks in advance,

S.
0
Comment
Question by:siber1
2 Comments
 
LVL 10

Accepted Solution

by:
wls3 earned 500 total points
Comment Utility
As noted by Brandon in this post:

http://www.eggheadcafe.com/software/aspnet/33415041/exportcsv-issues.aspx

you should use the select instead of format cmdlet before piping to the export-csv cmdlet.  You might want to do some dry runs on the select versus the format cmdlets with gm to see what kind of differences there are in the underlying objects.

To answer your question, try this:

get-qaduser -searchroot "OU=accounts,DC=domain,DC=com" -ldapfilter '(sAMAccountName)' | Select name,description | export-csv results.csv

Open in new window

0
 

Author Comment

by:siber1
Comment Utility
that did it! thanks much
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
This article will help you understand what HashTables are and how to use them in PowerShell.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now