Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with a script

Posted on 2011-03-01
4
Medium Priority
?
299 Views
Last Modified: 2012-05-11
Need help writing a powershell script that will list smtp and alias of users in an OU
0
Comment
Question by:imy2000
  • 2
4 Comments
 
LVL 27

Expert Comment

by:KenMcF
ID: 35013547
You can use the Quest AD cmdlets and do this, not sure the format you need.


$u = get-qaduser -searchroot "OU=UsersOOU,DC=Domain,DC=Local" 
$u | %{
"$($_.name)"
"`t $($_.mail)"
Foreach ($add in ($_).proxyaddresses){
If ($add -match "smtp:"){
$add = $add -replace "smtp:", ""
"`t $($add)"
}}}

Open in new window

0
 

Accepted Solution

by:
imy2000 earned 0 total points
ID: 35322578
I wrote the script myself:
import-Csv -path 'c:\temp\xxxx.txt' | %{get-QADUser -Identity $_.ID -IncludedProperties mail,mailnickname } | Select name,dn,mail,mailnickname | export-CSV -notype -path c:\temp\results.csv
0
 

Author Closing Comment

by:imy2000
ID: 35360774
My solution was simple and was what I needed.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Screencast - Getting to Know the Pipeline

783 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