Solved

Modify a Power Shell Script

Posted on 2011-09-29
4
254 Views
Last Modified: 2012-05-12
Can someone please modify this PowerShell script so that it will show the "Title" of the user in the output file?

Get-MailboxServer | Get-Mailbox -ResultSize Unlimited |
Get-MailboxStatistics | Where {$_.TotalItemSize -gt 1MB} |
Select DisplayName, LegacyDN, ItemCount,  `
   @{label="CalendarItemSize (MB)";expression={(Get-MailboxFolderStatistics -Identity $_.Identity -FolderScope Calendar).FolderAndSubfolderSize.ToMB()}},  `
   @{label="Total Deleted Size (MB)";expression={$_.TotalDeletedItemSize.Value.ToMB()}},  `
   @{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},  `
   StorageLimitStatus,  Database, LastLogonTime |
Export-Csv All_users_mailbox_sizeV5All-9-28-2011.csv -notypeinformation
0
Comment
Question by:vhaperbaugub
[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
  • 3
4 Comments
 
LVL 27

Expert Comment

by:KenMcF
ID: 36814267
try adding this into your script.


Get-MailboxServer | Get-Mailbox -ResultSize Unlimited | 
Get-MailboxStatistics | Where {$_.TotalItemSize -gt 1MB} | 
Select DisplayName, LegacyDN, ItemCount,
   @{label="CalendarItemSize (MB)";expression={(Get-MailboxFolderStatistics -Identity $_.Identity -FolderScope Calendar).FolderAndSubfolderSize.ToMB()}},
   @{label="Total Deleted Size (MB)";expression={$_.TotalDeletedItemSize.Value.ToMB()}},
   @{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},
   @{label="Title";expression={get-user $_.samaccountname}},
   StorageLimitStatus,  Database, LastLogonTime | 
Export-Csv All_users_mailbox_sizeV5All-9-28-2011.csv -notypeinformation

Open in new window

0
 
LVL 27

Expert Comment

by:KenMcF
ID: 36814331
wait, forgot something in my last post

replace this line

@{label="Title";expression={get-user $_.samaccountname}},

With this

@{label="Title";expression={(get-user $_.samaccountname).title}},
0
 
LVL 27

Accepted Solution

by:
KenMcF earned 500 total points
ID: 36814374
one more try, after testing this time

@{label="Title";expression={(get-user $_.displayname).title}},
0
 

Author Comment

by:vhaperbaugub
ID: 36814510
Looks like it is working great.....Thanks!
0

Featured Post

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

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
A procedure for exporting installed hotfix details of remote computers using powershell
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ā€¦

732 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