Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Script Needed for User Info

Posted on 2011-10-26
11
Medium Priority
?
188 Views
Last Modified: 2012-05-12
Hello - I need a script that will run against a list of users and the output should include: Name / Title (Description) / e-mail address / telephone number

Thanks
0
Comment
Question by:vhaperbaugub
  • 6
  • 5
11 Comments
 
LVL 14

Expert Comment

by:athomsfere
ID: 37030640

Here is one using Quest Active Directory cmdlts in Powershell that queries with their SamAccountName

$Filename = ExportList
Get-Content 'C:\Userlist.txt' `
      | Foreach-Object {(Get-QADUser -SamAccountName $_ -IncludeAllProperties `
            | Select-Object  Name, Title, email, telephone)} `
            |Export-Csv $Path$Filename.csv


Start $Path$Filename.csv
0
 

Author Comment

by:vhaperbaugub
ID: 37032818
I'm getting an error on: Get-QADUser ???

0
 

Author Comment

by:vhaperbaugub
ID: 37033239
I got it to work, however the telephone column is blank
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 14

Expert Comment

by:athomsfere
ID: 37033763
Whoops, yes you should ;)

The correct field is TelephoneNumber
0
 

Author Comment

by:vhaperbaugub
ID: 37033803
That worked.....I was looking all over for the correct syntax, where can I find it I want to add other info?
0
 
LVL 14

Expert Comment

by:athomsfere
ID: 37033857
Pick a user, any user and use the following:

Get-QADUser -SamAccountName <username> -includeallproperties | Format-list * > C:\ADPropDump.txt

And then open the file, and you will see everything in AD that you can query with QAD
0
 

Author Comment

by:vhaperbaugub
ID: 37034037
Thanks.....that worked.....one last question.....whats the advantage of using QAD over regular PS? Does QAD only get info from AD?
0
 
LVL 14

Expert Comment

by:athomsfere
ID: 37034297
Quest cmdlets have a little more functionality, and as I remember the built in PS stuff requires LDAP in the queries, so its easier to use the QAD tools IMO.

To be honest, I don't remember exactly why I moved to QAD, I just know that once I started to use it I liked it better than the built in Powershell functions.
0
 

Author Comment

by:vhaperbaugub
ID: 37037767
Can Quest also find other info, such as Mailbox Size? Deleted Items Size? If so, what is the command for that?
0
 
LVL 14

Accepted Solution

by:
athomsfere earned 2000 total points
ID: 37037906
You can get some things from the Quest AD... You will need something more Exchange ready for actual mailbox attributes, looks like Quest has some Exchange Power packs http://powergui.org/kbcategory.jspa?categoryID=47

I have not used these though, as I no longer work with Exchange directly.
0
 

Author Comment

by:vhaperbaugub
ID: 37049664
Thanks for the info and the help.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Loops Section Overview
Screencast - Getting to Know the Pipeline

578 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