How do I write a simple Exchange Management Shell Script

How do I write a simple script in Exchange Management 2007 Shell and save the results to a file?  The results should have the following headings User's Name (not username), Title, Department and email address.  And the filter should be based on 3 different departments in the same report.  Your help is greatly appreciated!
silviomelAsked:
Who is Participating?
 
Chris DentPowerShell DeveloperCommented:

Sorry, I missed a closing " from the command above which will cause it to fail. Corrections here:

Get-User -Filter "Department -Like '*Department*' -Or Department -Like '*OtherDepartment*'" `
  | Select-Object Name, WindowsEmailAddress, Title, Department

To export that to a file you can change it to:

Get-User -Filter "Department -Like '*Department*' -Or Department -Like '*OtherDepartment*'" `
  | Select-Object Name, WindowsEmailAddress, Title, Department | Export-CSV "out.csv"

Chris
0
 
Chris DentPowerShell DeveloperCommented:

Something like this:

Get-User -Filter "Department -Like '*Department*' -Or Department -Like '*OtherDepartment*' `
  | Select-Object Name, WindowsEmailAddress, Title, Department

To export that to a file you can change it to:

Get-User -Filter "Department -Like '*Department*' -Or Department -Like '*OtherDepartment*' `
  | Select-Object Name, WindowsEmailAddress, Title, Department | Export-CSV "out.csv"

Chris
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.