Solved

Modify a Power Shell Script

Posted on 2011-09-29
4
247 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Set OWA language and time zone in Exchange for individuals, all users or per database.
Synchronize a new Active Directory domain with an existing Office 365 tenant
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

862 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

24 Experts available now in Live!

Get 1:1 Help Now