Solved

Powershell question

Posted on 2011-03-24
2
352 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
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

Are your AD admin tools letting you down?

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
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 give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…

948 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

23 Experts available now in Live!

Get 1:1 Help Now