?
Solved

Powershell question

Posted on 2011-03-24
2
Medium Priority
?
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
wls3 earned 2000 total points
ID: 35210201
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
ID: 35210362
that did it! thanks much
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

765 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